Download wp-calypso/test/e2e/specs/appearance/widgets__legacy-visibility.ts from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 2.22 kB
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/test/e2e/specs/appearance/widgets__legacy-visibility.ts
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/wp-calypso/test/e2e/specs/appearance/widgets__legacy-visibility.ts
-
curl -L -o widgets__legacy-visibility.ts https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/test/e2e/specs/appearance/widgets__legacy-visibility.ts
2.22 kB
| /** | |
| * @group gutenberg | |
| */ | |
| import { | |
| envVariables, | |
| TestAccount, | |
| BlockWidgetEditorComponent, | |
| getTestAccountByFeature, | |
| envToFeatureKey, | |
| RestAPIClient, | |
| } from '@automattic/calypso-e2e'; | |
| import { Browser, Page } from 'playwright'; | |
| import { skipDescribeIf } from '../../jest-helpers'; | |
| const accountName = getTestAccountByFeature( envToFeatureKey( envVariables ) ); | |
| declare const browser: Browser; | |
| // We're skipping for Atomic sites for now because the currently used theme | |
| // doesn't support widgets. | |
| // Mobile viewport is skipped due to https://github.com/Automattic/wp-calypso/issues/64536. | |
| skipDescribeIf( envVariables.TEST_ON_ATOMIC || envVariables.VIEWPORT_NAME === 'mobile' )( | |
| 'Widget (Legacy): Visibility option is present', | |
| function () { | |
| let testAccount: TestAccount; | |
| let page: Page; | |
| beforeAll( async () => { | |
| page = await browser.newPage(); | |
| testAccount = new TestAccount( accountName ); | |
| await testAccount.authenticate( page ); | |
| // Clear out existing widgets. | |
| const restAPIClient = new RestAPIClient( testAccount.credentials ); | |
| await restAPIClient.deleteAllWidgets( | |
| testAccount.credentials.testSites?.primary.id as number | |
| ); | |
| } ); | |
| it( 'Navigate to Appearance > Widgets', async function () { | |
| await page.goto( | |
| `https://${ testAccount.credentials.testSites?.primary.url }/wp-admin/widgets.php`, | |
| { timeout: 25 * 1000 } | |
| ); | |
| } ); | |
| it( 'Dismiss the Welcome modals', async function () { | |
| const blockWidgetEditorComponent = new BlockWidgetEditorComponent( page ); | |
| await blockWidgetEditorComponent.dismissModals(); | |
| } ); | |
| // @todo: Refactor/Abstract these steps into a WidgetsEditor component | |
| // Skipped for mobile due to https://github.com/Automattic/wp-calypso/issues/59960 | |
| it( 'Insert a Legacy Widget', async function () { | |
| await page.getByRole( 'button', { name: 'Add block' } ).click(); | |
| await page.fill( 'input[placeholder="Search"]', 'Authors' ); | |
| await page.click( 'button.editor-block-list-item-legacy-widget\\/authors' ); | |
| } ); | |
| it( 'Visibility options are shown for the Legacy Widget', async function () { | |
| await page.click( 'a.button:text("Visibility")' ); | |
| await page.waitForSelector( 'div.widget-conditional' ); | |
| } ); | |
| } | |
| ); | |