Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Abandon apca check #31

Merged
merged 2 commits into from
Oct 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified frontend/bun.lockb
Binary file not shown.
2 changes: 1 addition & 1 deletion frontend/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<meta name="viewport" content="width=device-width,initial-scale=1.0" />

<!-- favicons -->
<link rel="icon" type="image/png" sizes="512x512 " href="/icon.png" />
<link rel="icon" type="image/png" sizes="512x512" href="/icon.png" />

<!-- basic -->
<title>%VITE_TITLE%</title>
Expand Down
1 change: 0 additions & 1 deletion frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@
"@typescript-eslint/eslint-plugin": "^8.2.0",
"@typescript-eslint/parser": "^8.2.0",
"@vitejs/plugin-react-swc": "^3.7.0",
"apca-check": "^0.1.1",
"eslint-plugin-jsx-a11y": "^6.9.0",
"eslint-plugin-prettier": "^5.2.1",
"eslint-plugin-react-hooks": "^4.6.2",
Expand Down
2 changes: 1 addition & 1 deletion frontend/public/mockServiceWorker.js
Original file line number Diff line number Diff line change
Expand Up @@ -281,4 +281,4 @@ async function respondWithMock(response) {
})

return mockedResponse
}
}
20 changes: 8 additions & 12 deletions frontend/src/assets/collapse.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
22 changes: 10 additions & 12 deletions frontend/src/assets/expand.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
29 changes: 20 additions & 9 deletions frontend/tests/accessibility.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import registerAPCACheck from "apca-check";
import { AxeBuilder } from "@axe-core/playwright";
import { expect, test } from "@playwright/test";
import analyses from "@/fixtures/analyses.json" with { type: "json" };
Expand All @@ -16,9 +15,6 @@ const paths = [
...analyses.map((analysis) => `/analysis/${analysis.id}`),
];

/** NOT WORKING YET https://github.com/StackExchange/apca-check/issues/143 */
registerAPCACheck("bronze");

/** generic page axe test */
const checkPage = (path: string) =>
test(`Accessibility check ${path}`, async ({ page, browserName }) => {
Expand All @@ -34,11 +30,26 @@ const checkPage = (path: string) =>

/** axe check */
const check = async () => {
const { violations } = await new AxeBuilder({ page })
/** https://github.com/dequelabs/axe-core/issues/3325 */
.options({ rules: { "color-contrast": { enabled: false } } })
.analyze();
expect(violations).toEqual([]);
/** get page violations */
const { violations } = await new AxeBuilder({ page }).analyze();

const warnRules = [
/** just warn about color-contrast violations */
/** https://github.com/dequelabs/axe-core/issues/3325#issuecomment-2383832705 */
"color-contrast",
];

/** split up critical/non-critical violations */
const isCritical =
(match: boolean) => (violation: (typeof violations)[number]) =>
!warnRules.includes(violation.id) === match;
const criticals = violations.filter(isCritical(true));
const warnings = violations.filter(isCritical(false));

/** fail test on critical violations */
expect(criticals).toEqual([]);
/** just console log warnings on non-critical violations */
console.warn(warnings);
};

await check();
Expand Down