0

我是 Serenity 的第一步,我已经被这个问题困住了 2 天。

我有:

  • 导航到登录页面
  • 写用户名
  • 写密码
  • 点击登录按钮

然后,在网络从登录页面更改为欢迎页面的步骤中,我想验证是否存在欢迎页面的按钮之一。

在从登录页面到欢迎页面的过渡中,会出现一个加载启动画面,然后在几秒钟后出现欢迎页面。

This is my scenario
Given that Sarah navigates to the access page
When she enters email as xxxx@yyyyy.com
And she enters password as zzzzzz
And she clicks the button Login
Then she should navigates to the Empresa JMM Enterprise welcome page

我在最后一步(然后)中遇到了错误。

这是我单击登录按钮的步骤的代码:

this.When(/^prueba pulsar boton (.*?)$/, function (buttonText: string) {
    return this.stage.theActorInTheSpotlight().attemptsTo(
        ClickIniciarSesion.click(buttonText)
    )       
});

这是我验证按钮是否存在的代码

this.Then(/^s?he should navigates to (.*?) Enterprise welcome page$/, function (enterpriseName: string) {
return this.stage.theActorInTheSpotlight().attemptsTo(
See.if(WebElement.of(Header.WelcomeButton), el => expect(el).to.eventually.be.displayed)
)

我看到超时前的执行和秒我看到加载的欢迎页面和按钮。我不知道为什么错误是超时而不是驱动程序找不到元素。

4

1 回答 1

0

我认为我有解决方案。在从登录页面到欢迎页面的过渡中,会出现一页加载。我认为在这个加载页面中,宁静正在“寻找”。

测试通过了 OK 禁用 Angular 同步,手动等待并启用同步。

this.Then(/^s?he waits the enterpise data load$/, function () {       
    return this.stage.theActorInTheSpotlight().attemptsTo(
        UseAngular.disableSynchronisation()
    );
});    

this.Then(/^s?he should navigates to the (.*?) Enterprise welcome page$/, function (enterpriseName: string) {       
    return this.stage.theActorInTheSpotlight().attemptsTo(
        Wait.until(Header.EnterpriseName, Is.visible()),
        See.if(Header.EnterpriseName_Text, el => expect(el).to.eventually.be.equal(enterpriseName)),
        UseAngular.enableSynchronisation()
    )        
});   

我不知道是否是更好的解决方案。

于 2018-11-08T14:15:07.273 回答