Skip to content

Commit 6c6b003

Browse files
authored
Merge pull request #217 from thebiggive/DON-1156-check-homepage-accessibility
DON-1156: Check homepage accessibility
2 parents 9e9b744 + eb32d51 commit 6c6b003

File tree

5 files changed

+43
-3
lines changed

5 files changed

+43
-3
lines changed

features/read-home-page.feature

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
Feature: Read the homepage
2+
3+
As someone interested in understand Big Give, I should be able to read the homepage.
4+
5+
Scenario: Reading the homepage
6+
Given I am on the home page
7+
Then there should be no accessibility violations detected

pages/DonateStartPage.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,11 @@ export default class DonateStartPage {
302302
);
303303

304304
// Axe accessibility check just before hitting donate.
305-
await checkNoAccessibilityViolations({ withAngularStepperException: true, withSalesforceHeaderException: false });
305+
await checkNoAccessibilityViolations({
306+
withAngularStepperException: true,
307+
withSalesforceHeaderException: false,
308+
withContrastRatioException: false,
309+
});
306310

307311
await clickSelector(submitBtnSelector);
308312
}

steps/HomePage.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import {Given, Then} from "@cucumber/cucumber";
2+
import {goToUrl} from "../support/util";
3+
import checkNoAccessibilityViolations from "../support/a11y";
4+
5+
Given(
6+
'I am on the home page',
7+
async () => {
8+
const baseurl = process.env.BASE_URL;
9+
if (!baseurl) throw new Error('BASE_URL not defined in enviornment');
10+
11+
await goToUrl(baseurl + "?noredirect=");
12+
}
13+
);
14+
Then(
15+
/^there should be no accessibility violations detected$/,
16+
async function () {
17+
await checkNoAccessibilityViolations(
18+
{withAngularStepperException: false, withSalesforceHeaderException: false, withContrastRatioException: true}
19+
);
20+
});

steps/pledge.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,11 @@ Given(
2929
"I open the pledge campaign's pledge form",
3030
async () => {
3131
await page.open();
32-
await checkNoAccessibilityViolations({ withAngularStepperException: false, withSalesforceHeaderException: true });
32+
await checkNoAccessibilityViolations({
33+
withAngularStepperException: false,
34+
withSalesforceHeaderException: true,
35+
withContrastRatioException: false,
36+
});
3337
}
3438
);
3539

support/a11y.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import AxeBuilder from '@axe-core/webdriverio';
66
* incompletes.
77
*/
88
export default async function checkNoAccessibilityViolations(
9-
options = {withAngularStepperException: false, withSalesforceHeaderException: false}
9+
options = {withAngularStepperException: false, withSalesforceHeaderException: false, withContrastRatioException: false}
1010
){
1111
console.log('Running Axe accessibility check...');
1212

@@ -30,6 +30,11 @@ export default async function checkNoAccessibilityViolations(
3030
builder.exclude('header.lf-header_navigation');
3131
}
3232

33+
if (options.withContrastRatioException){
34+
// known issue of low contrast in footer
35+
builder.exclude('#footer-primary-heading');
36+
}
37+
3338
const result = await builder.analyze();
3439

3540
const violationCount = result.violations.length;

0 commit comments

Comments
 (0)