-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial commit adding a11y docker container and a11y tests
- Loading branch information
bwang
committed
Aug 11, 2023
1 parent
3bce283
commit 36f1a25
Showing
11 changed files
with
623 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
report | ||
report-a11y | ||
package-lock.json | ||
coverage | ||
context.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
FROM node:16.15.1-bullseye | ||
|
||
ARG PA11Y_VERSION | ||
|
||
ENV \ | ||
PA11Y_VERSION=$PA11Y_VERSION | ||
|
||
# Base packages | ||
RUN apt-get update && \ | ||
apt-get install -y git sudo software-properties-common | ||
|
||
# Find links to Chromium arm64 binaries here: http://snapshot.debian.org/binary/chromium/ | ||
ENV CHROMIUM_ARM_URL http://snapshot.debian.org/archive/debian-security/20220902T180902Z/pool/updates/main/c/chromium/ | ||
ENV CHROMIUM_ARM_BINARY chromium_105.0.5195.52-1~deb11u1_arm64.deb | ||
ENV CHROMIUM_ARM_COMMON_BINARY chromium-common_105.0.5195.52-1~deb11u1_arm64.deb | ||
|
||
RUN /bin/bash -c 'set -ex && \ | ||
ARCH=`uname -m` && \ | ||
if [ "$ARCH" == "x86_64" ]; then \ | ||
sudo npm install -g --unsafe-perm=true --allow-root pa11y@${PA11Y_VERSION}; \ | ||
else \ | ||
sudo PUPPETEER_SKIP_DOWNLOAD=true PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true npm install -g --unsafe-perm=true --allow-root pa11y@${PA11Y_VERSION} && \ | ||
wget "${CHROMIUM_ARM_URL}${CHROMIUM_ARM_COMMON_BINARY}" \ | ||
"${CHROMIUM_ARM_URL}${CHROMIUM_ARM_BINARY}" && \ | ||
apt install -y "./${CHROMIUM_ARM_COMMON_BINARY}" \ | ||
"./${CHROMIUM_ARM_BINARY}" && \ | ||
sudo test -f /usr/bin/chromium && sudo ln -s /usr/bin/chromium /usr/bin/chromium-browser && sudo ln -s /usr/bin/chromium /usr/bin/chrome; \ | ||
fi' | ||
|
||
RUN sudo npm install -g mustache | ||
|
||
RUN wget https://dl-ssl.google.com/linux/linux_signing_key.pub && sudo apt-key add linux_signing_key.pub | ||
RUN sudo add-apt-repository "deb http://dl.google.com/linux/chrome/deb/ stable main" | ||
|
||
RUN apt-get -qqy update \ | ||
&& apt-get -qqy --no-install-recommends install \ | ||
libxshmfence-dev \ | ||
libfontconfig \ | ||
libfreetype6 \ | ||
xfonts-cyrillic \ | ||
xfonts-scalable \ | ||
fonts-liberation \ | ||
fonts-ipafont-gothic \ | ||
fonts-wqy-zenhei \ | ||
libgbm-dev \ | ||
gconf-service libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libcairo2 libcups2 libdbus-1-3 libexpat1 libfontconfig1 libgcc1 libgconf-2-4 libgdk-pixbuf2.0-0 libglib2.0-0 libgtk-3-0 libnspr4 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 libxcursor1 libxdamage1 libxss1 libxtst6 libappindicator1 libnss3 libasound2 libatk1.0-0 libc6 ca-certificates fonts-liberation lsb-release xdg-utils wget \ | ||
&& rm -rf /var/lib/apt/lists/* \ | ||
&& apt-get -qyy clean | ||
|
||
ENV NODE_PATH=/usr/local/lib/node_modules | ||
|
||
#ENTRYPOINT ["tail", "-f", "/dev/null"] | ||
ENTRYPOINT ["node", "src/a11y/runA11yTests.js"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
// @ts-nocheck | ||
const utils = require( './utils' ); | ||
|
||
const NAMESPACE = 'desktop'; | ||
const BASE_URL = process.env.PIXEL_MW_SERVER; | ||
|
||
const testDefaults = { | ||
viewport: { | ||
width: 1200, | ||
height: 1080 | ||
}, | ||
runners: [ | ||
'axe', | ||
'htmlcs' | ||
], | ||
includeWarnings: true, | ||
includeNotices: true, | ||
ignore: [ | ||
'color-contrast', | ||
'WCAG2AA.Principle2.Guideline2_4.2_4_1.G1,G123,G124.NoSuchID' | ||
], | ||
hideElements: '#bodyContent, #siteNotice', | ||
chromeLaunchConfig: { | ||
headless: true, | ||
args: [ | ||
'--no-sandbox', | ||
'--disable-setuid-sandbox' | ||
] | ||
} | ||
}; | ||
|
||
module.exports = { | ||
namespace: NAMESPACE, | ||
paths: utils.makeA11yPaths( NAMESPACE ), | ||
tests: [ | ||
{ | ||
name: 'default', | ||
url: BASE_URL + '/wiki/Test', | ||
...testDefaults | ||
}, | ||
{ | ||
name: 'logged_in', | ||
url: BASE_URL + '/wiki/Test', | ||
...testDefaults | ||
} | ||
] | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Ignore everything except this file | ||
* | ||
!.gitignore |
Oops, something went wrong.