Fix flaky connect to Woo e2e test (#48613)

This commit is contained in:
Veljko V 2024-06-19 14:16:58 +02:00 committed by GitHub
parent 0608eb7542
commit 3ea4df2055
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 17 additions and 4 deletions

View File

@ -0,0 +1,4 @@
Significance: patch
Type: dev
E2E tests: fixing flaky connect to woo test

View File

@ -423,21 +423,28 @@ test.describe( 'Store owner can skip the core profiler', () => {
test( 'Can connect to WooCommerce.com', async ( { page } ) => { test( 'Can connect to WooCommerce.com', async ( { page } ) => {
await test.step( 'Go to WC Home and make sure the connect button is visible', async () => { await test.step( 'Go to WC Home and make sure the connect button is visible', async () => {
await page.goto( 'wp-admin/admin.php?page=wc-admin' ); await page.goto( 'wp-admin/admin.php?page=wc-admin' );
await expect( await expect(
page.getByRole( 'heading', { page.getByRole( 'heading', {
name: 'Connect to WooCommerce.com', name: 'Connect to WooCommerce.com',
} ) } )
).toBeVisible(); ).toBeVisible();
await page await page
.getByRole( 'link', { name: 'Connect', exact: true } ) .getByRole( 'menuitem', { name: 'Total sales' } )
.click(); .waitFor( { state: 'visible' } );
} ); } );
await test.step( 'Ensure we are redirected to the correct URL and connect store', async () => { await test.step( 'Click Connect and ensure we are redirected to the correct URL and connect store', async () => {
await page
.getByRole( 'link', { name: 'Connect', exact: true } )
.click();
await expect( page.url() ).toContain( await expect( page.url() ).toContain(
'?page=wc-admin&tab=my-subscriptions&path=%2Fextensions' '?page=wc-admin&tab=my-subscriptions&path=%2Fextensions'
); );
await expect(
page.getByText(
'Hundreds of vetted products and services. Unlimited potential.'
)
).toBeVisible();
await expect( await expect(
page.getByRole( 'button', { name: 'My Subscriptions' } ) page.getByRole( 'button', { name: 'My Subscriptions' } )
).toBeVisible(); ).toBeVisible();
@ -451,6 +458,8 @@ test.describe( 'Store owner can skip the core profiler', () => {
await test.step( 'Check that we are sent to wp.com', async () => { await test.step( 'Check that we are sent to wp.com', async () => {
await expect( page.url() ).toContain( 'wordpress.com/log-in' ); await expect( page.url() ).toContain( 'wordpress.com/log-in' );
// reload to avoid flaky blank page
await page.reload();
await expect( await expect(
page.getByRole( 'heading', { page.getByRole( 'heading', {
name: 'Log in to your account', name: 'Log in to your account',