Skip to content

Commit

Permalink
Merge pull request #13 from Exabyte-io/chore/SOF-7367
Browse files Browse the repository at this point in the history
SOF-7367: add matchCase to clickOnText
  • Loading branch information
k0stik authored May 14, 2024
2 parents 562f304 + aaba91a commit 896c704
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 16 deletions.
28 changes: 15 additions & 13 deletions src/js/cypress/Browser.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
/* eslint-disable class-methods-use-this */
import "@cypress/xpath";

import * as Cypress from "cypress";

export enum TimeoutType {
zero = "zero",
xxs = "xxs",
Expand Down Expand Up @@ -95,24 +93,24 @@ class BaseBrowser {
}

export class Browser extends BaseBrowser {
waitForVisible(selector: string, timeout: BrowserTimeout) {
return this.getWithTimeout(selector, timeout).should("be.visible");
waitForVisible(selector: string, timeout?: BrowserTimeout) {
this.getWithTimeout(selector, timeout).should("be.visible");
}

waitForDisappear(selector: string, timeout: BrowserTimeout) {
return this.getWithTimeout(selector, timeout).should("not.exist");
waitForDisappear(selector: string, timeout?: BrowserTimeout) {
this.getWithTimeout(selector, timeout).should("not.exist");
}

waitForHide(selector: string, timeout: BrowserTimeout) {
return this.getWithTimeout(selector, timeout).should("be.hidden");
waitForHide(selector: string, timeout?: BrowserTimeout) {
this.getWithTimeout(selector, timeout).should("be.hidden");
}

waitForExist(selector: string, timeout: BrowserTimeout) {
return this.getWithTimeout(selector, timeout).should("exist");
waitForExist(selector: string, timeout?: BrowserTimeout) {
this.getWithTimeout(selector, timeout).should("exist");
}

waitForValue(selector: string, timeout: BrowserTimeout) {
return this.getWithTimeout(selector, timeout).should("exist");
waitForValue(selector: string, timeout?: BrowserTimeout) {
this.getWithTimeout(selector, timeout).should("exist");
}

/**
Expand Down Expand Up @@ -180,7 +178,7 @@ export class Browser extends BaseBrowser {
}

clickOnText(text: string, selector = "body") {
return this.get(selector).contains(text).click();
return this.get(selector).contains(text, { matchCase: false }).click();
}

clickOutside(x = 0, y = 0) {
Expand Down Expand Up @@ -359,6 +357,10 @@ export class Browser extends BaseBrowser {
this.get(selector).should(checked ? "be.checked" : "not.be.checked");
}

assertLengthWithRetry(selector: string, length: number) {
this.get(selector).should("have.length", length);
}

// ======= End assertions ========

// ======= Getters ========
Expand Down
6 changes: 3 additions & 3 deletions src/js/cypress/Widget.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@ export default class Widget {
}

waitForVisible(timeout?: BrowserTimeout) {
return this.browser.waitForVisible(this.selector, timeout);
this.browser.waitForVisible(this.selector, timeout);
}

waitForDisappear(timeout?: BrowserTimeout) {
return this.browser.waitForDisappear(this.selector, timeout);
this.browser.waitForDisappear(this.selector, timeout);
}

waitForLoaderToDisappear() {
return this.browser.waitForDisappear(this.getWrappedSelector("div.spinner"));
this.browser.waitForDisappear(this.getWrappedSelector("div.spinner"));
}

getWrappedSelector(selector: string, separator = " ") {
Expand Down

0 comments on commit 896c704

Please sign in to comment.