-
Notifications
You must be signed in to change notification settings - Fork 191
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
Fix axe accessibility test violations compare #483
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see the snapshot test is failing when i ran it today. Also i see "Error processing consolidated log file: [Errno 2] No such file or directory: 'log/consolidated_log.txt'"
- ID: region, Impact: moderate, Description: Ensures all page content is contained by landmarks
2024-10-28 08:32:03.864 | ERROR | /tests/test_accessibility.py::test_accessibility | FAIL: Accessibility checks for main page failed
New violations found on redirect:
- ID: region, Impact: moderate, Description: Ensures all page content is contained by landmarks
2024-10-28 08:32:06.863 | ERROR | /tests/test_accessibility.py::test_accessibility | FAIL: Accessibility checks for redirect failed
New violations found on contact page:
- ID: region, Impact: moderate, Description: Ensures all page content is contained by landmarks
2024-10-28 08:32:10.456 | ERROR | /tests/test_accessibility.py::test_accessibility | FAIL: Accessibility checks for contact page failed
2024-10-28 08:32:10.461 | INFO | /tests/test_accessibility.py::test_accessibility |
************************
--------RESULT--------
Total number of checks=3
2024-10-28 08:32:10.466 | INFO | /tests/test_accessibility.py::test_accessibility | Total number of checks passed=0
----------------------
************************
2024-10-28 08:32:10.473 | INFO | /tests/test_accessibility.py::test_accessibility | Total number of mini-checks=0
2024-10-28 08:32:10.478 | INFO | /tests/test_accessibility.py::test_accessibility | Total number of mini-checks passed=0
2024-10-28 08:32:10.483 | ERROR | /tests/test_accessibility.py::test_accessibility |
--------FAILURE SUMMARY--------
2024-10-28 08:32:10.487 | ERROR | /tests/test_accessibility.py::test_accessibility | FAIL: Accessibility checks for main page failed
2024-10-28 08:32:10.490 | ERROR | /tests/test_accessibility.py::test_accessibility | FAIL: Accessibility checks for redirect failed
2024-10-28 08:32:10.494 | ERROR | /tests/test_accessibility.py::test_accessibility | FAIL: Accessibility checks for contact page failed
FAILED2024-10-28 08:32:13.507 | INFO | /conftest.py::test_obj | *************************
Error processing consolidated log file: [Errno 2] No such file or directory: 'log/consolidated_log.txt'
======================================================================================= FAILURES =======================================================================================
______________________________________________________________________________ test_accessibility[chrome] ______________________________________________________________________________
test_accessibility.py:87: in test_accessibility
assert expected_pass == actual_pass, f"Test failed: {__file__}"
E AssertionError: Test failed: /home/avinash/qxf2/qxf2_pom/qxf2-page-object-model/tests/test_accessibility.py
E assert 3 == 0
saved_snapshot = snapshot_util.load_snapshot(snapshot_file) | ||
|
||
# If snapshot does not exist, create a new one | ||
if saved_snapshot is None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably we need to discuss this. Do we need to save snapshot if there is no snapshot?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mohanqxf2
*I don't see the new snapshots, unless we have new snapshot the tests will continue to fail
- As discussed yesterday we don't need to save snapshot if there are no snapshot existing. You can print a message in load snapshot if file not found create a snapshot by running some command
- As discussed we don't see the reason of failure of the accessibility tests, we need that info
- I see you using print statements, can we write the stuff inside log_result?
- I see an error after test run "Error processing consolidated log file: [Errno 2] No such file or directory: 'log/consolidated_log.txt'"
- Can you figure out cleaner way to implement this using log result
cleaned_result = json.dumps(violations, ensure_ascii=False, separators=(',', ':'))
cleaned_snapshot = json.dumps(saved_snapshot, ensure_ascii=False, separators=(',', ':'))
# Check if there are new violations
new_violations = snapshot_util.find_new_violations(violations, saved_snapshot)
if new_violations:
print(f"New violations found on {page}:")
for violation in new_violations:
print(
f"- ID: {violation['id']}, "
f"Impact: {violation['impact']}, "
f"Description: {violation['description']}"
)
# Snapshot comparison
snapshot_result = cleaned_result == cleaned_snapshot
I have updated the following to the test_accessibility.py script:
To run under tests/ dir:
python -m pytest test_accessibility.py