javascript - 使用 testcafe 在 Javascript 中断言数组列表

标签 javascript testing automated-tests e2e-testing testcafe

我刚刚开始使用一种叫做 testcafe 的东西。我希望断言我已收到带有选择器“#audit > h4”的列表。它需要 >= 1。我不确定用于 >= 1 的语法,或者它应该放在 JS 的新地方。

到目前为止,这是我的代码,第二个测试需要建议:

fixture `UI Tests`
    .page `http://localhost:8080/`;

test('Clicking the search button', async t => {
    await t
        .click ('#search-result > div > div > button');
});

test('Asserting a list of audits', async t => {
    await t
        .expect('#audit > h4')
});

最佳答案

终于找到答案了

.expect(Selector(page.auditListId).count).gte(2);

关于javascript - 使用 testcafe 在 Javascript 中断言数组列表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43982395/

相关文章:

javascript - 如何解析包含javascript代码的html

javascript - 如何从 OOBCODE 获取 firebase token 和 uid?

testing - 如何使用浏览器同时测试 WebApps 的多个角色

javascript - 如何在 Express.js 中共享 Controller 之间的通用逻辑?

testing - LLVM 测试基础设施失败

Spring - 如何测试具有 ApplicationEventPublisher 依赖关系的 Controller ?

security - Apache Jmeter 提取 __RequestVerificationToken 并使用它登录

angularjs - Protractor 能否点击 Flash 的 "Adobe Flash Player Settings"提示?

node.js - 如何解决 @0.21.0 上 tetscafe 上的问题(testcafe-live 不起作用)

javascript - Socialfeed.js 没有显示任何内容,但也没有错误