Reputation: 1
I am using Codeceptjs for automation testing in javascript which internally uses WebDriverIO. I have achieved to run on Sauce, using the mentioned framework.
I have accomplished to run automation test cases in different browsers in sauce lab by using desired capabilities but only one browser at a time.
Requesting help
It would be great to have both of the above mentioned combinations.
What configuration should I provide to achieve the above two requirement on the WebDriverIO / CodeceptJS.
Here is my configuration that will be passed to sauce labs.
---codecept.conf.js---
WebDriverIO: {
url: "http://localhost:3000",
browser: chrome,
waitforTimeout: 60000,
restart: false,
logLevel: "silent",
cssSelectorsEnabled: "true",
timeouts: {
script: 60000,
"page load": 60000,
implicit : 0
},
"host": "ondemand.saucelabs.com",
"port":80,
"user":"<SAUCE_USER_NAME>",
"key": "<SAUCE_ACCESS_KEY>”,
desiredCapabilities :{
"chrome": {
"browserName": "chrome",
"name": "TEST_CHROME",
"platform": "ANY",
"version": "55.0"
}
}
}
These are the list of desired Capabilities which i am using and picking one capability based on the selected browser name:
{
"internet explorer": {
"browserName": "internet explorer",
"name": "TEST_IE",
"platform": "Windows 7",
"ignoreZoomSetting": true,
"nativeEvents": false,
"ignoreProtectedModeSettings": true,
"version": "11"
},
"chrome": {
"browserName": "chrome",
"name": "TEST_CHROME",
"platform": "ANY",
"version": "55.0"
},
"firefox": {
"browserName": "firefox",
"name": "TEST_FIREFOX",
"platform": "ANY",
"version": "51.0"
},
"safari": {
"browserName": "safari",
"name": "TEST_SAFARI",
"platform": "OS X 10.11",
"version": "10.0"
},
"opera": {
"browserName": "opera",
"name": "TEST_OPERA",
"platform": "Windows 7",
"version": "ANY"
},
"MicrosoftEdge": {
"browserName": "MicrosoftEdge",
"name": "TEST_IEEdge",
"platform": "Windows 10",
"version": "13"
}
}
Upvotes: 0
Views: 2547
Reputation: 4384
Below is the codecept config for single and multiple run
To execute in single browser run codeceptjs run
as per below config test will run on FF only.
To execute multiple browser test run codeceptjs run-multiple --all
it will execute your test on safari and chrome both as below config is for safari and chrome.
tests: '**/.funcspec.js',
output: './output',
helpers: {
WebDriver: {
url: '<YOUR URL>',
browser: "firefox",
show:true,
desiredCapabilities: {
'record_video': 'true',
name: 'Single browser run',
},
"user": "USERNAME",
"key": "KEY"
}
},
multiple: {
smoke:{
browsers: [
{
browser: 'Safari',
desiredCapabilities: {
version: "latest-1",
platform: 'OS X 10.11',
name: 'Safari Parallel run',
}
},
{
browser: "Chrome",
desiredCapabilities: {
version: "latest-1",
platform: 'Windows 10',
name: 'Chrome Parallel run',
}
},
],
},
},
include: {
I: './steps_file.js'
},
bootstrap: null,
mocha: {},
name: 'somename',
plugins: {
pauseOnFail: {},
retryFailedStep: {
enabled: true
},
tryTo: {
enabled: true
},
screenshotOnFail: {
enabled: true
}
}
}
Upvotes: 0
Reputation: 185
Manual: parallel execution
Add to your codecept.conf.js:
"multiple": {
"internet explorer": {
"browsers": ["internet explorer"]
},
"chrome": {
"browsers": ["chrome"]
},
"firefox": {
"browsers": ["firefox"]
},
"safari": {
"browsers": ["safari"]
},
"opera": {
"browsers": ["opera"]
},
"MicrosoftEdge": {
"browsers": ["MicrosoftEdge"]
},
"parallel": {
// Splits tests into chunks
// for example: 2 chunks x 6 browsers = 12 threads
"chunks": 2,
// run all tests in each browser:
"browsers": ["internet explorer", "chrome", "firefox", "safari", "opera", "MicrosoftEdge"]
}
}
multiple calling for selective browsers:
codeceptjs run-multiple chrome opera "internet explorer" firefox // create threads (four in all) for each browser: chrome, opera, internet explorer and firefox.
multiple calling for each browser in few chunks:
codeceptjs run-multiple parallel
Upvotes: 1
Reputation: 357
I've never used CodeceptJS. However, as it uses Wdio, it could be possible to use maxInstances property to configure number of browers run in parallel.
Take a look at the Wdio documentation: http://webdriver.io/guide/testrunner/configurationfile.html
Upvotes: 1