Skip to content

Commit 67ec4c7

Browse files
authored
Convert the Progressive Onboarding spec to Playwright (#10130)
1 parent b763f99 commit 67ec4c7

File tree

5 files changed

+107
-96
lines changed

5 files changed

+107
-96
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Significance: patch
2+
Type: dev
3+
4+
Converted E2E merchant-progressive-onboarding spec from Puppeteer to Playwright.
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
/**
2+
* External dependencies
3+
*/
4+
import { test, expect } from '@playwright/test';
5+
6+
/**
7+
* Internal dependencies
8+
*/
9+
import { useMerchant } from '../../utils/helpers';
10+
import * as devtools from '../../utils/devtools';
11+
import { goToConnect } from '../../utils/merchant-navigation';
12+
13+
test.describe( 'Admin merchant progressive onboarding', () => {
14+
useMerchant();
15+
16+
test.beforeAll( async ( { browser } ) => {
17+
const page = await browser.newPage();
18+
await devtools.enableActAsDisconnectedFromWCPay( page );
19+
} );
20+
21+
test.afterAll( async ( { browser } ) => {
22+
const page = await browser.newPage();
23+
await devtools.disableActAsDisconnectedFromWCPay( page );
24+
} );
25+
26+
test( 'should pass merchant flow without any errors', async ( {
27+
page,
28+
} ) => {
29+
// Open connect account page and click the primary CTA to start onboarding.
30+
await goToConnect( page );
31+
// Start onboarding process
32+
await page
33+
.getByRole( 'button', { name: 'Verify business details' } )
34+
.click();
35+
// Pick Individual business entity
36+
await page
37+
.getByRole( 'button', {
38+
name: 'What type of legal entity is',
39+
} )
40+
.click();
41+
await page.getByRole( 'option', { name: 'Individual' } ).click();
42+
// Pick Software MCC
43+
await page.getByLabel( 'Select an option' ).click();
44+
await page.getByText( 'Software' ).click();
45+
// Accept terms and conditions
46+
await page.getByRole( 'button', { name: 'Continue' } ).click();
47+
// Pick annual revenue
48+
await page
49+
.getByRole( 'button', {
50+
name: 'What is your estimated annual',
51+
} )
52+
.click();
53+
await page.getByRole( 'option', { name: 'Less than $250k' } ).click();
54+
// Pick estimated time to launch
55+
await page
56+
.getByRole( 'button', { name: 'What is the estimated timeline' } )
57+
.click();
58+
await page.getByRole( 'option', { name: 'Within 1 month' } ).click();
59+
await page.getByRole( 'button', { name: 'Continue' } ).click();
60+
61+
// Check that Stripe Embedded KYC iframe is loaded.
62+
await expect(
63+
page.locator(
64+
'iframe[data-testid="stripe-connect-ui-layer-stripe-connect-account-onboarding"]'
65+
)
66+
).toBeAttached();
67+
} );
68+
} );

tests/e2e-pw/utils/devtools.ts

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,16 @@ const toggleCardTestingProtection = ( page: Page ) =>
2121
.locator( 'label[for="wcpaydev_force_card_testing_protection_on"]' )
2222
.click();
2323

24+
const getIsActAsDisconnectedFromWCPayEnabled = ( page: Page ) =>
25+
page
26+
.getByLabel( 'act as disconnected from the Transact Platform Server' )
27+
.isChecked();
28+
29+
const toggleActAsDisconnectedFromWCPay = ( page: Page ) =>
30+
page
31+
.getByLabel( 'act as disconnected from the Transact Platform Server' )
32+
.click();
33+
2434
export const enableCardTestingProtection = async ( page: Page ) => {
2535
await goToDevToolsSettings( page );
2636

@@ -38,3 +48,21 @@ export const disableCardTestingProtection = async ( page: Page ) => {
3848
await saveDevToolsSettings( page );
3949
}
4050
};
51+
52+
export const enableActAsDisconnectedFromWCPay = async ( page: Page ) => {
53+
await goToDevToolsSettings( page );
54+
55+
if ( ! ( await getIsActAsDisconnectedFromWCPayEnabled( page ) ) ) {
56+
await toggleActAsDisconnectedFromWCPay( page );
57+
await saveDevToolsSettings( page );
58+
}
59+
};
60+
61+
export const disableActAsDisconnectedFromWCPay = async ( page: Page ) => {
62+
await goToDevToolsSettings( page );
63+
64+
if ( await getIsActAsDisconnectedFromWCPayEnabled( page ) ) {
65+
await toggleActAsDisconnectedFromWCPay( page );
66+
await saveDevToolsSettings( page );
67+
}
68+
};

tests/e2e-pw/utils/merchant-navigation.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,3 +56,10 @@ export const goToMultiCurrencyOnboarding = async ( page: Page ) => {
5656
);
5757
await dataHasLoaded( page );
5858
};
59+
60+
export const goToConnect = async ( page: Page ) => {
61+
await page.goto(
62+
'/wp-admin/admin.php?page=wc-admin&path=/payments/connect'
63+
);
64+
await dataHasLoaded( page );
65+
};

tests/e2e/specs/wcpay/merchant/merchant-progressive-onboarding.spec.js

Lines changed: 0 additions & 96 deletions
This file was deleted.

0 commit comments

Comments
 (0)