Reputation: 856
After uploading an image with TestCafe the server will do some processing. While this time a label on the website will have "Inprogress" as a label. After the server is ready it will change to date. However, I want to tell the Testcafe script to wait until the label is not "Inporgress" anymore. For this I did:
const DeliveryStatus = {
element: Selector('div.cl-asset-published').with({timeout: 70000}),
delivered: 'Inprogress'
};
And in the script I have
await t
.expect(DeliveryStatus.element).notContains(DeliveryStatus.delivered, { timeout: 70000 })
But this step fails. The message I got is "AssertionError: object tested must be an array, a map, an object, a set, a string, or a weakset, but function given" but I do not have any idea why.
Any suggestion to fix this issue?
Upvotes: 4
Views: 1928
Reputation: 921
You pass an element selector that returns the element but not a string to the expect
function. Try using the element's innerText
property instead as follows:
await t
.expect(DeliveryStatus.element.innerText)
.notContains(DeliveryStatus.delivered, { timeout: 70000 })
Upvotes: 3