Testing Testcafe等待元素具有特定文本

Testing Testcafe等待元素具有特定文本,testing,automated-tests,e2e-testing,web-testing,testcafe,Testing,Automated Tests,E2e Testing,Web Testing,Testcafe,使用TestCafe上传图像后,服务器将进行一些处理。而这次网站上的标签将以“Inprogress”作为标签。服务器准备就绪后,它将更改为最新版本。但是,我想告诉Testcafe脚本等待标签不再是“InForgress”。 为此,我做了: const DeliveryStatus = { element: Selector('div.cl-asset-published').with({timeout: 70000}), delivered: 'Inpro

使用TestCafe上传图像后,服务器将进行一些处理。而这次网站上的标签将以“Inprogress”作为标签。服务器准备就绪后,它将更改为最新版本。但是,我想告诉Testcafe脚本等待标签不再是“InForgress”。 为此,我做了:

    const DeliveryStatus = {
        element: Selector('div.cl-asset-published').with({timeout: 70000}),
        delivered: 'Inprogress'
    };
在我的剧本里

await t
     .expect(DeliveryStatus.element).notContains(DeliveryStatus.delivered, { timeout: 70000 })
但这一步失败了。我得到的信息是“AssertionError:被测试的对象必须是数组、映射、对象、集合、字符串或弱集,但函数给定”,但我不知道为什么


有没有解决此问题的建议?

您将一个元素选择器传递给
expect
函数,该选择器返回元素而不是字符串。尝试使用元素的
innerText
属性,如下所示:

await t
 .expect(DeliveryStatus.element.innerText)
 .notContains(DeliveryStatus.delivered, { timeout: 70000 })