'Tests break when they are running in parallel
When I run features in parallel (by setting maxInstances to 2 in wdio.conf.js) they fail every other time, but when maxInstances is 1, everything works just fine. It seems that those two tests use sessions of each other somehow when they are run in parallel. Any idea what it can be?
One important thing. Webdriver.io fails to do the assertions (since they are made on different sessions somehow), so the stacktrace is pretty straightforward for a failed assertion.
wdio.conf.js
exports.config = {
specs: [
'./features/*.feature'
],
maxInstances: 2,
services: ['selenium-standalone'],
capabilities: [
{ browserName: 'chrome' }
],
baseUrl: 'http://localhost:4000',
framework: 'cucumber',
reporters: ['spec'],
cucumberOpts: {
require: ['./features/steps.js'],
strict: true
}
};
login.feature
Feature: Login page
Scenario: Click on the search link redirects the user
Given the user is on the login route
When the user clicks on the search link
Then he sees the search route
search.feature
Feature: Search page
Scenario: Click on the login link redirects the user
Given the user is on the search route
When the user clicks on the login link
Then he sees the login route
steps.js
const { Given, When, Then, Before, After } = require('cucumber');
const { assert } = require('chai');
Given(/^the user is on the login route$/, () => browser.url('/login'));
When(/^the user clicks on the search link$/, () => browser.click('.search-link'));
Then(/^he sees the search route$/, () => assert.equal(browser.isExisting('.search-route'), true));
Given(/^the user is on the search route$/, () => browser.url('/search'));
When(/^the user clicks on the login link$/, () => browser.click('.login-link'));
Then(/^he sees the login route$/, () => assert.equal(browser.isExisting('.login-route'), true));
Solution 1:[1]
May I know where exactly this browser-sync used. Even my test cases are getting failed when run in parallel though sequential run is success.
Its weird that i observed the test cases in minimized browser is getting failed while the one in maximize/normal state is passing.
modifying this browser-sync may resolve this issue but am not sure where to find browser-sync code. definitely it is not part of package.json and config files
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Meena Nangina |
