File size: 779 Bytes
1e92f2d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
import { Page } from 'playwright';
const selectors = {
actionButton: ( text: string ) => `button:has-text("${ text }")`,
};
/**
*
*/
export class ReactModalComponent< PageObject > {
private page: Page;
readonly pageObject: PageObject;
/**
* Constructs an instance of this component.
*
* @param {Page} page The underlying page.
* @param {any} pageObject Dependency injected page object.
*/
constructor( page: Page, pageObject: PageObject ) {
this.page = page;
this.pageObject = pageObject;
}
/**
* Clicks on the button on the modal.
*
* @param {string} text Text to match on the button.
*/
async clickButton( text: string ): Promise< void > {
const locator = this.page.locator( selectors.actionButton( text ) );
await locator.click();
}
}
|