gpt4 book ai didi

testing - Testcafe 如何获得在预期之外使用的东西的数量

转载 作者:行者123 更新时间:2023-11-28 20:05:32 25 4
gpt4 key购买 nike

test('Check on the individual devices stuff', async t => {
const devices = monitoredDevicesSection.find('.card');
console.log(devices);
console.log(devices.count);
console.log(await devices.count);
await t.expect(devices.count).eql(10);
});

好的——使用 testcafe我正试图弄清楚如何在预期之外对某事进行计数。

在上面的代码中,测试通过了,因为实际上有 10 个类 .card 在那里。

但是,我什至无法为变量/console.log 分配任何内容并得到“10”

上面的console.log(最后一个)会一直打印0。

我觉得我已经尝试了等待的所有礼仪和顺序,还有什么没有......我就是无法得到const 实际计数 =console.log(actualCount) 打印 10。

想法?我知道我一定快要做到这一点了哈。

最佳答案

如果你添加一个 await 我相信它应该需要一个 snapshot dom 以便您可以 console.log 计数。希望这对你有用

const devices = await monitoredDevicesSection.find('.card');

关于testing - Testcafe 如何获得在预期之外使用的东西的数量,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51953508/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com