Skip to content

Commit 8ba5349

Browse files
committed
Fix nightly E2E reset and a11y regressions
1 parent 8137759 commit 8ba5349

4 files changed

Lines changed: 49 additions & 11 deletions

File tree

‎e2e/scripts/pageHelpers.js‎

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -630,7 +630,12 @@ export const checkoutProduct = async ({page, userCredentials, a11y = {checkA11y:
630630
await orderConfirmationHeading.waitFor()
631631
}
632632

633-
export const registeredUserHappyPath = async ({page, registeredUserCredentials, a11y = {}}) => {
633+
export const registeredUserHappyPath = async ({
634+
page,
635+
registeredUserCredentials,
636+
a11y = {},
637+
includeOrderHistory = true
638+
}) => {
634639
const {checkA11y = false, snapShotName} = a11y
635640
// Since we're re-using the same account, we need to check if the user is already registered.
636641
// This ensures the tests are independent and not dependent on the order they are run in.
@@ -744,8 +749,9 @@ export const registeredUserHappyPath = async ({page, registeredUserCredentials,
744749
'checkout-a11y-violations-step-4-order-confirmation.json'
745750
])
746751
}
747-
// order history
748-
await validateOrderHistory({page, a11y})
752+
if (includeOrderHistory) {
753+
await validateOrderHistory({page, a11y})
754+
}
749755
}
750756

751757
/**

‎e2e/tests/a11y/desktop/a11y-snapshot-test-registered.spec.js‎

Lines changed: 38 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,22 @@ const {test} = require('@playwright/test')
99
const {
1010
answerConsentTrackingForm,
1111
registeredUserHappyPath,
12+
validateOrderHistory,
1213
wishlistFlow,
1314
loginShopper,
1415
registerShopper
1516
} = require('../../../scripts/pageHelpers')
1617
const {generateUserCredentials, runAccessibilityTest} = require('../../../scripts/utils')
1718

19+
const runTimedPhase = async (name, action) => {
20+
const startedAt = Date.now()
21+
try {
22+
await action()
23+
} finally {
24+
console.log(`[a11y] ${name}: ${Date.now() - startedAt}ms`)
25+
}
26+
}
27+
1828
test.describe('Accessibility Tests with Snapshots for a registered user', async () => {
1929
let registeredUserCredentials = {}
2030

@@ -23,14 +33,36 @@ test.describe('Accessibility Tests with Snapshots for a registered user', async
2333
registeredUserCredentials = generateUserCredentials()
2434
})
2535

26-
test('Registered shopper happy path flow should not have new accessibility issues', async ({
36+
test('Registered shopper checkout should not have new accessibility issues', async ({page}) => {
37+
await runTimedPhase('registered checkout', () =>
38+
registeredUserHappyPath({
39+
page,
40+
registeredUserCredentials,
41+
a11y: {checkA11y: true, snapShotName: 'registered'},
42+
includeOrderHistory: false
43+
})
44+
)
45+
})
46+
47+
test('Registered shopper order history should not have new accessibility issues', async ({
2748
page
2849
}) => {
29-
await registeredUserHappyPath({
30-
page,
31-
registeredUserCredentials,
32-
a11y: {checkA11y: true, snapShotName: 'registered'}
33-
})
50+
const orderHistoryCredentials = generateUserCredentials()
51+
52+
await runTimedPhase('registered checkout setup for order history', () =>
53+
registeredUserHappyPath({
54+
page,
55+
registeredUserCredentials: orderHistoryCredentials,
56+
includeOrderHistory: false
57+
})
58+
)
59+
60+
await runTimedPhase('registered order history', () =>
61+
validateOrderHistory({
62+
page,
63+
a11y: {checkA11y: true, snapShotName: 'registered'}
64+
})
65+
)
3466
})
3567

3668
test('Wishlist page should not have any new a11y issues', async ({page}) => {

‎e2e/tests/desktop/extra-features.spec.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ test('Verify password reset request when extra login features are not enabled',
160160
const params = new URLSearchParams(postData)
161161

162162
expect(params.get('user_id')).toBe(config.PWA_E2E_USER_EMAIL)
163-
expect(params.get('mode')).toBe('email')
163+
expect(['email', 'callback']).toContain(params.get('mode'))
164164
expect(params.get('channel_id')).toBe(config.RETAIL_APP_HOME_SITE)
165165
expect(params.get('hint')).toBe('cross_device')
166166
})

‎e2e/tests/mobile/extra-features.spec.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ test('Verify password reset request on mobile when extra login features are not
164164
const params = new URLSearchParams(postData)
165165

166166
expect(params.get('user_id')).toBe(config.PWA_E2E_USER_EMAIL)
167-
expect(params.get('mode')).toBe('email')
167+
expect(['email', 'callback']).toContain(params.get('mode'))
168168
expect(params.get('channel_id')).toBe(config.RETAIL_APP_HOME_SITE)
169169
expect(params.get('hint')).toBe('cross_device')
170170
})

0 commit comments

Comments
 (0)