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

Refactor Accessibility Testing #3814

Merged
merged 33 commits into from
May 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
ce0d153
A11y - Install Cypress Axe, new test file
jperson1 May 9, 2024
b1513f2
A11y - Allow SAC/home access if DISABLE_AUTH =true
jperson1 May 9, 2024
e28d1fa
A11y - load_fixtures for new SACs, dummy dissem
jperson1 May 9, 2024
9968813
Linting, remove unused file.
jperson1 May 9, 2024
92b0d3f
A11y - HTML and SCSS changes for accessibility
jperson1 May 9, 2024
45870c3
A11y - Docs update for new workflow
jperson1 May 9, 2024
45b190c
Add accessibility tests to testing-from-ghcr.yml
jperson1 May 9, 2024
376e7a7
Cypress - Update report upload page input ids
jperson1 May 9, 2024
f55afe7
Lint - Unused imports
jperson1 May 9, 2024
04ee30c
Lint - Various black changes, not a11y related
jperson1 May 9, 2024
6fee8c6
Lint - Reformat new cypress files
jperson1 May 9, 2024
ab40b7b
Merge branch 'main' into jp/3618-refactor-accessibility-testing
jperson1 May 9, 2024
d3dc067
Re-linting - Whoops, wrong version of black
jperson1 May 9, 2024
1d00abb
GHA - upload screenshots, use dc-web, spaces
jperson1 May 9, 2024
85a767f
Testing with just a11y workflow
jperson1 May 9, 2024
ffbbfbf
Testing with a historical data load
jperson1 May 9, 2024
c150188
Try changing the operating user for permissions
jperson1 May 9, 2024
3b8a87b
A hail mary of sorts - user 1001 in docker compose
jperson1 May 9, 2024
2a30dd3
... Try user root on the a11y tests
jperson1 May 9, 2024
1964a70
... Try non-root user with specific cypress image
jperson1 May 9, 2024
801a306
Remove the user switch.
jperson1 May 9, 2024
8bdf9b9
Merge branch 'main' into jp/3618-refactor-accessibility-testing
jperson1 May 9, 2024
f838304
Once more: non-root user, node 18 cypress image
jperson1 May 9, 2024
9c62628
Attempt a11y tests in GHCR with node 20
jperson1 May 9, 2024
ee08855
Try root user on a11y runner
jperson1 May 9, 2024
d49be1e
Revert testing-from-gchr.yml changes
jperson1 May 14, 2024
5e58dff
Add `npm i` to testing doc.
jperson1 May 17, 2024
a736e10
Strike "TESTING" from e2e TSTDAT generator command
jperson1 May 17, 2024
33ef01d
Remove references to pa11y
jperson1 May 20, 2024
4b063e6
Remove references to lighthouse
jperson1 May 20, 2024
a4cb578
Include an a11y command in package.json
jperson1 May 20, 2024
adc8770
Remove a11y reference from staging deploy yml
jperson1 May 20, 2024
ecd9cfa
Merge branch 'main' into jp/3618-refactor-accessibility-testing
jperson1 May 23, 2024
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
98 changes: 49 additions & 49 deletions .github/workflows/staging-scheduled-deploy.yml
Original file line number Diff line number Diff line change
@@ -1,49 +1,49 @@
---
name: Scheduled Deploy From Main to Staging
on:
# schedule:
# Invoke every Mon-Sat
# - cron: '0 10 * * 1-6'
workflow_dispatch: null
jobs:
trivy-scan:
uses: ./.github/workflows/trivy.yml
secrets: inherit
permissions:
contents: read
packages: write
actions: read
security-events: write
build-container:
needs:
- trivy-scan
uses: ./.github/workflows/build-docker-container.yml
secrets: inherit
permissions:
contents: read
packages: write
with:
docker-name: fac
image-name: web-container
repo-name: gsa-tts/fac
work-dir: ./backend
testing:
name: Run Django, Lighthouse, a11y and lint
needs:
- build-container
uses: ./.github/workflows/testing-from-ghcr.yml
secrets: inherit
linting:
uses: ./.github/workflows/linting.yml
secrets: inherit
create-pr:
needs:
- testing
name: Create Pull Request to Staging
uses: ./.github/workflows/create-pull-request-to-staging.yml
secrets: inherit
---
name: Scheduled Deploy From Main to Staging
on:
# schedule:
# Invoke every Mon-Sat
# - cron: '0 10 * * 1-6'
workflow_dispatch: null

jobs:
trivy-scan:
uses: ./.github/workflows/trivy.yml
secrets: inherit
permissions:
contents: read
packages: write
actions: read
security-events: write

build-container:
needs:
- trivy-scan
uses: ./.github/workflows/build-docker-container.yml
secrets: inherit
permissions:
contents: read
packages: write
with:
docker-name: fac
image-name: web-container
repo-name: gsa-tts/fac
work-dir: ./backend

testing:
name: Run Django and lint
needs:
- build-container
uses: ./.github/workflows/testing-from-ghcr.yml
secrets: inherit

linting:
uses: ./.github/workflows/linting.yml
secrets: inherit

create-pr:
needs:
- testing
name: Create Pull Request to Staging
uses: ./.github/workflows/create-pull-request-to-staging.yml
secrets: inherit
6 changes: 2 additions & 4 deletions .github/workflows/testing-from-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,8 @@ jobs:
# run: |
# touch .env
# docker compose -f docker-compose.yml up -d
#
# - name: Run Lighthouse CI and pa11y
# - name: Run A11y tests
# working-directory: ./backend
# run: |
# sudo npm ci
# npm run test:a11y:lighthouse
# npm run test:a11y:pa11y
# npx cypress run --spec "cypress/e2e/accessibility.cy.js"
5 changes: 2 additions & 3 deletions .github/workflows/testing-from-ghcr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,8 @@ jobs:
# run: |
# touch .env
# docker compose -f docker-compose.yml up -d
# - name: Run Lighthouse CI and pa11y
# - name: Run A11y tests
# working-directory: ./backend
# run: |
# sudo npm ci
# npm run test:a11y:lighthouse
# npm run test:a11y:pa11y
# npx cypress run --spec "cypress/e2e/accessibility.cy.js"
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -166,8 +166,6 @@ node_modules/
backend/static/compiled
staticfiles/

# pa11y_tests/screenshots/*.png

# Things that folks might want to have in their local directories
# that don't need to be checked in
.local/
Expand Down
21 changes: 0 additions & 21 deletions .pa11yci

This file was deleted.

1 change: 0 additions & 1 deletion backend/.stylelintignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
**/uswds
static/compiled/**
.lighthouseci/**
38 changes: 38 additions & 0 deletions backend/audit/fixtures/dissemination.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
"""
Fixtures for dissemination models.
We want a few example submissions for testing front end accessibility.
"""

import logging
from model_bakery import baker
from dissemination.models import (
General,
FederalAward,
)

logger = logging.getLogger(__name__)

sac_info_without_findings = {
"auditee_name": "Test SAC - No findings",
"auditee_uei": "GSA_TESTDATA",
"audit_year": "2024",
"report_id": "2024-06-TSTDAT-0000000001",
}


def load_dissemination():
"""
Generate an example SAC with an accompanying award.
"""
logger.info("Creating example SACs for dissemination.")

report_id_no_findings = sac_info_without_findings.get("report_id", "")
sac_no_findings = General.objects.filter(
report_id=report_id_no_findings,
).first()
if sac_no_findings is None:
general_no_findings = baker.make(General, **sac_info_without_findings)
baker.make(FederalAward, report_id=general_no_findings)
logger.info("Created SAC example %s", report_id_no_findings)
else:
logger.info("SAC %s already exists, skipping.", report_id_no_findings)
23 changes: 19 additions & 4 deletions backend/audit/fixtures/single_audit_checklist.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,12 +119,13 @@ def fake_auditee_certification():
return data_step_1, data_step_2


def _create_sac(user, auditee_name):
def _create_sac(user, auditee_name, submission_status="in_progress"):
"""Create a single example SAC."""
SingleAuditChecklist = apps.get_model("audit.SingleAuditChecklist")
sac = SingleAuditChecklist.objects.create(
submitted_by=user,
general_information=_fake_general_information(auditee_name),
submission_status=submission_status,
)

Access = apps.get_model("audit.Access")
Expand All @@ -134,6 +135,18 @@ def _create_sac(user, auditee_name):
email=user.email,
role="editor",
)
Access.objects.create(
sac=sac,
user=user,
email=user.email,
role="certifying_auditor_contact",
)
Access.objects.create(
sac=sac,
user=user,
email=user.email,
role="certifying_auditee_contact",
)
logger.info("Created single audit checklist %s", sac)
return sac

Expand Down Expand Up @@ -193,9 +206,10 @@ def _post_create_federal_awards(this_sac, this_user):
SACS = [
{"auditee_name": "SAC in progress"},
{
"auditee_name": "Federal awards submitted",
"post_create_callable": _post_create_federal_awards,
"auditee_name": "SAC ready for certification",
"submission_status": "ready_for_certification",
},
{"auditee_name": "SAC fully submitted", "submission_status": "disseminated"},
]


Expand All @@ -205,12 +219,13 @@ def _load_single_audit_checklists_for_user(user):
SingleAuditChecklist = apps.get_model("audit.SingleAuditChecklist")
for item_info in SACS:
auditee_name = item_info["auditee_name"]
submission_status = item_info.get("submission_status", "in_progress")
sac = SingleAuditChecklist.objects.filter(
submitted_by=user, general_information__auditee_name=auditee_name
).first()
if sac is None:
# need to make this object
sac = _create_sac(user, auditee_name)
sac = _create_sac(user, auditee_name, submission_status)


def load_single_audit_checklists():
Expand Down
3 changes: 2 additions & 1 deletion backend/audit/management/commands/load_fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
load_single_audit_checklists,
load_single_audit_checklists_for_email_address,
)

from audit.fixtures.dissemination import load_dissemination
from users.fixtures import load_users

logger = logging.getLogger(__name__)
Expand All @@ -33,6 +33,7 @@ def handle(self, *args, **options):
if not options.get("email_addresses"):
load_users()
load_single_audit_checklists()
load_dissemination()
logger.info("All fixtures loaded.")
else:
# We assume each arg is an email address:
Expand Down
3 changes: 2 additions & 1 deletion backend/audit/mixins.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from django.http.request import HttpRequest
from django.http.response import HttpResponse
from django.core.exceptions import PermissionDenied
from django.conf import settings

from .models import Access, SingleAuditChecklist

Expand Down Expand Up @@ -50,7 +51,7 @@ def dispatch(self, request: HttpRequest, *args: Any, **kwargs: Any) -> HttpRespo

sac = SingleAuditChecklist.objects.get(report_id=kwargs["report_id"])

if not has_access(sac, request.user):
if not has_access(sac, request.user) and not settings.DISABLE_AUTH:
raise PermissionDenied(PERMISSION_DENIED_MESSAGE)
except SingleAuditChecklist.DoesNotExist:
raise PermissionDenied(PERMISSION_DENIED_MESSAGE)
Expand Down
4 changes: 2 additions & 2 deletions backend/audit/templates/audit/audit-info-form.html
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,7 @@ <h1 class="margin-top-6">Federal programs</h1>
<input id="dollar_threshold"
name="dollar_threshold"
class="usa-input usa-input--medium tablet:grid-col-2"
aria-label="Dollar threshold input"
min="1"
pattern="\d+"
required
Expand Down Expand Up @@ -305,8 +306,7 @@ <h1 class="margin-top-6">Federal programs</h1>
<button class="usa-button margin-top-2 margin-bottom-10"
id="continue"
name="continue">Save and continue to the next section</button>
<a class="usa-button usa-button--unstyled margin-left-2" id="cancel-audit-info-form-link" href="{% url 'audit:SubmissionProgress' report_id %}"
aria-controls="upload-cancel">Cancel</a>
<a class="usa-button usa-button--unstyled margin-left-2" id="cancel-audit-info-form-link" href="{% url 'audit:SubmissionProgress' report_id %}">Cancel</a>
</form>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
method="post">
{% csrf_token %}
<fieldset class="usa-fieldset">
<legend class="usa-legend usa-legend--large" id="auditee-certification">Auditee certification</legend>
<h3>Check the box next to each item confirm your report meets the requirements.</h3>
<h1 class="usa-legend usa-legend--large" id="auditee-certification">Auditee certification</h1>
<h2 class="font-sans-md">Check the box next to each item confirm your report meets the requirements.</h2>
<p class="text-base">You must check all boxes must be checked in order to certify your single audit.</p>
<div class="usa-checkbox margin-top-4">
<input id="has_no_PII"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
method="post">
{% csrf_token %}
<fieldset class="usa-fieldset">
<legend class="usa-legend usa-legend--large" id="auditor-certification">Auditor certification</legend>
<h3>Check the box next to each item confirm your report meets the requirements.</h3>
<h1 class="usa-legend usa-legend--large" id="auditor-certification">Auditor certification</h1>
<h2 class="font-sans-md">Check the box next to each item confirm your report meets the requirements.</h2>
<p class="text-base">You must check all boxes in order to certify your single audit.</p>
<div class="usa-checkbox margin-top-4">
<input id="is_OMB_limited"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,7 @@ <h3>No errors were found.</h3>
Proceed to certification
</a>
{% endif %}
<a class="usa-button usa-button--unstyled margin-left-2" id="cancel-cross-validation-results-link" href="{% url 'audit:SubmissionProgress' report_id %}"
aria-controls="upload-cancel">Cancel</a>
<a class="usa-button usa-button--unstyled margin-left-2" id="cancel-cross-validation-results-link" href="{% url 'audit:SubmissionProgress' report_id %}">Cancel</a>
</div>
</fieldset>
</form>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<form class="tablet:grid-col-8" id="cross-validation" method="post">
{% csrf_token %}
<fieldset class="usa-fieldset">
<legend class="usa-legend usa-legend--large" id="federal-awards">Pre-submission validation</legend>
<h1 class="usa-legend usa-legend--large" id="federal-awards">Pre-submission validation</h1>
<p class="margin-y-3">
Check your workbooks to confirm you entered your data correctly. This tool also cross-validates the workbooks against each other.
</p>
Expand All @@ -19,8 +19,7 @@
<div class="margin-top-6">
<button class="usa-button" id="begin-validation">Begin Validation</button>
<button class="usa-button" id="proceed-to-certification" disabled>Proceed to certification</button>
<a class="usa-button usa-button--unstyled margin-left-2" id="cancel-cross-validation-link" href="{% url 'audit:SubmissionProgress' report_id %}"
aria-controls="upload-cancel">Cancel</a>
<a class="usa-button usa-button--unstyled margin-left-2" id="cancel-cross-validation-link" href="{% url 'audit:SubmissionProgress' report_id %}">Cancel</a>
</div>
</fieldset>
</form>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<form class="tablet:grid-col-8" id="ready-for-certification" method="post">
{% csrf_token %}
<fieldset class="usa-fieldset">
<legend class="usa-legend usa-legend--large" id="federal-awards">Lock for certification</legend>
<h1 class="usa-legend usa-legend--large" id="federal-awards">Lock for certification</h1>
<p>
You are now ready to lock your single audit submission for auditee and auditor certification. Each must review and certify the documents before they can be submitted to the FAC.
</p>
Expand All @@ -20,8 +20,7 @@
<button class="usa-button margin-top-2" id="continue">Lock for certification</button>
<a id="cancel-lock-for-certification-link"
class="usa-button usa-button--unstyled margin-left-2"
href="{% url 'audit:SubmissionProgress' report_id %}"
aria-controls="form-cancel">Cancel</a>
href="{% url 'audit:SubmissionProgress' report_id %}">Cancel</a>
</fieldset>
</form>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,7 @@ <h1 id="role-management">Add Audit Editor</h1>
</fieldset>
<button class="usa-button margin-top-5" id="continue">Submit</button>
<a class="usa-button usa-button--unstyled margin-left-2"
href="{% url 'audit:ManageSubmission' report_id %}"
aria-controls="upload-cancel">Cancel</a>
href="{% url 'audit:ManageSubmission' report_id %}">Cancel</a>
</form>
</div>
</div>
Expand Down
Loading