【发布时间】:2018-09-26 08:12:37
【问题描述】:
我有一个场景,我必须登录网站并执行一些验证,下面是我的功能文件-
Feature:
As a developer
I need to validate
The login functionality and Home Page of common-core workflow
Scenario: Check title and number of apps on Home Page
Given I login into myWebsite
Then I expect that the title of the page is "Welcome to My WebSite"
And Number of apps is 7
Then Number of apps in left drawer has count 8
步骤定义文件如下-
Given(/^I login into myWebsite/, function() {
loginPage.login();
});
Then(/^I expect that the title of the page is "Welcome to My WebSite"/,
function() {
homePage.waitForPageLoad();
homePage.homePageTitle.should.be.equal("Welcome to My WebSite");
});
Then(/^Number of apps is (\d+)/, function(count) {
expect(homePage.allApps.length).to.be.equal(7);
});
Then(/^Number of apps in left drawer has count (\d+)/, function(count) {
expect(homePage.navDrawerLeftArray.length).to.be.equal(count);
});
我已经使用页面对象模型来获取 Web 元素和 Chai.js 进行评估。
当我执行上述步骤时,我得到了错误-
[chrome #0-0] Check title and number of apps on Home Page
[chrome #0-0] 1) I login into myWebsite product
[chrome #0-0] !! I expect that the title of the page is "Welcome to My
WebSite"
[chrome #0-0] !! Number of apps is 7
[chrome #0-0] !! Number of apps in left drawer has count 8
[chrome #0-0]
[chrome #0-0]
[chrome #0-0] 3 pending (59s)
[chrome #0-0] 1 failing
[chrome #0-0]
[chrome #0-0] 1) Check title and number of apps on Home Page6 I login into
myWebsite:
[chrome #0-0] function timed out, ensure the promise resolves within 30000
milliseconds
[chrome #0-0] Error: function timed out, ensure the promise resolves within
30000 milliseconds
[chrome #0-0] at Timeout._onTimeout
(Project_Path\user_code_runner.js:93:22)
[chrome #0-0] at ontimeout (timers.js:498:11)
[chrome #0-0] at tryOnTimeout (timers.js:323:5)
[chrome #0-0] at Timer.listOnTimeout (timers.js:290:5)
【问题讨论】:
标签: node.js webdriver-io cucumberjs