react-code-dataset / wp-calypso /packages /calypso-e2e /src /lib /components /react-modal-component.ts
react-code-dataset / wp-calypso /packages /calypso-e2e /src /lib /components /react-modal-component.ts
Download wp-calypso/packages/calypso-e2e/src/lib/components/react-modal-component.ts from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 779 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/packages/calypso-e2e/src/lib/components/react-modal-component.ts
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/wp-calypso/packages/calypso-e2e/src/lib/components/react-modal-component.ts
-
curl -L -o react-modal-component.ts https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/packages/calypso-e2e/src/lib/components/react-modal-component.ts
779 Bytes
| 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(); | |
| } | |
| } | |