Я работаю над приложением Angular 6 / Protractor / Cucumber, когда я запускаю E2E, тестирование запускается только тогда, когда я наводю указатель мыши на окно браузера (для каждого сценария Cucumber).my protractor.conf.js
exports.config = {
allScriptsTimeout: 100000,
capabilities: {
'browserName': 'chrome'
},
multiCapabilities: [
{
browserName: 'chrome',
specs: 'e2e/features/*.feature'
}
],
directConnect: true,
baseUrl: 'http://localhost:4201/',
// Use a custom framework adapter and set its relative path
framework: 'custom',
frameworkPath: require.resolve('protractor-cucumber-framework'),
// cucumber command line options
cucumberOpts: {
// require step definition files before executing features
require: ["supports/timeout.js", './e2e/steps/**/*.ts', './cucumber/*.js'],
// <string[]> (expression) only execute the features or scenarios with tags matching the expression
tags: [],
// <boolean> fail if there are any undefined or pending steps
strict: true,
// <string[]> (type[:path]) specify the output format, optionally supply PATH to redirect formatter output (repeatable)
format: [
'json:e2e/reports/summary.json'
],
// <boolean> invoke formatters without executing steps
dryRun: false,
// <string[]> ("extension:module") require files with the given EXTENSION after requiring MODULE (repeatable)
compiler: []
},
// Enable TypeScript for the tests
onPrepare() {
require('ts-node').register({
project: './e2e/tsconfig.e2e.json'
});
},
};
И пример шага:
import {Before, Given} from 'cucumber';
import {browser} from 'protractor';
import {StepsUtils} from '../utils';
const {setDefaultTimeout} = require('cucumber');
Before(() => {
setDefaultTimeout(60 * 15000);
});
Given('J\'ouvre Google Chrome en mode plein écran', function () {
StepsUtils.navigateToRoot();
browser.manage()
.window()
.maximize()
.catch(ignoreVoid => {
return;
});
return browser.getTitle();
});
Браузер развернут, но следующие шаги не будут выполнены, пока я не наведу курсор мышибраузерЕсли я не наведу курсор мыши на консоль, появится следующая ошибка:
E/launcher - script timeout: result was not received in 100 seconds
(Session info: chrome=69.0.3497.100)