添加此项以删除5000毫秒:
protractor.conf.js
cucumberOpts: { require: [ 'tests/e2e/support/env.js', 'main.step.js', ... ], format: 'pretty', // or summary keepAlive: false },
env.js
var configure = function () { this.setDefaultTimeout(60 * 1000); }; module.exports = configure;
例如:
test.feature
Feature: test I want test wait Scenario: Test call wait Given I wait "6" seconds
main.step.js
module.exports = function () { this.World = require(__base +'tests/e2e/support/world.js').World; // I wait "{time}" seconds this.Given(/^I wait "?([^"]*)"? seconds$/, function (time) { return browser.sleep(time * 1000); }); };
world.js
var World, chai, chaiAsPromised; chai = require('chai'); chai_as_promised = require('chai-as-promised'); World = function World (callback) { chai.use(chai_as_promised); this.expect = chai.expect; callback(); }; module.exports.World = World;