Skip to content

Commit 3eb04f8

Browse files
committed
chore: Configure a11y test suite for CI pipelines
- Add a11y test suite definition and scripts - Configure CI to run a11y tests on PR and develop branch
1 parent ef8cdf9 commit 3eb04f8

File tree

5 files changed

+91
-6
lines changed

5 files changed

+91
-6
lines changed

.github/workflows/ci-merge-checks.yml

+40-2
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ env:
1313
GH_TOKEN: ${{ github.token }}
1414
NODE_VERSION: '20'
1515
CONTINUUM_REGISTRY_TOKEN: ${{ secrets.CONTINUUM_REGISTRY_TOKEN }}
16+
COMMON_SAP_ARTIFACTORY_TOKEN: ${{ secrets.COMMON_SAP_ARTIFACTORY_TOKEN }}
1617

1718
concurrency:
1819
group: ci-merge-checks-${{ github.head_ref || github.run_id }}
@@ -151,8 +152,44 @@ jobs:
151152
BUILD_NUMBER: ci-build-number-${{ github.event.pull_request.head.sha || github.run_id }}
152153
run: |
153154
ci-scripts/e2e-cypress.sh -s b2b
155+
a11y_e2e_tests:
156+
needs: [no_retries, validate_e2e_execution]
157+
name: MC - E2E A11Y
158+
runs-on: ubuntu-latest
159+
strategy:
160+
matrix:
161+
containers: [1]
162+
if: ${{ needs.validate_e2e_execution.outputs.SHOULD_RUN_E2E == 'true' }}
163+
steps:
164+
- name: Forcefully fail build if e2e job is retried
165+
uses: actions/github-script@v7
166+
with:
167+
script: |
168+
core.setFailed('Please push a commit to trigger the build. To push an empty commit you can use `git commit --allow-empty -m "Trigger Build"`')
169+
if: ${{ github.run_attempt > 1 }}
170+
- uses: actions/checkout@v4
171+
- name: Setup node
172+
uses: actions/setup-node@v4
173+
with:
174+
node-version: ${{ env.NODE_VERSION }}
175+
- name: Cache node_modules
176+
id: cache-node-modules
177+
uses: actions/cache@v4
178+
with:
179+
path: |
180+
node_modules
181+
projects/storefrontapp-e2e-cypress/node_modules
182+
~/.cache/Cypress
183+
key: nodemodules-${{ github.event.pull_request.base.sha }}
184+
restore-keys: nodemodules-${{ github.event.pull_request.base.sha }}
185+
- name: Run e2es
186+
env:
187+
SPA_ENV: ci
188+
BUILD_NUMBER: ci-build-number-${{ github.event.pull_request.head.sha || github.run_id }}
189+
run: |
190+
ci-scripts/e2e-cypress.sh -s a11y
154191
merge_checks_result:
155-
needs: [b2c_e2e_tests, b2c_ssr_e2e_tests, b2b_e2e_tests]
192+
needs: [b2c_e2e_tests, b2c_ssr_e2e_tests, b2b_e2e_tests, a11y_e2e_tests]
156193
name: MC - Result
157194
runs-on: ubuntu-latest
158195
if: ${{ always() }}
@@ -173,4 +210,5 @@ jobs:
173210
if: |
174211
needs.b2c_e2e_tests.result == 'failure' || needs.b2c_e2e_tests.result == 'cancelled' ||
175212
needs.b2c_ssr_e2e_tests.result == 'failure' || needs.b2c_ssr_e2e_tests.result == 'cancelled' ||
176-
needs.b2b_e2e_tests.result == 'failure' || needs.b2b_e2e_tests.result == 'cancelled'
213+
needs.b2b_e2e_tests.result == 'failure' || needs.b2b_e2e_tests.result == 'cancelled' ||
214+
needs.a11y_e2e_tests.result == 'failure' || needs.a11y_e2e_tests.result == 'cancelled'

.github/workflows/ci.yml

+37
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ env:
1111
CYPRESS_KEY: ${{ secrets.CYPRESS_KEY }}
1212
NODE_VERSION: '20'
1313
CONTINUUM_REGISTRY_TOKEN: ${{ secrets.CONTINUUM_REGISTRY_TOKEN }}
14+
COMMON_SAP_ARTIFACTORY_TOKEN: ${{ secrets.COMMON_SAP_ARTIFACTORY_TOKEN }}
1415

1516
concurrency:
1617
group: ci-${{ github.head_ref || github.run_id }}
@@ -217,6 +218,42 @@ jobs:
217218
BUILD_NUMBER: ci-build-number-${{ github.event.pull_request.head.sha || github.run_id }}
218219
run: |
219220
ci-scripts/e2e-cypress.sh -s b2b
221+
a11y_e2e_tests:
222+
needs: [no_retries, validate_e2e_execution]
223+
name: E2E tests for A11Y
224+
runs-on: ubuntu-latest
225+
strategy:
226+
matrix:
227+
containers: [1, 2]
228+
if: ${{ github.event_name == 'push' || github.event_name == 'workflow_dispatch' || needs.validate_e2e_execution.outputs.SHOULD_RUN_E2E == 'true' }}
229+
steps:
230+
- name: Forcefully fail build if e2e job is retried
231+
uses: actions/github-script@v7
232+
with:
233+
script: |
234+
core.setFailed('Please push a commit to trigger the build. To push an empty commit you can use `git commit --allow-empty -m "Trigger Build"`')
235+
if: ${{ github.run_attempt > 1 }}
236+
- uses: actions/checkout@v4
237+
- name: Setup node
238+
uses: actions/setup-node@v4
239+
with:
240+
node-version: ${{ env.NODE_VERSION }}
241+
- name: Cache node_modules
242+
id: cache-node-modules
243+
uses: actions/cache@v4
244+
with:
245+
path: |
246+
node_modules
247+
projects/storefrontapp-e2e-cypress/node_modules
248+
~/.cache/Cypress
249+
key: nodemodules-${{ github.event.pull_request.base.sha }}
250+
restore-keys: nodemodules-${{ github.event.pull_request.base.sha }}
251+
- name: Run e2es
252+
env:
253+
SPA_ENV: ci
254+
BUILD_NUMBER: ci-build-number-${{ github.event.pull_request.head.sha || github.run_id }}
255+
run: |
256+
ci-scripts/e2e-cypress.sh -s a11y
220257
ssr_tests:
221258
needs: [no_retries, validate_e2e_execution]
222259
name: SSR Tests

ci-scripts/e2e-cypress.sh

+8-3
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ POSITIONAL=()
77
readonly help_display="Usage: $0 [ command_options ] [ param ]
88
99
command options:
10-
--suite, -s e2e suite to run (b2c, b2b, cds, flaky). Default: b2c
10+
--suite, -s e2e suite to run (b2c, b2b, cds, flaky, a11y). Default: b2c
1111
--environment, --env [ 2005 | 2011 | ccv2]. Default: 2005
1212
--help, -h show help
1313
--ssr Run ssr smoke test
@@ -139,8 +139,13 @@ else
139139
echo "Running full Cypress end-to-end tests for epic branch"
140140
npm run e2e:run:ci"${SUITE}"
141141
else
142-
echo "Running core Cypress end-to-end tests for pull requests"
143-
npm run e2e:run:ci:core"${SUITE}"
142+
if [[ "${SUITE}" == ":a11y" ]]; then
143+
echo "Running a11y Cypress end-to-end tests for pull requests"
144+
npm run e2e:run:ci:a11y
145+
else
146+
echo "Running core Cypress end-to-end tests for pull requests"
147+
npm run e2e:run:ci:core"${SUITE}"
148+
fi
144149
fi
145150

146151
elif [ "${GITHUB_EVENT_NAME}" == "push" ]; then

package.json

+2
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,8 @@
8888
"e2e:run:ci:release": "npm --prefix ./projects/storefrontapp-e2e-cypress run cy:run:ci:release",
8989
"e2e:run:ci:b2b:release": "npm --prefix ./projects/storefrontapp-e2e-cypress run cy:run:ci:b2b:release",
9090
"e2e:run:ci:ssr:release": "npm --prefix ./projects/storefrontapp-e2e-cypress run cy:run:ci:ssr:release",
91+
"e2e:run:ci:a11y": "cd projects/storefrontapp-e2e-cypress && npm run cy:run:ci:a11y",
92+
"e2e:run:ci:a11y:release": "npm --prefix ./projects/storefrontapp-e2e-cypress run cy:run:ci:a11y:release",
9193
"generate:docs": "npx @compodoc/[email protected] -p tsconfig.compodoc.json",
9294
"generate:publish:docs": "npm run generate:docs && npm run publish:docs",
9395
"graph": "nx graph",

projects/storefrontapp-e2e-cypress/package.json

+4-1
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,12 @@
1616
"cy:run": "cypress run",
1717
"cy:run:b2b": "cypress run --env BASE_SITE=powertools-spa,OCC_PREFIX_USER_ENDPOINT=orgUsers",
1818
"cy:run:core": "cypress run --spec \"cypress/e2e/**/*.core-e2e.cy.ts\"",
19+
"cy:run:a11y": "cypress run --spec \"cypress/e2e/**/*.a11y-e2e.cy.ts\"",
1920
"cy:run:product-configurator-vc": "cypress run --spec \"cypress/e2e/**/*-configurator*.*e2e.cy.ts\"",
2021
"cy:run:cpq": "cypress run --config-file cypress.config.ci.ts --config baseUrl=https://jsapps.cpce-teamtiger1-d2-public.model-t.cc.commerce.ondemand.com,defaultCommandTimeout=100000,requestTimeout=1000000,responseTimeout=1000000,pageLoadTimeout=1000000 --reporter junit --reporter-options mochaFile=results/test-results-[hash].xml --env API_URL=https://api.cpce-teamtiger1-d2-public.model-t.cc.commerce.ondemand.com --spec \"cypress/e2e/**/cpq-configuration.core-e2e.cy.ts\"",
2122
"cy:run:ci": "cypress run --config-file cypress.config.ci.ts --record --key $CYPRESS_KEY --tag \"b2c,all\" --parallel --ci-build-id $BUILD_NUMBER --group B2C --spec \"cypress/e2e/!(vendor|b2b|ssr|cx_ccv2|cx_mcs)/**/(!(my-account-v2))*e2e.cy.ts\" --reporter junit --reporter-options mochaFile=results/e2e-test-b2c-[hash].xml",
2223
"cy:run:ci:core": "cypress run --config-file cypress.config.ci.ts --record --key $CYPRESS_KEY --tag \"b2c,core\" --parallel --ci-build-id $BUILD_NUMBER --group B2C --spec \"cypress/e2e/!(vendor|b2b|ssr|cx_ccv2|cx_mcs)/**/*.core-e2e.cy.ts\"",
24+
"cy:run:ci:a11y": "cypress run --config-file cypress.config.ci.ts --record --key $CYPRESS_KEY --tag \"a11y,all\" --parallel --ci-build-id $BUILD_NUMBER --group A11Y --spec \"cypress/e2e/**/*.a11y-e2e.cy.ts\" --reporter junit --reporter-options mochaFile=results/e2e-test-a11y-[hash].xml",
2325
"cy:run:ci:b2b": "cypress run --config-file cypress.config.ci.ts --env BASE_SITE=powertools-spa,OCC_PREFIX_USER_ENDPOINT=orgUsers --record --key $CYPRESS_KEY --tag \"b2b,all\" --parallel --ci-build-id $BUILD_NUMBER --group B2B --spec \"cypress/e2e/b2b/regression/**/*e2e.cy.ts\" --reporter junit --reporter-options mochaFile=results/e2e-test-b2b-[hash].xml",
2426
"cy:run:ci:core:b2b": "cypress run --config-file cypress.config.ci.ts --env BASE_SITE=powertools-spa,OCC_PREFIX_USER_ENDPOINT=orgUsers --record --key $CYPRESS_KEY --tag \"b2b,core\" --parallel --ci-build-id $BUILD_NUMBER --group B2B --spec \"cypress/e2e/b2b/regression/**/*.core-e2e.cy.ts\"",
2527
"cy:run:ci:ccv2": "cypress run --config-file cypress.config.ci.ts --config baseUrl=$ENDPOINT_URL_PUBLIC_SPARTACUS --reporter junit --reporter-options mochaFile=results/spartacus-test-results-[hash].xml --env API_URL=$ENDPOINT_URL_PUBLIC_API --spec $E2ES_TO_RUN",
@@ -41,7 +43,8 @@
4143
"cy:run:ci:my-account-v2": "cypress run --config-file cypress.config.ci.ts --env API_URL=https://api.cg79x9wuu9-eccommerc1-s5-public.model-t.myhybris.cloud/ --tag \"my-account-v2\" --group MY-ACCOUNT-V2 --spec \"cypress/e2e/regression/my-account/my-account-v2-*.e2e.cy.ts\"",
4244
"cy:run:ci:release": "cypress run --config-file cypress.config.ci.ts --spec \"$(cat tests_to_run.txt)\" --reporter junit --reporter-options mochaFile=results/e2e-test-b2c-[hash].xml",
4345
"cy:run:ci:b2b:release": "cypress run --config-file cypress.config.ci.ts --env BASE_SITE=powertools-spa,OCC_PREFIX_USER_ENDPOINT=orgUsers --spec \"cypress/e2e/b2b/regression/**/*e2e.cy.ts\" --reporter junit --reporter-options mochaFile=results/e2e-test-b2b-[hash].xml",
44-
"cy:run:ci:ssr:release": "cypress run --config-file cypress.config.ci.ts --config baseUrl=http://localhost:4000 --spec \"cypress/e2e/ssr/*.e2e.cy.ts\" --reporter junit --reporter-options mochaFile=results/e2e-test-ssr-[hash].xml"
46+
"cy:run:ci:ssr:release": "cypress run --config-file cypress.config.ci.ts --config baseUrl=http://localhost:4000 --spec \"cypress/e2e/ssr/*.e2e.cy.ts\" --reporter junit --reporter-options mochaFile=results/e2e-test-ssr-[hash].xml",
47+
"cy:run:ci:a11y:release": "cypress run --config-file cypress.config.ci.ts --spec \"cypress/e2e/**/*.a11y-e2e.cy.ts\" --reporter junit --reporter-options mochaFile=results/e2e-test-a11y-[hash].xml"
4548
},
4649
"devDependencies": {
4750
"@babel/core": "^7.14.3",

0 commit comments

Comments
 (0)