UNPKG

@agnos-ui/base-po

Version:

Base class to build page objects for end-to-end tests with Playwright.

2 lines (1 loc) 525 B
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function i(r){return"waitFor"in r}class l{#t;#o;#e;_page;constructor(t,e=null){this.#t=t,this.#o=e,this._page=i(t)?t.page():t}get locatorRoot(){let t=this.#e;if(!t){const e=this.getComponentSelector();let o=this.#t;if(e){o=o.locator(e);const a=this.#o;a!==null&&(o=o.nth(a))}t=i(o)?o:o.locator("html"),this.#e=t}return t}getComponentSelector(){return""}async waitLoaded(){i(this.locatorRoot)&&await this.locatorRoot.waitFor()}}exports.BasePO=l;