How to use runWebDriver method in devicefarmer-stf

Best JavaScript code snippet using devicefarmer-stf

index.js

Source:index.js Github

copy

Full Screen

1import BrowserStackTunnel from 'browserstacktunnel-wrapper';2import selenium from 'selenium-standalone';3import install from './install';4import spawn from './spawn-process';5import makeConfig from './make-config';6export default function(gulp, plugins, config) {7 const {environment} = config;8 const {gutil} = plugins;9 const {PluginError} = gutil;10 const {isDev} = environment;11 return (gulpCb) => {12 const {13 specType,14 installOpts,15 spawnOpts,16 spawnTunnelOpts,17 baseConfig,18 tunnelConfig,19 remoteConfig,20 task,21 suffix22 } = makeConfig({config, gulp});23 function runWebdriver(opts, task) {24 gutil.log(gutil.colors.magenta(`Starting Parallel Tests for [${specType || task}]`));25 return spawn(opts);26 }27 function closeCp(cp, cbFn) {28 const cbLen = cbFn.length;29 cp.on('close', (code) => {30 const message = `Child process [${specType || ''}] closed status: ${code}`;31 if (cbLen <= 1 && cbFn !== gulpCb) {32 cbFn(code);33 gutil.log(message);34 gulpCb();35 //process.exit(code);36 } else if (cbLen === 2) {37 cbFn(code, () => {38 gutil.log(message);39 cp.kill(code);40 gulpCb();41 //process.exit(code);42 });43 }44 });45 }46 if (task === 'tunnel') {47 /**48 * gulp selenium:tunnel49 * Start a Browserstack tunnel to allow using local IP's for50 * Browserstack tests (Automate) and live viewing (Live)51 */52 let browserStackTunnel = new BrowserStackTunnel(spawnTunnelOpts);53 browserStackTunnel.on('started', () => {54 gutil.log(browserStackTunnel.stdoutData);55 });56 browserStackTunnel.start((err) => {57 if (err) {58 throw new PluginError({59 plugin: '[tunnel start]',60 message: err.message61 });62 } else {63 if (suffix && suffix === 'live') {64 gutil.log('Visit BrowserStack Live to QA: https://www.browserstack.com/start');65 } else {66 const cp = runWebdriver(tunnelConfig, task);67 closeCp(cp, (code, closeCb) => {68 browserStackTunnel.stop((err) => {69 if (err) {70 gutil.log(err);71 }72 closeCb();73 });74 });75 }76 }77 });78 } else if (isDev) {79 install(installOpts, () => {80 selenium.start(spawnOpts, (err, child) => {81 if (err) {82 throw new PluginError({83 plugin: '[selenium]',84 message: `${err.message} => pkill java`85 });86 }87 const cp = runWebdriver(baseConfig, 'local');88 closeCp(cp, (code) => {89 child.kill(code);90 });91 });92 });93 } else {94 const cp = runWebdriver(remoteConfig, 'remote');95 closeCp(cp, gulpCb);96 }97 };...

Full Screen

Full Screen

tools.js

Source:tools.js Github

copy

Full Screen

1// @flow2const bolt = require('bolt');3const path = require('path');4const { exists } = require('./fs');5async function getPackagesInfo(cwd /*:string*/, opts /*: ?Object */) {6 const project = await bolt.getProject({ cwd });7 const packages = await bolt.getWorkspaces({ cwd, ...opts });8 return Promise.all(packages.map(pkg => getPackageInfo(pkg, project)));9}10async function getPackageInfo(pkg /*: Object */, project /*: Object*/) {11 const cwd = process.cwd();12 const resolvedProject = project || (await bolt.getProject({ cwd }));13 const relativeDir = path.relative(resolvedProject.dir, pkg.dir);14 const srcExists = await exists(path.join(pkg.dir, 'src'));15 const tsConfigExists = await exists(path.join(pkg.dir, 'tsconfig.json'));16 const tsBuildConfigExists = await exists(17 path.join(pkg.dir, 'build', 'tsconfig.json'),18 );19 const testBrowserExists = await exists(path.join(pkg.dir, '__tests-karma__'));20 const testWebdriverExists = await exists(21 path.join(pkg.dir, 'src', '__tests__', 'integration'),22 );23 const testVisualRegressionExists = await exists(24 path.join(pkg.dir, 'src', '__tests__', 'visual-regression'),25 );26 const isBrowserPackage = !relativeDir.startsWith('build');27 const isWebsitePackage = relativeDir.startsWith('website');28 const allDependencies = Object.assign(29 {},30 pkg.config.dependencies,31 pkg.config.devDependencies,32 pkg.config.peerDependencies,33 );34 const hasKarmaDep = !!allDependencies.karma;35 const runTypecheck = tsConfigExists;36 const runTypeScriptBuild = tsBuildConfigExists;37 const runBabel = srcExists && !runTypecheck && !isWebsitePackage;38 const runFlow = runBabel || isWebsitePackage;39 const runESLint = srcExists || isWebsitePackage || !isBrowserPackage;40 const runKarma = testBrowserExists || hasKarmaDep;41 const runBrowserStack = runKarma;42 const runStyleLint = srcExists && isBrowserPackage;43 const runWebdriver = testWebdriverExists;44 const runVisualRegression = testVisualRegressionExists;45 return {46 dir: pkg.dir,47 name: pkg.name,48 config: pkg.config,49 relativeDir,50 runTypeScriptBuild,51 runTypecheck,52 runBabel,53 runFlow,54 runESLint,55 runKarma,56 runBrowserStack,57 runStyleLint,58 runWebdriver,59 runVisualRegression,60 isBrowserPackage,61 };62}63const TOOL_NAME_TO_FILTERS /*: { [key: string]: (pkg: Object) => boolean } */ = {64 typecheck: pkg => pkg.runTypecheck,65 typescriptbuild: pkg => pkg.runTypeScriptBuild,66 babel: pkg => pkg.runBabel,67 flow: pkg => pkg.runFlow,68 eslint: pkg => pkg.runESLint,69 karma: pkg => pkg.runKarma,70 browserstack: pkg => pkg.runBrowserStack,71 stylelint: pkg => pkg.runStyleLint,72 webdriver: pkg => pkg.runWebdriver,73 vr: pkg => pkg.runVisualRegression,74};75module.exports = {76 getPackageInfo,77 getPackagesInfo,78 TOOL_NAME_TO_FILTERS,...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1const runWebDriver = require('devicefarmer-stf-utils').runWebDriver2const webdriver = require('selenium-webdriver')3const chrome = require('selenium-webdriver/chrome')4const path = require('chromedriver').path5runWebDriver().then(function(driver) {6 driver.manage().window().maximize()7 driver.findElement(By.name('q')).sendKeys('webdriver')8 driver.findElement(By.name('btnG')).click()9 driver.wait(until.titleIs('webdriver - Google Search'), 5000)10 driver.quit()11})12{13 "scripts": {14 },15 "dependencies": {16 }17}

Full Screen

Using AI Code Generation

copy

Full Screen

1var client = require('devicefarmer-stf-client');2var webdriver = require('selenium-webdriver');3var desiredCapabilities = {4};5var driver = new webdriver.Builder()6 .withCapabilities(desiredCapabilities)7 .build();8driver.findElement(webdriver.By.name('q')).sendKeys('webdriver');9driver.findElement(webdriver.By.name('btnG')).click();10driver.wait(function() {11 return driver.getTitle().then(function(title) {12 return title === 'webdriver - Google Search';13 });14}, 1000);15client.runWebDriver(driver, function (err, result) {16 console.log('runWebDriver result: ' + result);17});18driver.quit();19{20 "dependencies": {21 }22}23{24 "dependencies": {25 "devicefarmer-stf-client": {26 "requires": {27 }28 },29 "selenium-webdriver": {

Full Screen

Using AI Code Generation

copy

Full Screen

1var devicefarmer = require('devicefarmer-stf');2 if (err) return console.error(err);3 browser.quit();4});5var devicefarmer = require('devicefarmer-stf');6 if (err) return console.error(err);7 browser.quit();8});9var devicefarmer = require('devicefarmer-stf');10 if (err) return console.error(err);11 browser.quit();12});13var devicefarmer = require('devicefarmer-stf');14 if (err) return console.error(err);15 browser.quit();16});17var devicefarmer = require('devicefarmer-stf');18 if (err) return console.error(err);19 browser.quit();20});21var devicefarmer = require('devicefarmer-stf');22 if (err) return console.error(err);23 browser.quit();24});25var devicefarmer = require('devicefarmer-stf

Full Screen

Using AI Code Generation

copy

Full Screen

1var runWebDriver = require('devicefarmer-stf-provider').runWebDriver;2var exec = require('child_process').exec;3var child;4var appiumServer;5var appiumServer2;6var appiumServer3;7var appiumServer4;8var appiumServer5;9var appiumServer6;10var appiumServer7;11var appiumServer8;12var appiumServer9;13var appiumServer10;14var appiumServer11;15var appiumServer12;16var appiumServer13;17var appiumServer14;18var appiumServer15;19var appiumServer16;20var appiumServer17;21var appiumServer18;22var appiumServer19;23var appiumServer20;24var appiumServer21;25var appiumServer22;26var appiumServer23;27var appiumServer24;28var appiumServer25;29var appiumServer26;30var appiumServer27;31var appiumServer28;32var appiumServer29;33var appiumServer30;34var appiumServer31;35var appiumServer32;36var appiumServer33;37var appiumServer34;38var appiumServer35;39var appiumServer36;40var appiumServer37;41var appiumServer38;42var appiumServer39;43var appiumServer40;44var appiumServer41;45var appiumServer42;46var appiumServer43;47var appiumServer44;48var appiumServer45;49var appiumServer46;50var appiumServer47;51var appiumServer48;52var appiumServer49;53var appiumServer50;54var appiumServer51;55var appiumServer52;56var appiumServer53;57var appiumServer54;58var appiumServer55;59var appiumServer56;60var appiumServer57;61var appiumServer58;62var appiumServer59;63var appiumServer60;64var appiumServer61;65var appiumServer62;66var appiumServer63;67var appiumServer64;68var appiumServer65;69var appiumServer66;70var appiumServer67;71var appiumServer68;72var appiumServer69;73var appiumServer70;74var appiumServer71;75var appiumServer72;76var appiumServer73;77var appiumServer74;

Full Screen

Using AI Code Generation

copy

Full Screen

1var devicefarmer = require('devicefarmer-stf-client');2var client = new devicefarmer.Client();3var webdriver = require('selenium-webdriver');4client.runWebDriver({serial: 'R32CB0Z9X6Z'}, function(err, driver) {5 if (err) {6 console.log('Error while executing runWebdriver: ' + err);7 } else {8 driver.findElement(webdriver.By.name('q')).sendKeys('webdriver');9 driver.findElement(webdriver.By.name('btnG')).click();10 driver.wait(function() {11 return driver.getTitle().then(function(title) {12 return title === 'webdriver - Google Search';13 });14 }, 1000);15 }16});17{18 "dependencies": {19 }20}21new Client([options])22runWebDriver(options, callback)23run(options, callback)

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run devicefarmer-stf automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful