Download wp-calypso/packages/calypso-e2e/src/lib/pages/site-settings-page.ts from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 1.6 kB
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/packages/calypso-e2e/src/lib/pages/site-settings-page.ts
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/wp-calypso/packages/calypso-e2e/src/lib/pages/site-settings-page.ts
-
curl -L -o site-settings-page.ts https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/packages/calypso-e2e/src/lib/pages/site-settings-page.ts
1.6 kB
| import { Page } from 'playwright'; | |
| import { envVariables } from '../..'; | |
| import { getCalypsoURL } from '../../data-helper'; | |
| /** | |
| * Represents the Sites > Site > Settings page. | |
| */ | |
| export class SiteSettingsPage { | |
| private page: Page; | |
| /** | |
| * Constructs an instance of the component. | |
| * | |
| * @param {Page} page The underlying page. | |
| */ | |
| constructor( page: Page ) { | |
| this.page = page; | |
| } | |
| /** | |
| * Visits the `/sites/settings/$tab` endpoint. | |
| * | |
| * @param {string} siteSlug Site URL. | |
| * @param {string} tab Settings tab. | |
| */ | |
| async visit( siteSlug: string, tab: string = 'site' ): Promise< void > { | |
| // Patch for redirectToHostingDashboardBackportIfEnabled bug that doesn't account for tabs. | |
| await this.page.goto( getCalypsoURL( `sites/settings/v2/${ siteSlug }/${ tab }` ), { | |
| timeout: 20 * 1000, | |
| } ); | |
| } | |
| /** | |
| * Start the site launch process. | |
| */ | |
| async launchSite(): Promise< void > { | |
| const launchSite = this.page.getByRole( 'button', { name: 'Launch site' } ).first(); | |
| await launchSite.click(); | |
| } | |
| /** | |
| * Navigates to a given item in the sidebar. | |
| * | |
| * @param {string} item Item to navigate to. | |
| */ | |
| async navigateToSubmenu( item: string ) { | |
| if ( envVariables.VIEWPORT_NAME === 'mobile' ) { | |
| await this.page.getByRole( 'button', { name: 'General' } ).click(); | |
| } | |
| await this.page.getByRole( 'link', { name: item } ).click(); | |
| } | |
| /** | |
| * Given text, clicks on a button with matching text. | |
| * | |
| * @param {string} text Text to search on the button. | |
| */ | |
| async clickButton( text: string ) { | |
| await this.page.getByRole( 'button', { name: text } ).click(); | |
| } | |
| } | |