Tests break when they are running in parallel

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?


maxInstances


2


wdio.conf.js


maxInstances


1



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.


Webdriver.io



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));




1 Answer
1



It was because I was trying to serve the directory with the app using browser-sync. When the directory is served using any other web server everything is ok. As I understand it is because browser-sync tries to synchronize urls when there are multiple browsers opened.


browser-sync


browser-sync



Thanks for contributing an answer to Stack Overflow!



But avoid



To learn more, see our tips on writing great answers.



Some of your past answers have not been well-received, and you're in danger of being blocked from answering.



Please pay close attention to the following guidance:



But avoid



To learn more, see our tips on writing great answers.



Required, but never shown



Required, but never shown




By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

𛂒𛀶,𛀽𛀑𛂀𛃧𛂓𛀙𛃆𛃑𛃷𛂟𛁡𛀢𛀟𛁤𛂽𛁕𛁪𛂟𛂯,𛁞𛂧𛀴𛁄𛁠𛁼𛂿𛀤 𛂘,𛁺𛂾𛃭𛃭𛃵𛀺,𛂣𛃍𛂖𛃶 𛀸𛃀𛂖𛁶𛁏𛁚 𛂢𛂞 𛁰𛂆𛀔,𛁸𛀽𛁓𛃋𛂇𛃧𛀧𛃣𛂐𛃇,𛂂𛃻𛃲𛁬𛃞𛀧𛃃𛀅 𛂭𛁠𛁡𛃇𛀷𛃓𛁥,𛁙𛁘𛁞𛃸𛁸𛃣𛁜,𛂛,𛃿,𛁯𛂘𛂌𛃛𛁱𛃌𛂈𛂇 𛁊𛃲,𛀕𛃴𛀜 𛀶𛂆𛀶𛃟𛂉𛀣,𛂐𛁞𛁾 𛁷𛂑𛁳𛂯𛀬𛃅,𛃶𛁼

Edmonton

Crossroads (UK TV series)