UNPKG

systelab-components-wdio-test

Version:
68 lines (67 loc) 2.19 kB
import { Browser, DefaultTimeout } from "../wdio/index.js"; export class BasePage { constructor(tagName) { this.tagName = tagName; this.current = Browser.byTagName(tagName); } getElementFinder() { return this.current; } async isPresent() { return this.current.isPresent(); } async isDisplayed() { return this.current.isDisplayed(); } byId(id) { return this.current.byId(id); } byTagName(tagName) { return this.current.byTagName(tagName); } byClassName(className) { return this.current.byClassName(className); } byCSS(cssExpression) { return this.current.byCSS(cssExpression); } byButtonText(text) { return this.current.byButtonText(text); } byElementText(tagName, text) { return this.current.byElementText(tagName, text); } bySystelabTestId(systelabTestId) { return this.current.bySystelabTestId(systelabTestId); } allByTagName(tagName) { return this.current.allByTagName(tagName); } allByClassName(className) { return this.current.allByClassName(className); } allByCSS(cssExpression) { return this.current.allByCSS(cssExpression); } allBySystelabTestId(systelabTestId) { return this.current.allBySystelabTestId(systelabTestId); } async waitToBePresent(timeout = DefaultTimeout.SLOW_WAIT) { return this.current.waitUntil(async () => await this.isPresent(), timeout); } async waitToBeNotPresent(timeout = DefaultTimeout.SLOW_WAIT) { return this.current.waitUntil(async () => !(await this.isPresent()), timeout); } async waitToBeDisplayed(timeout = DefaultTimeout.SLOW_WAIT) { return this.current.waitUntil(async () => await this.isDisplayed(), timeout); } async waitToBeNotDisplayed(timeout = DefaultTimeout.SLOW_WAIT) { return this.current.waitUntil(async () => !(await this.isDisplayed()), timeout); } async takeScreenshot() { return this.current.takeScreenshot(); } async saveScreenshot(filepath) { return this.current.saveScreenshot(filepath); } }