小编Ale*_*Mos的帖子

我无法通过 TestCafe 获得预期的 URL

我想在用户登录主页后断言我在“主页”上。我创建了一个函数“onPage”来返回 URL 的内容。

这是代码:

function onPage (secondPage, URL) {
  if (secondPage === 'Home Page') {
    return await                
            testController.expect(URL.textContent).contains('URL-of-the-Home-Page');
  }
}


Then(THEN.THE_HOME_PAGE_IS_OPENED, async (secondPage) => {
  await testController.expect(onPage(secondPage, URL)).eql(true);
}
Run Code Online (Sandbox Code Playgroud)

这是我的 BDD 场景:

  Scenario Outline: User is logged in the 
    Given the <namePage> is opened
      And the user populate <username>
      And the user populate <password>
     When the user clicks on Login button
     Then he is on <secondPage>

    Examples: 
      | namePage     | username | password | secondPage  | 
      | "Login Page" | …
Run Code Online (Sandbox Code Playgroud)

javascript automation automated-tests e2e-testing testcafe

5
推荐指数
1
解决办法
1172
查看次数