Skip to content

Instantly share code, notes, and snippets.

@fand
Created July 11, 2015 15:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fand/6060e0599df64af40015 to your computer and use it in GitHub Desktop.
Save fand/6060e0599df64af40015 to your computer and use it in GitHub Desktop.
WDIO3 multi browser test
'use strict';
var webdriverio = require('webdriverio');
var assert = require('assert');
describe('top page', function () {
var chrome, firefox;
before(function *() {
chrome = webdriverio.remote({ desiredCapabilities : {browserName : 'chrome'} });
firefox = webdriverio.remote({ desiredCapabilities : {browserName : 'firefox'} });
yield chrome.init();
yield firefox.init();
});
describe('chrome', function() {
it('should do something', function *() {
yield chrome
.url('https://duckduckgo.com/')
.setValue('#search_form_input_homepage', 'WebdriverIO')
.click('#search_button_homepage');
var title = yield chrome.getTitle();
console.log(title); // outputs: "Title is: WebdriverIO (Software) at DuckDuckGo"
});
});
describe('firefox', function() {
it('should do something', function *() {
yield firefox
.url('https://duckduckgo.com/')
.setValue('#search_form_input_homepage', 'WebdriverIO')
.click('#search_button_homepage');
var title = yield firefox.getTitle();
console.log(title); // outputs: "Title is: WebdriverIO (Software) at DuckDuckGo"
});
});
after(function* () {
yield chrome.end();
yield firefox.end();
});
});
'use strict';
var webdriverio = require('webdriverio');
var assert = require('assert');
var matrix = webdriverio.multiremote({
chrome : {
desiredCapabilities : {browserName : 'chrome'}
},
firefox : {
desiredCapabilities : {browserName : 'firefox'}
},
});
describe('top page', function () {
var chrome, firefox;
before(function *() {
yield matrix.init();
chrome = matrix.select('chrome');
firefox = matrix.select('firefox');
});
describe('chrome', function() {
it('should do something', function *() {
yield chrome
.url('https://duckduckgo.com/')
.setValue('#search_form_input_homepage', 'WebdriverIO')
.click('#search_button_homepage');
var title = yield chrome.getTitle();
console.log(title); // outputs: "Title is: WebdriverIO (Software) at DuckDuckGo"
});
});
describe('firefox', function() {
it('should do something', function *() {
yield firefox
.url('https://duckduckgo.com/')
.setValue('#search_form_input_homepage', 'WebdriverIO')
.click('#search_button_homepage');
var title = yield firefox.getTitle();
console.log(title); // outputs: "Title is: WebdriverIO (Software) at DuckDuckGo"
});
});
after(function* () {
yield matrix.end();
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment