Skip to content

Commit

Permalink
Fix flaky connect to Woo e2e test (woocommerce#48613)
Browse files Browse the repository at this point in the history
  • Loading branch information
veljkho authored Jun 19, 2024
1 parent 0608eb7 commit 3ea4df2
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: dev

E2E tests: fixing flaky connect to woo test
Original file line number Diff line number Diff line change
Expand Up @@ -423,21 +423,28 @@ test.describe( 'Store owner can skip the core profiler', () => {
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 page.goto( 'wp-admin/admin.php?page=wc-admin' );

await expect(
page.getByRole( 'heading', {
name: 'Connect to WooCommerce.com',
} )
).toBeVisible();
await page
.getByRole( 'link', { name: 'Connect', exact: true } )
.click();
.getByRole( 'menuitem', { name: 'Total sales' } )
.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(
'?page=wc-admin&tab=my-subscriptions&path=%2Fextensions'
);
await expect(
page.getByText(
'Hundreds of vetted products and services. Unlimited potential.'
)
).toBeVisible();
await expect(
page.getByRole( 'button', { name: 'My Subscriptions' } )
).toBeVisible();
Expand All @@ -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 expect( page.url() ).toContain( 'wordpress.com/log-in' );
// reload to avoid flaky blank page
await page.reload();
await expect(
page.getByRole( 'heading', {
name: 'Log in to your account',
Expand Down

0 comments on commit 3ea4df2

Please sign in to comment.