|
|
|
|
|
|
|
|
|
|
|
|
|
|
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; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 ); |
|
|
|
|
|
|
|
|
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(); |
|
|
} ); |
|
|
|
|
|
|
|
|
|
|
|
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' ); |
|
|
} ); |
|
|
} |
|
|
); |
|
|
|