Skip to content

Commit

Permalink
fix: remove waitForExist from waitForDisplayed implementation (cloudi…
Browse files Browse the repository at this point in the history
…nary#251)

* fix: remove waitForExist from waitForDisplayed implementation
  • Loading branch information
FelixZilber authored Oct 3, 2021
1 parent bfc341a commit b36deb9
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 9 deletions.
3 changes: 0 additions & 3 deletions src/commons/BrowserUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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}'`
Expand Down
2 changes: 1 addition & 1 deletion src/test/specs/ExpectNumberOfElementsSpec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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", () => {
Expand Down
7 changes: 2 additions & 5 deletions src/test/specs/NotVisibleSpec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 ', () => {
Expand Down

0 comments on commit b36deb9

Please sign in to comment.