【问题标题】:Open Modal and Page with cypress and Ionic 3使用 cypress 和 Ionic 3 打开 Modal 和 Page
【发布时间】:2018-03-01 10:25:57
【问题描述】:

我构建了一个 Ionic 3 项目,我想用 Cypress 对其进行测试。我可以访问我的应用程序并运行一些简单的测试。但是当我尝试打开模式页面时,没有任何附加内容,我的测试失败。

it('should open history', () => {
        // Button to open my page : OK
        cy.get(open_history_button).click();

        // Check if a label exists in the opened page : FAIL
        cy.get(history_no_event_label).contains("All is ok !");
    });

Cypress 成功点击按钮,但页面没有出现。

有人有办法解决这个问题吗?

【问题讨论】:

  • 您可以尝试在点击cy.wait(500)后添加一个小等待。

标签: angular testing ionic3 e2e-testing cypress


【解决方案1】:

没关系!我理解我的错误。 我在点击事件上使用(点击)我的代码。但它不适用于柏树。 所以我用(点击)替换了我所有的(点击),效果更好。

<button ion-button (tap)="doSomething()">My Button</button> => WRONG
<button ion-button (click)="doSomething()">My Button</button> => GOOD

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2021-06-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-12-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多