Skip to content

Commit

Permalink
Fix flaky core profiler e2e test (woocommerce#47917)
Browse files Browse the repository at this point in the history
Co-authored-by: Jon Lane <jon.lane@automattic.com>
  • Loading branch information
lanej0 and Jon Lane authored May 29, 2024
1 parent 02fdd91 commit 938c7d9
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 17 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: dev

Fixing a flaky core profiler e2e test
Original file line number Diff line number Diff line change
Expand Up @@ -228,33 +228,76 @@ test.describe( 'Store owner can complete the core profiler', () => {
name: 'Get paid with WooPayments',
} )
).not.toBeAttached();

// select and install the rest of the extentions
await page.locator( '#inspector-checkbox-control-2' ).uncheck();
await page.locator( '#inspector-checkbox-control-3' ).check();
await page.locator( '#inspector-checkbox-control-4' ).uncheck();
await page.locator( '#inspector-checkbox-control-5' ).check();
try {
await page
.getByText(
'Boost content creation with Jetpack AI AssistantSave time on content creation'
)
.getByRole( 'checkbox' )
.uncheck( { timeout: 2000 } );
} catch ( e ) {
console.log( 'Checkbox not present for Jetpack AI Assistant' );
}
try {
await page
.getByText(
'Showcase your products with PinterestGet your products in front of a highly'
)
.getByRole( 'checkbox' )
.check( { timeout: 2000 } );
} catch ( e ) {
console.log( 'Checkbox not present for Pinterest' );
}
try {
await page
.getByText(
'Reach your customers with MailPoetSend purchase follow-up emails, newsletters,'
)
.getByRole( 'checkbox' )
.uncheck( { timeout: 2000 } );
} catch ( e ) {
console.log( 'Checkbox not present for MailPoet' );
}
try {
await page
.getByText(
'Drive sales with Google Listings & AdsReach millions of active shoppers across'
)
.getByRole( 'checkbox' )
.check( { timeout: 2000 } );
} catch ( e ) {
console.log( 'Checkbox not present for Google Listings & Ads' );
}
await page.getByRole( 'button', { name: 'Continue' } ).click();
} );

await test.step( 'Confirm that core profiler was completed and a couple of default extensions installed', async () => {
page.on( 'dialog', ( dialog ) => dialog.accept() );
// intermediate page shown
await expect(
page.getByRole( 'heading', {
name: "Woo! Let's get your features ready",
} )
).toBeVisible( { timeout: 30000 } );
await expect(
page.getByRole( 'heading', {
name: "Extending your store's capabilities",
} )
).toBeVisible( { timeout: 30000 } );
// the next two are soft assertions because depending on the extensions selected, they may or may not appear
// and we want the test to complete in order for cleanup to happen
await expect
.soft(
page.getByRole( 'heading', {
name: "Woo! Let's get your features ready",
} )
)
.toBeVisible( { timeout: 30000 } );
await expect
.soft(
page.getByRole( 'heading', {
name: "Extending your store's capabilities",
} )
)
.toBeVisible( { timeout: 30000 } );
// dashboard shown
await expect(
page.getByRole( 'heading', {
name: 'Welcome to WooCommerce Core E2E Test Suite',
} )
).toBeVisible();
).toBeVisible( { timeout: 30000 } );
// go to the plugins page to make sure that extensions were installed
await page.goto( 'wp-admin/plugins.php' );
await expect(
Expand All @@ -267,6 +310,8 @@ test.describe( 'Store owner can complete the core profiler', () => {
await expect(
page.getByText( 'Google Listings and Ads', { exact: true } )
).toBeVisible();
await expect( page.getByText( 'MailPoet' ) ).toBeHidden();
await expect( page.getByText( 'Jetpack' ) ).toBeHidden();
} );

await test.step( 'Confirm that information from core profiler saved', async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -927,8 +927,8 @@ test.describe.serial( 'Tax rates in the cart and checkout', () => {
await page.pause();

await expect(
page.getByRole( 'row', {
name: 'Shipping Flat rate: $23.00 (incl. tax) Shipping to CA.',
page.getByRole( 'cell', {
name: 'Flat rate: $23.00 (incl. tax',
} )
).toBeVisible();
await expect(
Expand Down

0 comments on commit 938c7d9

Please sign in to comment.