How to use the testcafe-browser-tools.getInstallations function in testcafe-browser-tools

To help you get started, we’ve selected a few testcafe-browser-tools examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github reimagined / resolve / examples / todo / testcafe_runner.js View on Github external
#!/usr/bin/env node
const yargs = require('yargs');
const createTestCafe = require('testcafe');
const { getInstallations } = require('testcafe-browser-tools');
const DELAY = 10000;
let testcafe = null;

const argv = yargs
    .option('browser', {
        alias: 'b',
        default: false
    })
    .help().argv;

getInstallations().then(browsers =>
    createTestCafe('localhost', 1337, 1338)
        .then((tc) => {
            testcafe = tc;
            const runner = testcafe.createRunner();
            const browser = argv.browser || Object.keys(browsers).slice(0, 1);
            return runner
                .startApp('npm run start', DELAY)
                .src(['./testcafe/index.tests.js'])
                .browsers(browser)
                .run();
        })
        .then((exitCode) => {
            testcafe.close();
            process.exit(exitCode);
        })
);
github DevExpress / testcafe / Gulpfile.js View on Github external
function testClient (tests, settings, envSettings, cliMode) {
    function runTests (env, runOpts) {
        return gulp
            .src(tests)
            .pipe(qunitHarness(settings, env, runOpts));
    }

    if (!cliMode)
        return runTests(envSettings);

    return listBrowsers().then(browsers => {
        const browserNames   = Object.keys(browsers);
        const targetBrowsers = [];

        browserNames.forEach(browserName => {
            if (CLIENT_TEST_LOCAL_BROWSERS_ALIASES.includes(browserName))
                targetBrowsers.push({ browserInfo: browsers[browserName], browserName: browserName });
        });

        return runTests({ browsers: targetBrowsers }, { cliMode: true });
    });
}
github DevExpress / testcafe / src / browser / provider / built-in / locally-installed.js View on Github external
async getBrowserList () {
        const installations = await browserTools.getInstallations();

        return Object.keys(installations);
    },