Skip to content

Commit 35b7976

Browse files
CCM-12666: Routing accessibility tests
1 parent 44d972f commit 35b7976

File tree

7 files changed

+90
-1
lines changed

7 files changed

+90
-1
lines changed

.github/actions/test-types.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
[
22
"accessibility",
3+
"routing-accessibility",
34
"api",
45
"event",
56
"ui-component",
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#!/bin/bash
2+
3+
set -euo pipefail
4+
5+
# feature flag
6+
export INCLUDE_AUTH_PAGES=true
7+
8+
npm run accessibility-test-setup -w tests/accessibility
9+
npm run build
10+
mkdir -p ./frontend/public/testing
11+
cp ./utils/utils/src/email-templates/* ./frontend/public/testing/
12+
13+
npm run app:start --prefix frontend
14+
npm run app:wait --prefix frontend
15+
16+
TEST_EXIT_CODE=0
17+
npm run test:accessibility -w tests/accessibility || TEST_EXIT_CODE=$?
18+
echo "TEST_EXIT_CODE=$TEST_EXIT_CODE"
19+
20+
mkdir -p ./tests/acceptance-test-report
21+
cp -r ./tests/accessibility/.reports/routing-accessibility ./tests/acceptance-test-report
22+
npm run accessibility-test-teardown -w tests/routing-accessibility
23+
24+
exit $TEST_EXIT_CODE

scripts/tests/test.mk

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ test-coverage: # Evaluate code coverage from scripts/test/coverage @Testing
2323
test-accessibility: # Run tests from scripts/tests/accessibility.sh @Testing
2424
make _test name="accessibility"
2525

26+
test-routing-accessibility: # Run tests from scripts/tests/accessibility.sh @Testing
27+
make _test name="routing-accessibility"
28+
2629
test-ui-routing-component: # Run tests from scripts/tests/ui-routing-component.sh @Testing
2730
make _test name="ui-routing-component"
2831

tests/accessibility/.pa11y-ci.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@ const {
4040
viewNotYetSubmittedNHSAppTemplatePage,
4141
viewNotYetSubmittedTextMessageTemplatePage,
4242
waitingForProofsLetterTemplatePage,
43+
messagePlansPage,
44+
chooseMessageOrderPage,
45+
chooseMessageOrderErrorPage,
46+
4347
} = require('./actions');
4448

4549
const baseUrl = 'http://localhost:3000/templates';
@@ -139,6 +143,12 @@ const userEmails = [
139143
},
140144
];
141145

146+
const routing = [
147+
{
148+
url: `${baseUrl}/message-plans/`
149+
}
150+
]
151+
142152
const allJourneys = {
143153
landingPage,
144154
allTemplates,
@@ -149,6 +159,7 @@ const allJourneys = {
149159
letters,
150160
userEmails,
151161
errors,
162+
routing,
152163
};
153164

154165
const selectedJourney = process.env.JOURNEY && allJourneys[process.env.JOURNEY]
@@ -176,5 +187,6 @@ module.exports = {
176187
},
177188
standard: 'WCAG2AA',
178189
agent: 'pa11y',
190+
concurrency: 4,
179191
},
180192
};
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
const { signInPageActions } = require('./sign-in-page.actions');
2+
3+
const pageActions = [
4+
...signInPageActions,
5+
'wait for element #cchoose-message-order-submit-button to be visible',
6+
];
7+
8+
const chooseMessageOrderPage = (url) => ({
9+
name: 'choose-message-order',
10+
url,
11+
actions: pageActions,
12+
});
13+
14+
const chooseMessageOrderPageError = (url) => ({
15+
name: 'choose-message-order-error',
16+
url,
17+
actions: [
18+
...pageActions,
19+
'click element #choose-message-order-submit-button',
20+
'wait for element .nhsuk-error-summary__title to be visible',
21+
],
22+
ignore: [
23+
// NHS error summary component has a H2 above the H1.
24+
'WCAG2AA.Principle1.Guideline1_3.1_3_1_AAA.G141',
25+
],
26+
});
27+
28+
module.exports = {
29+
chooseMessageOrderPage,
30+
chooseMessageOrderPageError,
31+
};

tests/accessibility/actions/index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,5 +29,6 @@ module.exports = {
2929
...require('./view-not-yet-submitted-letter-template.actions'),
3030
...require('./view-not-yet-submitted-nhs-app-template.actions'),
3131
...require('./view-not-yet-submitted-text-message-template.actions'),
32-
...require('./waiting-for-proofs-letter-template.actions'),
32+
...require('./choose-message-order.actions'),
33+
...require('./message-plans.actions'),
3334
};
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
const { signInPageActions } = require('./sign-in-page.actions');
2+
3+
const pageActions = [
4+
...signInPageActions,
5+
'wait for element .nhsuk-button to be visible',
6+
];
7+
8+
const messagePlansPage = (url) => ({
9+
name: 'message-plans',
10+
url,
11+
actions: pageActions,
12+
});
13+
14+
module.exports = {
15+
pageActions,
16+
messagePlansPage,
17+
};

0 commit comments

Comments
 (0)