From dfea3ac84880bebae70f51ba07c02807d2a631cd Mon Sep 17 00:00:00 2001 From: Ryan Ahearn Date: Tue, 30 Aug 2022 10:31:48 -0400 Subject: [PATCH] Install pa11y-ci --- .github/workflows/checks.yml | 14 ++++++++++++++ .pa11yci | 9 +++++++++ Makefile | 5 +++++ README.md | 9 ++++++++- app/config.py | 2 +- 5 files changed, 37 insertions(+), 2 deletions(-) create mode 100644 .pa11yci diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index 284d1e9ef..93fdb3553 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -81,3 +81,17 @@ jobs: allow_issue_writing: false rules_file_name: 'zap.conf' cmd_options: '-I' + + a11y-scan: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: ./.github/actions/setup-project + - name: Run server + run: make run-flask & + env: + NOTIFY_ENVIRONMENT: scanning + - name: Install pa11y-ci + run: npm install -g pa11y-ci + - name: Run pa11y-ci + run: pa11y-ci diff --git a/.pa11yci b/.pa11yci new file mode 100644 index 000000000..2772199ad --- /dev/null +++ b/.pa11yci @@ -0,0 +1,9 @@ +{ + "defaults": { + "standard": "WCAG2AA", + "runners": ["axe"] + }, + "urls": [ + "http://localhost:6012" + ] +} diff --git a/Makefile b/Makefile index d5e25790a..5e0975132 100644 --- a/Makefile +++ b/Makefile @@ -86,6 +86,11 @@ static-scan: pip install bandit bandit -r app/ +.PHONY: a11y-scan +a11y-scan: + npm install -g pa11y-ci + pa11y-ci + .PHONY: clean clean: rm -rf node_modules cache target ${CF_MANIFEST_PATH} diff --git a/README.md b/README.md index 6a1738eea..bab71b632 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ Open the notifications-admin repo in VS Code (File->Open Folder, select notifica create a .env file as detailed in the .env Setup section below -Using VS Code's command pallette (cmd+shift+p), search "Remote Containers: Open folder in Container..." +Using VS Code's command pallette (cmd+shift+p), search "Remote Containers: Open folder in Container..." choose devcontainer-admin folder (note: this is a subfolder of notifications-admin/). This will open a new window, closing the current one in the process. After the new window loads, hit "show logs" link in the bottom-right. If this is the first build it will take a few minutes to create the image. The process completes shortly after running gulp.js and compiling front-end files. @@ -52,6 +52,13 @@ npm run test-watch To run a specific JavaScript test, you'll need to copy the full command from `package.json`. +## Running a11y-scans locally + +Unlike most of the tests and scans, pa11y-ci cannot currently be run from within the VSCode dev container. + +1. Run `make run-flask` from within the devcontainer +2. Run `make a11y-scan` from your host computer. + ## Further docs [STILL UK DOCS] - [Working with static assets](docs/static-assets.md) diff --git a/app/config.py b/app/config.py index 5844957c3..9bdde1f6b 100644 --- a/app/config.py +++ b/app/config.py @@ -102,7 +102,7 @@ class Config(object): class Development(Config): ADMIN_BASE_URL = 'http://localhost:6012' - BASIC_AUTH_FORCE = True + BASIC_AUTH_FORCE = False NOTIFY_LOG_PATH = 'application.log' DEBUG = True SESSION_COOKIE_SECURE = False