Reputation: 1
I'm new to Test Cafe Studio and I'm trying to figure out how to verify text is not present on a web page. I would like the test to fail if the text is present. Any help would be appreciated.
Upvotes: 0
Views: 276
Reputation: 8322
Typically, you want to assert a text of some element:
const elText = await Selector('#my-element').textContent;
await t
.expect(elText).notContains('some text');
If you want to check the whole page, you might do this:
const elText = await Selector('html').textContent;
await t
.expect(elText).notContains('some text');
But I think it's better to avoid it and rather structure your tests in a way that:
Upvotes: 3