Cucumber 测试在并行运行时中断

Cucumber 测试在并行运行时中断,cucumber,webdriver-io,Cucumber,Webdriver Io,当我并行运行特性时(通过在wdio.conf.js中将maxInstances设置为2),它们每隔一段时间就会失败,但当maxInstances为1时,一切正常。这两个测试在并行运行时似乎以某种方式使用了彼此的会话。知道会是什么吗 一件重要的事Webdriver.io无法执行断言(因为它们是在不同的会话上进行的),因此对于失败的断言,stacktrace非常简单 wdio.conf.js exports.config = { specs: [ './features/*.featur

当我并行运行特性时(通过在
wdio.conf.js
中将
maxInstances
设置为
2
),它们每隔一段时间就会失败,但当
maxInstances
1
时,一切正常。这两个测试在并行运行时似乎以某种方式使用了彼此的会话。知道会是什么吗

一件重要的事
Webdriver.io
无法执行断言(因为它们是在不同的会话上进行的),因此对于失败的断言,stacktrace非常简单

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
  }
};
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));
登录功能

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
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
搜索功能

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

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

这是因为我试图使用
browser sync
为应用程序提供目录服务。当使用任何其他web服务器提供目录时,一切都正常。据我所知,这是因为当打开多个浏览器时,
browser sync
尝试同步URL