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

Sdss 000 add a11y testing #130

Draft
wants to merge 23 commits into
base: 4.x
Choose a base branch
from
Draft
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
74 changes: 74 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,80 @@ jobs:
with:
name: functional-tests-results
path: artifacts
frontend:
name: Frontend Tests
runs-on: ubuntu-latest
env:
DRUPAL_DATABASE_NAME: drupal
DRUPAL_DATABASE_USERNAME: drupal
DRUPAL_DATABASE_PASSWORD: drupal
DRUPAL_DATABASE_HOST: mysql
container:
image: pookmish/drupal8ci:latest
options: '--network-alias drupal8ci'
services:
# selenium:
# image: selenium/standalone-chrome
# options: '--shm-size="2g"'
mysql:
image: mysql:5.7
env:
MYSQL_DATABASE: drupal
MYSQL_USER: drupal
MYSQL_PASSWORD: drupal
MYSQL_ROOT_PASSWORD: drupal
ports:
- 33306:3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
steps:
- uses: actions/checkout@v3
- name: Restore Cache
uses: actions/cache@v3
with:
path: |
vendor
docroot/core
docroot/libraries
docroot/modules/contrib
docroot/modules/custom
key: 2.x-${{ hashFiles('composer.json') }}-${{ hashFiles('composer.lock') }}
restore-keys: |
2.x-${{ hashFiles('composer.json') }}-${{ hashFiles('composer.lock') }}
2.x-${{ hashFiles('composer.json') }}-
2.x-
- name: Add sudo and required libraries for pa11y
run: |
apt update && apt install sudo
sudo apt-get install -y chromium libxkbcommon-x11-0 libxdamage1 libgtk-3-0 libgbm-dev
- name: Setup NodeJS for sdss_subtheme
uses: actions/setup-node@v3
with:
node-version-file: docroot/profiles/sdss/sdss_profile/themes/sdss_subtheme/.nvmrc
check-latest: false
- name: Set up npm in sdss_subtheme
working-directory: ./docroot/profiles/sdss/sdss_profile/themes/sdss_subtheme
run: npm install
- name: Install Site
run: |
rm -rf /var/www/html
ln -snf $GITHUB_WORKSPACE /var/www/html
apachectl stop
apachectl start
composer install -n
blt blt:telemetry:disable --no-interaction
blt drupal:install -n
drush pm:uninstall simplesamlphp_auth -y
drush role:perm:add anonymous 'access content'
drush xmlsitemap:rebuild
mkdir -p artifacts/_data/
- name: Run tests
run: blt tests:frontend:run --no-interaction
- name: Save Test Results
uses: actions/upload-artifact@v3
if: always()
with:
name: frontend-tests-results
path: docroot/profiles/sdss/sdss_profile/themes/sdss_subtheme/test-results

# Cancel previous runs of this workflow in the same branch if they're still in
# progress.
Expand Down
4 changes: 4 additions & 0 deletions blt/blt.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,10 @@ tests:
- acceptance
- functional
directory: '${docroot}/profiles/sdss/sdss_profile/tests/codeception'
command-hooks:
frontend-test:
dir: '${repo.root}/docroot/profiles/sdss/sdss_profile/themes/sdss_subtheme'
command: 'yarn a11y-tests'
validate:
twig:
functions:
Expand Down
3 changes: 3 additions & 0 deletions docroot/profiles/sdss/sdss_profile/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -115,3 +115,6 @@ npm-debug.log

# Deprecation detector rules
.rules

# Test results
themes/*/test-results
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/**
* @file
* Pa11y config.
*/

const isCI = process.env.CI;
const baseURL = isCI ? 'http://localhost/' : 'http://ace-sdssgryphon.test';

// Add urls for a11y testing here.
const urls = [
'/',
'/about',
'/news',
'/people',
];

module.exports = {
defaults: {
standard: 'WCAG2AA',
hideElements: ['svg'],
ignore: ['notice', 'warning'],
chromeLaunchConfig: {
args: ['--no-sandbox']
},
reporters: [
'cli',
['json', { "fileName": "./test-results/a11y-test-results.json" }]
]
},
urls: urls.map(url => `${baseURL}${url}`)
};
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
"main": "webpack.config.js",
"scripts": {
"watch": "NODE_ENV=production webpack --watch",
"build": "NODE_ENV=production webpack"
"build": "NODE_ENV=production webpack",
"a11y-tests": "pa11y-ci"
},
"author": "",
"license": "ISC",
Expand All @@ -26,6 +27,7 @@
"mini-css-extract-plugin": "^2.7.6",
"node-sass": "^9.0.0",
"optimize-css-assets-webpack-plugin": "^6.0.1",
"pa11y-ci": "^3.0.1",
"postcss-loader": "^7.3.2",
"postcss-preset-env": "^9.1.4",
"sass-loader": "^13.3.1",
Expand Down
Loading