Когда я запускаю функции параллельно (устанавливая maxInstances
в 2
в wdio.conf.js
), они выходят из строя каждый раз, но когда maxInstances
равен 1
, все работает просто отлично. Кажется, что эти два теста как-то используют сеансы друг друга, когда они выполняются параллельно. Есть идеи, что это может быть?
Одна важная вещь. 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));