diff --git a/src/commons/BrowserUtils.ts b/src/commons/BrowserUtils.ts index 829d3032f..5988877b8 100644 --- a/src/commons/BrowserUtils.ts +++ b/src/commons/BrowserUtils.ts @@ -299,9 +299,6 @@ export namespace BrowserUtils { */ export function waitForDisplayed(selector: string, options?: WaitForOptions): void { Reporter.debug(`Wait for an element to be visible '${selector}'`); - if (options?.reverse) { - waitForExist(selector, options); - } tryBlock( () => $(selector).waitForDisplayed({ ...{ timeout: DEFAULT_TIME_OUT }, ...options }), `Element not visible '${selector}'` diff --git a/src/test/specs/ExpectNumberOfElementsSpec.ts b/src/test/specs/ExpectNumberOfElementsSpec.ts index 9c2c6e005..752b81373 100644 --- a/src/test/specs/ExpectNumberOfElementsSpec.ts +++ b/src/test/specs/ExpectNumberOfElementsSpec.ts @@ -24,7 +24,7 @@ describeCommon('waitForNumberOfElements', () => { expect(() => BrowserUtils.waitForNumberOfElements(`${SELECTION_BOX}${LIST_ITEM}`, 0)) .to.throw(Error) .with.property('message') - .contains(`still existing`); + .contains(`still displayed `); }); it("Expect number of elements, element doesn't exists", () => { diff --git a/src/test/specs/NotVisibleSpec.ts b/src/test/specs/NotVisibleSpec.ts index ef279cb12..8d402a619 100644 --- a/src/test/specs/NotVisibleSpec.ts +++ b/src/test/specs/NotVisibleSpec.ts @@ -14,14 +14,11 @@ describeCommon('waitForDisplayed - reverse: true', () => { expect(() => BrowserUtils.waitForDisplayed(VISIBLE_ELEMENT_SELECTOR, { reverse: true })) .to.throw(Error) .with.property('message') - .contains(' still existing'); + .contains(' still displayed '); }); it('notDisplayed but exist element ', () => { - expect(() => BrowserUtils.waitForDisplayed(NOT_VISIBLE_ELEMENT_SELECTOR, { reverse: true })) - .to.throw(Error) - .with.property('message') - .contains('still existing'); + expect(() => BrowserUtils.waitForDisplayed(NOT_VISIBLE_ELEMENT_SELECTOR, { reverse: true })).to.not.throw(Error); }); it('not exist element ', () => {