-
-
Notifications
You must be signed in to change notification settings - Fork 61
[Bug] .not.toBePresent and .not.toBeDisplayed fails #2013
Copy link
Copy link
Closed
Description
Have you read the Contributing Guidelines on issues?
- I have read the Contributing Guidelines on issues.
WebdriverIO Version
9.23.2
Node.js Version
v24.13.0
Mode
Standalone Mode
Which capabilities are you using?
No response
What happened?
Upgrading expect-webdriverio from from 5.6.1 to 5.6.4 makes .not.toBePresent() and .not.toBeDisplayed() fail in some cases:
What is your expected behavior?
No response
How to reproduce the bug.
describe("toBePresent", () => {
it("should open and close modal", async () => {
await browser.url("https://ng-bootstrap.github.io/#/components/modal/examples");
await $("button=Launch demo modal").click();
const modal = $("ngb-modal-window");
await expect(modal).toBeDisplayed();
await browser.keys(Key.Escape);
await expect(modal).not.toBePresent(); // This fails
});
});Workaround: using waitFor functions is working fine :
describe("toBePresent", () => {
it("should open and close modal", async () => {
await browser.url("https://ng-bootstrap.github.io/#/components/modal/examples");
await $("button=Launch demo modal").click();
const modal = $("ngb-modal-window");
await expect(modal).toBeDisplayed();
await browser.keys(Key.Escape);
await modal.waitForDisplayed({reverse: true}); // This works
});
});Relevant log output
1) toBePresent should open and close modal
Expect $(`ngb-modal-window`) not to be present
Expected [not]: "not present"
Received : "present"
Code of Conduct
- I agree to follow this project's Code of Conduct
Is there an existing issue for this?
- I have searched the existing issues
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels