-
Notifications
You must be signed in to change notification settings - Fork 214
Expand file tree
/
Copy patha11y-snapshot-test-registered.spec.js
More file actions
74 lines (62 loc) · 2.41 KB
/
a11y-snapshot-test-registered.spec.js
File metadata and controls
74 lines (62 loc) · 2.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
/*
* Copyright (c) 2025, Salesforce, Inc.
* All rights reserved.
* SPDX-License-Identifier: BSD-3-Clause
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause
*/
const {test, expect} = require('@playwright/test')
const {
answerConsentTrackingForm,
registeredUserHappyPath,
wishlistFlow,
loginShopper,
registerShopper
} = require('../../../scripts/pageHelpers')
const {generateUserCredentials, runAccessibilityTest} = require('../../../scripts/utils')
test.describe('Accessibility Tests with Snapshots for a registered user', async () => {
let registeredUserCredentials = {}
test.beforeAll(async () => {
// Generate credentials once and use throughout tests to avoid creating a new account
registeredUserCredentials = generateUserCredentials()
})
test('Registered shopper happy path flow should not have new accessibility issues', async ({
page
}) => {
await registeredUserHappyPath({
page,
registeredUserCredentials,
a11y: {checkA11y: true, snapShotName: 'registered'}
})
})
test('Wishlist page should not have any new a11y issues', async ({page}) => {
await wishlistFlow({
page,
registeredUserCredentials,
a11y: {checkA11y: true, snapShotName: 'registered'}
})
})
})
test.describe('Registered Account pages', () => {
let registeredUserCredentials = {}
test.beforeAll(async () => {
// Generate credentials once and use throughout tests to avoid creating a new account
registeredUserCredentials = generateUserCredentials()
})
test('Account pages should not have any new a11y issues', async ({page}) => {
const isLoggedIn = await loginShopper({
page,
userCredentials: registeredUserCredentials
})
if (!isLoggedIn) {
await registerShopper({
page,
userCredentials: registeredUserCredentials
})
}
// The consent form shows up again after registration
await answerConsentTrackingForm(page)
await runAccessibilityTest(page, ['registered', 'account-details-a11y-violations.json'])
await page.getByRole('link', {name: 'Addresses'}).click()
await runAccessibilityTest(page, ['registered', 'account-addresses-a11y-violations.json'])
})
})