It seems that,
t.expect(Selector("[data-testid='foo']")).ok();
and,
t.expect(Selector("[data-testid='foo']").exists).ok();
result in the same outcome so is .exists
necessary?
Selector("[data-testid='foo']")
returns a Promise.
The t.expect(Selector("[data-testid='foo']")).ok();
assertion will always pass regardless of whether there is an element on the page or not. It happens because a Promise instance will be cast to true
.
t.expect(Selector("[data-testid='foo']").exists).ok();
is the correct assertion. It checks an element on the page using the Smart assertion query mechanism