Download wp-calypso/packages/calypso-e2e/src/lib/pages/p2-page.ts from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 877 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/packages/calypso-e2e/src/lib/pages/p2-page.ts
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/wp-calypso/packages/calypso-e2e/src/lib/pages/p2-page.ts
-
curl -L -o p2-page.ts https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/packages/calypso-e2e/src/lib/pages/p2-page.ts
877 Bytes
| import { Page } from 'playwright'; | |
| const selectors = { | |
| newPostButton: 'button:has-text("New Post")', | |
| publishedPost: ( postContent: string ) => `.entry-content:has-text("${ postContent }")`, | |
| }; | |
| /** | |
| * Class representing the P2 frontend. | |
| */ | |
| export class P2Page { | |
| private page: Page; | |
| /** | |
| * Constructs an instance of the component. | |
| * | |
| * @param {Page} page The underlying page. | |
| */ | |
| constructor( page: Page ) { | |
| this.page = page; | |
| } | |
| /** | |
| * Click 'New post' to show the editor. | |
| */ | |
| async clickNewPost(): Promise< void > { | |
| await this.page.click( selectors.newPostButton ); | |
| } | |
| /** | |
| * Ensures the post with the content `postContent` has been published. | |
| * | |
| * @param {string} postContent Post content to validate. | |
| */ | |
| async validatePostContent( postContent: string ): Promise< void > { | |
| await this.page.click( selectors.publishedPost( postContent ) ); | |
| } | |
| } | |