Skip to content

Commit

Permalink
Update addWCBCheckoutPage
Browse files Browse the repository at this point in the history
  • Loading branch information
allie500 committed Feb 6, 2025
1 parent 347fc07 commit 5c42803
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions tests/e2e-pw/utils/merchant.ts
Original file line number Diff line number Diff line change
Expand Up @@ -452,11 +452,12 @@ export const addWCBCheckoutPage = async ( page: Page ) => {
await page.keyboard.press( 'Escape' ); // to dismiss a dialog if present

// Enable the "Company" field if it's not already enabled.
await page
.locator( 'iframe[name="editor-canvas"]' )
.contentFrame()
.getByRole( 'document', { name: 'Block: Shipping Address' } )
.click( { force: true } );
await page.getByLabel( 'Document Overview' ).click();
await page.waitForTimeout( 1000 );
await expect( page.locator( '.editor-list-view-sidebar' ) ).toBeVisible();
await expect( page.getByText( 'List View' ) ).toBeVisible();
await page.locator( '.block-editor-list-view__expander > svg' ).click();
await page.getByText( 'Checkout Fields' ).click();

const companyCheckbox = page
.locator( '.components-toggle-control' )
Expand All @@ -468,8 +469,14 @@ export const addWCBCheckoutPage = async ( page: Page ) => {

// Publish the page
await page.locator( 'button.editor-post-publish-panel__toggle' ).click();
await page.waitForTimeout( 500 );
await page.locator( 'button.editor-post-publish-button' ).click();

const publishButton = page.locator( 'button.editor-post-publish-button' );
await publishButton.click();

if ( await page.getByText( 'Are you ready to publish?' ).isVisible() ) {
await publishButton.nth( 1 ).click();
}

await expect( page.getByText( 'Checkout WCB is now live.' ) ).toBeVisible();
};

Expand Down

0 comments on commit 5c42803

Please sign in to comment.