Skip to content

Instantly share code, notes, and snippets.

@fand fand/initManually.js

Created Jul 11, 2015
Embed
What would you like to do?
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
You can’t perform that action at this time.