How to use the webdriver.remote.sessionid function in webdriver

To help you get started, we’ve selected a few webdriver 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 bookbrainz / bookbrainz-site / test / custom_commands / customSauceEnd.js View on Github external
export function command() {
	const saucelabs = new SauceLabs({
		password: process.env.SAUCE_ACCESS_KEY,
		username: process.env.SAUCE_USERNAME
	});

	const sessionid = this.capabilities['webdriver.remote.sessionid'];
	const jobName = this.currentTest.name;

	saucelabs.updateJob(sessionid, {
		name: jobName,
		passed: this.currentTest.results.failed === 0
	}, () => {
		// empty
	});

	this.end();
}
/* eslint-enable babel/no-invalid-this */
github uber / baseweb / e2e / commands / notifySauceLabs.js View on Github external
exports.command = function(callback) {
  // sauce lab does not support the concept of branches, so only reporting the master results
  if (process.env.BUILDKITE_BRANCH !== 'master') {
    return callback();
  }
  const saucelabs = new SauceLabs({
    username: process.env.SAUCE_USERNAME,
    password: process.env.SAUCE_ACCESS_KEY,
  });

  const sessionId = this.capabilities['webdriver.remote.sessionid'];
  const name = this.currentTest.name;

  // TODO(#363): figure out how we can report proper test statuses for the master branch
  saucelabs.updateJob(
    sessionId,
    {
      passed: true,
      name,
    },
    callback,
  );
};
github summernote / summernote / test / libs / sauce.js View on Github external
const reportResult = (client, done) => {
  if (!process.env.TRAVIS) { return done(); }

  const user = client.options.username;
  const key = client.options.accessKey;
  const jobId = client.capabilities['webdriver.remote.sessionid'];

  if (user && key && jobId) {
    const passed = client.currentTest.results.failed === 0;
    console.log('* updating job status:', jobId, passed);
    const url = 'https://saucelabs.com/rest/v1/' + user + '/jobs/' + jobId;
    return request.put({
      url: url,
      auth: {
        username: user,
        password: key,
      },
      headers: { 'content-type': 'application/json' },
      body: JSON.stringify({ passed: passed }),
    }, function(res, status, body) {
      console.log('Sauce response:', body);
      done();
github watson-virtual-agents / chat-widget / test / selenium / sauce / index.js View on Github external
module.exports = function sauce(client, callback) {
  var currentTest = client.currentTest;
  var username = client.options.username;
  var sessionId = client.capabilities['webdriver.remote.sessionid'];
  var accessKey = client.options.accessKey;

  if (!username || !accessKey || !sessionId) {
    console.log(client);
    return callback();
  }

  var passed = currentTest.results.passed === currentTest.results.tests;

  var data = JSON.stringify({ passed });

  var axios = Axios.create({
    baseURL: 'https://saucelabs.com',
    auth: {
      username: username,
      password: accessKey
github gymnastjs / gymnast / test / screenshot / commands / sauceEnd.js View on Github external
exports.command = function command(callback) {
  const saucelabs = new SauceLabs({
    username,
    password: accessKey,
  })
  const sessionId = this.capabilities['webdriver.remote.sessionid']
  const { name } = this.currentTest
  const passed = this.currentTest.results.failed === 0

  saucelabs.updateJob(sessionId, { passed, name }, callback)

  return this
}
github gymnastjs / picturebook / test / screenshot / commands / seleniumEnd.js View on Github external
exports.command = function seleniumEnd(callback) {
  const saucelabs = new SauceLabs({
    username: image.username,
    password: image.accessKey,
  })
  const sessionId = this.capabilities['webdriver.remote.sessionid']
  const { name } = this.currentTest
  const passed = this.currentTest.results.failed === 0

  saucelabs.updateJob(sessionId, { passed, name }, callback)

  return this
}
github DevExpress / testcafe-browser-provider-browserstack / src / backends / automate.js View on Github external
static _ensureSessionId (sessionInfo) {
        const sessionData         = sessionInfo.value || {};
        const sessionCapabilities = sessionData.capabilities || {};

        sessionInfo.sessionId = sessionInfo.sessionId ||
                                sessionData.sessionId ||
                                sessionData['webdriver.remote.sessionid'] ||
                                sessionCapabilities['webdriver.remote.sessionid'];

        if (!sessionInfo.sessionId) {
            throw new Error(ERROR_MESSAGES.SESSION_ID_NOT_FOUND({
                sessionInfoDump: inspect(sessionInfo)
            }));
        }
    }
github DevExpress / testcafe-browser-provider-browserstack / src / backends / automate.js View on Github external
static _ensureSessionId (sessionInfo) {
        const sessionData         = sessionInfo.value || {};
        const sessionCapabilities = sessionData.capabilities || {};

        sessionInfo.sessionId = sessionInfo.sessionId ||
                                sessionData.sessionId ||
                                sessionData['webdriver.remote.sessionid'] ||
                                sessionCapabilities['webdriver.remote.sessionid'];

        if (!sessionInfo.sessionId) {
            throw new Error(ERROR_MESSAGES.SESSION_ID_NOT_FOUND({
                sessionInfoDump: inspect(sessionInfo)
            }));
        }
    }
github department-of-veterans-affairs / vets-website / config / nightwatch-globals-sauce.js View on Github external
afterEach(browser, done) {
    const SauceLabs = require('saucelabs');

    const saucelabs = new SauceLabs({
      username: process.env.SAUCE_USERNAME,
      password: process.env.SAUCE_ACCESS_KEY,
    });

    const sessionid = browser.capabilities['webdriver.remote.sessionid'];
    const jobName = browser.currentTest.module;

    function noFailures(item) {
      return item.failed === 0 && item.errors === 0;
    }

    const testCaseData = Object.keys(browser.currentTest.results.testcases).map(
      key => browser.currentTest.results.testcases[key],
    );

    const passed = testCaseData.every(noFailures);

    saucelabs.updateJob(
      sessionid,
      {
        passed,

webdriver

A Node.js bindings implementation for the W3C WebDriver and Mobile JSONWire Protocol

MIT
Latest version published 13 days ago

Package Health Score

94 / 100
Full package analysis