How to use the saucelabs.default function in saucelabs

To help you get started, we’ve selected a few saucelabs 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 chialab / rna-cli / lib / TestRunners / plugins / karma-sauce-launcher / reporter / reporter.js View on Github external
this.onBrowserComplete = function(browser) {
        const result = browser.lastResult;
        const browserId = browser.id;
        if (result.disconnected) {
            log.error('✖ Browser disconnected');
        }
        if (result.error) {
            log.error('✖ Tests errored');
        }
        const browserData = browserMap.get(browserId);
        // Do nothing if the current browser has not been launched through the Saucelabs launcher
        if (!browserData) {
            return;
        }
        const { username, accessKey, proxy, sessionId } = browserData;
        const saucelabs = new SauceLabs({
            user: username,
            key: accessKey,
            proxy,
        });
        const hasPassed = !(result.failed || result.error || result.disconnected);
        // Update the job by reporting the test results. Also we need to store the promise here
        // because in case "onExit" is being called, we want to wait for the API calls to finish.
        pendingUpdates.push(
            saucelabs.updateJob(username, sessionId, {
                'passed': hasPassed,
                'custom-data': result,
            }).catch(error => log.error('Could not report results to Saucelabs: %s', error))
        );
    };
    // Whenever this method is being called, we just need to wait for all API calls to finish,
github Starcounter-Jack / JSON-Patch / test / Sauce / CapabilityRunner.js View on Github external
return new Promise(function(resolve, reject) {
    console.log("");
    console.log(caps.name);

    const username = caps.username;
    const accessKey = caps.accessKey;

    const saucelabs = new SauceLabs({
      username: username,
      password: accessKey
    });

    const By = webdriver.By;

    let driver = new webdriver.Builder()
      .withCapabilities(caps)
      .usingServer(
        "http://" + username + ":" + accessKey + "@localhost:4445/wd/hub"
      )
      .build();

    driver.get(
      "http://localhost:5000/test/index.html"
    );

saucelabs

A wrapper around Sauce Labs REST API

Apache-2.0
Latest version published 7 months ago

Package Health Score

82 / 100
Full package analysis