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

feat: add accessibility test with report #2138

Draft
wants to merge 15 commits into
base: main
Choose a base branch
from
52 changes: 52 additions & 0 deletions .github/workflows/tests-axe.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Accessibility tests
on:
workflow_dispatch:
pull_request:
paths-ignore:
- ".github/workflows/**"
- "*.md"
- "integration/**"
- AUTHORS

concurrency:
group: ci-${{ github.ref }}-a11y
cancel-in-progress: true

env:
MIX_ENV: dev
MBTA_API_BASE_URL: ${{ secrets.MBTA_API_BASE_URL }}
MBTA_API_KEY: ${{ secrets.MBTA_API_KEY }}

jobs:
axe_test:
name: Run accessibility tests against Docker container
timeout-minutes: 30
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v4
with:
node-version-file: .tool-versions
cache: npm
cache-dependency-path: package-lock.json
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ secrets.AWS_ROLE_ARN }}
aws-region: us-east-1
mask-aws-account-id: true
- run: docker compose --file deploy/local.yml run a11y-test
- uses: actions/upload-artifact@v4
if: always()
with:
name: axe-report-${{ github.sha }}
path: playwright-report
retention-days: 30
- name: show docker container logs
run: docker compose --file deploy/local.yml logs
if: ${{ failure() }}
6 changes: 6 additions & 0 deletions deploy/dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,13 @@ services:
- MIX_ENV=dev
- AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY}
- AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID}
- MBTA_API_BASE_URL=${MBTA_API_BASE_URL}
- MBTA_API_KEY=${MBTA_API_KEY}
- PORT=4002
- REDIS_HOST=10.0.0.11
- REDIS_PORT=6379
- WEBPACK_PORT=8092
- WARM_CACHES=false
expose:
- 4002
ports:
Expand Down Expand Up @@ -66,10 +69,13 @@ services:
- MIX_ENV=dev
- AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY}
- AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID}
- MBTA_API_BASE_URL=${MBTA_API_BASE_URL}
- MBTA_API_KEY=${MBTA_API_KEY}
- PORT=4003
- REDIS_HOST=10.0.0.11
- REDIS_PORT=6379
- WEBPACK_PORT=8093
- WARM_CACHES=false
expose:
- 4003
ports:
Expand Down
15 changes: 8 additions & 7 deletions deploy/dotcom/dev/1/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,15 @@ RUN apt-get install -y nodejs

WORKDIR /app

COPY mix.exs .
COPY mix.lock .
COPY package.json .
COPY assets/package.json ./assets/package.json
COPY . .

RUN mix local.hex --force
RUN mix local.rebar --force

RUN mix deps.get
RUN npm --prefix assets install --package-lock-only --ignore-scripts --no-save --audit false --fund false --loglevel verbose
CMD elixir --sname dotcom1 --cookie foobarbaz -S mix phx.server
EXPOSE 4001

CMD mix deps.get \
&& npm ci \
&& npm --prefix assets run webpack:build:react \
&& mix phx.digest \
&& elixir --sname dotcom1 --cookie foobarbaz -S mix phx.server
4 changes: 2 additions & 2 deletions deploy/dotcom/dev/2/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ WORKDIR /app

COPY mix.exs .
COPY mix.lock .
RUN mix deps.get
CMD elixir --sname dotcom2 --cookie foobarbaz -S mix phx.server
CMD mix deps.get \
&& elixir --sname dotcom2 --cookie foobarbaz -S mix phx.server
63 changes: 63 additions & 0 deletions deploy/local.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
services:
redis:
image: grokzen/redis-cluster
network_mode: host
environment:
- INITIAL_PORT=30001
- REDIS_CLUSTER_IP=0.0.0.0
- IP=0.0.0.0
healthcheck:
test: ["CMD", "redis-cli", "-p", "30001", "ping"]
interval: 5s
timeout: 5s
retries: 5
start_period: 5s
volumes:
- ../:/app
dotcom:
network_mode: host
depends_on:
redis:
condition: service_started
build:
context: ../
dockerfile: ./deploy/dotcom/dev/1/Dockerfile
environment:
- MIX_ENV=dev
- CMS_API_BASE_URL=https://live-mbta.pantheonsite.io
- OPEN_TRIP_PLANNER_URL=http://otp2-local.mbtace.com
- AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY}
- AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID}
- MBTA_API_BASE_URL=${MBTA_API_BASE_URL}
- MBTA_API_KEY=${MBTA_API_KEY}
- PORT=4001
- WEBPACK_PORT=8092
- WARM_CACHES=false
- REDIS_HOST=localhost
- REDIS_PORT=30001
expose:
- 4001
healthcheck:
test: curl --fail http://localhost:4001/_health || exit 1
interval: 60s
retries: 20
start_period: 240s
timeout: 60s
volumes:
- ../:/app
a11y-test:
image: mcr.microsoft.com/playwright:v1.42.1-jammy
healthcheck:
disable: true
depends_on:
dotcom:
condition: service_healthy
volumes:
- ../:/app
working_dir: /app
entrypoint: /bin/sh
command: -c "npx playwright test axe"
network_mode: host
environment:
- CI=true
- PLAYWRIGHT_HTML_OPEN=never
Loading
Loading