mirror of
https://github.com/django/django.git
synced 2024-12-23 01:25:58 +00:00
add test with demo
This commit is contained in:
parent
bd69bd6ab6
commit
7e94800422
17
.github/workflows/accessibility.yml
vendored
17
.github/workflows/accessibility.yml
vendored
@ -28,7 +28,12 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
repository: knyghty/django-admin-demo
|
||||
path: demo
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v4
|
||||
with:
|
||||
@ -37,17 +42,15 @@ jobs:
|
||||
with:
|
||||
node-version: "16"
|
||||
- name: Install Requirements
|
||||
run: python -m pip install .
|
||||
run: pip install -r demo/requirements.txt
|
||||
- name: Cache Django
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: Django/*
|
||||
key: Django
|
||||
- name: Create dummy app
|
||||
run: |
|
||||
django-admin startproject allyapp
|
||||
python allyapp/manage.py migrate
|
||||
- name: Launch migrations
|
||||
run: python demo/manage.py migrate
|
||||
- name: Install pa11y
|
||||
run: npm install -g pa11y
|
||||
- name: Run the project and pa11y
|
||||
run: python allyapp/manage.py runserver & (sleep 10 && pa11y http://127.0.0.1:8000/ --runner axe)
|
||||
run: python demo/manage.py runserver & (sleep 10 && pa11y http://127.0.0.1:8000/ --runner axe --include-warnings)
|
||||
|
@ -1,9 +0,0 @@
|
||||
{
|
||||
"defaults": {
|
||||
"timeout": 10000
|
||||
},
|
||||
"urls": [
|
||||
"http://127.0.0.1:8000/",
|
||||
"http://127.0.0.1:8000/admin/"
|
||||
]
|
||||
}
|
9
.pa11yci
9
.pa11yci
@ -1,9 +0,0 @@
|
||||
{
|
||||
"defaults": {
|
||||
"timeout": 10000
|
||||
},
|
||||
"urls": [
|
||||
"http://127.0.0.1:8000/",
|
||||
"http://127.0.0.1:8000/admin/"
|
||||
]
|
||||
}
|
46
js_tests/admin/pa11y.test.js
Normal file
46
js_tests/admin/pa11y.test.js
Normal file
@ -0,0 +1,46 @@
|
||||
// An example of executing some actions before Pa11y runs.
|
||||
// This example logs in to a fictional site then waits
|
||||
// until the account page has loaded before running Pa11y
|
||||
'use strict';
|
||||
|
||||
const pa11y = require('../..');
|
||||
|
||||
runExample();
|
||||
|
||||
async function runExample() {
|
||||
try {
|
||||
|
||||
const options = {
|
||||
actions: [
|
||||
'set field #username to admin',
|
||||
'set field #password to correcthorsebatterystaple',
|
||||
'click element #submit',
|
||||
'wait for url to be http://127.0.0.1:8000/admin/'
|
||||
],
|
||||
|
||||
log: {
|
||||
debug: console.log,
|
||||
error: console.error,
|
||||
info: console.log
|
||||
}
|
||||
};
|
||||
|
||||
const results = await Promise.all([
|
||||
pa11y('http://127.0.0.1:8000/en/admin/', options),
|
||||
pa11y('http://127.0.0.1:8000/en/admin/demo/artist/', options),
|
||||
pa11y('http://127.0.0.1:8000/en/admin/demo/artist/7zX2wRWDKLiW2V5QlI4QXU/change/', options),
|
||||
pa11y('http://127.0.0.1:8000/en/admin/demo/release/', options),
|
||||
pa11y('http://127.0.0.1:8000/en/admin/demo/release/7xxg6PunBVeuTliClh4H5p/change/', options)
|
||||
]);
|
||||
|
||||
|
||||
// Output the raw result object
|
||||
results.forEach(result => {
|
||||
console.log(result);
|
||||
})
|
||||
|
||||
} catch (error) {
|
||||
// Output an error if it occurred
|
||||
console.error(error.message);
|
||||
}
|
||||
}
|
14
pa11y.json
Normal file
14
pa11y.json
Normal file
@ -0,0 +1,14 @@
|
||||
{
|
||||
"defaults": {
|
||||
"timeout": 10000
|
||||
},
|
||||
"urls": [
|
||||
"http://127.0.0.1:8000/",
|
||||
"http://127.0.0.1:8000/admin/",
|
||||
"http://127.0.0.1:8000/admin/demo/artist/",
|
||||
"http://127.0.0.1:8000/admin/demo/artist/7zX2wRWDKLiW2V5QlI4QXU/change/",
|
||||
"http://127.0.0.1:8000/admin/demo/release/",
|
||||
"http://127.0.0.1:8000/admin/demo/release/7xxg6PunBVeuTliClh4H5p/change/"
|
||||
|
||||
]
|
||||
}
|
Loading…
Reference in New Issue
Block a user