generated from cfpb/open-source-project-template
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Snapshot testing] Improve test consistency (#1103)
Closes #1099 I explored a few options to reduce the flakiness of our snapshot tests and the approach implemented in this PR seems to provide the most reliable result with sensible tradeoffs. Local test runs in `headless` mode have passed 100%, 6x in a row, with 4 workers. Snapshot testing via the UI can still be rather flaky but, since tests pass consistently in `headless` mode, my interpretation is that UI failures are due to excessive system resource consumption by the Playwright UI causing inconsistent page rendering results. ## Changes - Reduced the suite-wide config's `maxDiffPixels` from `25` to `0`, allowing us to catch even the smallest unexpected UI change - Added `snapshotModifications.css` to apply snapshot-testing-specific style modifications. This approach allows us to replace `dotted` borders with `solid` borders on all links to ensure consistent rendering. Since the `dotted` style comes from the CFPB Design System, it does not seem necessary to verify it's implementation as part of our app (though it would certainly be preferred that these tests validate exactly what the user is expected to see). - Added the page header's USA flag to the suite-wide `mask (ignore)` list. This element tends to trigger false-positives on tests with very tall screenshots and, since it's implementation comes from the Design System, does not seem to be something we need to validate as part of our app. As a next step, we could break these taller pages down into smaller tests of subsections of the page, but for now this workaround seems acceptable. - <img width="528" alt="Screenshot 2025-01-09 at 11 36 49 AM" src="https://github.com/user-attachments/assets/818d0c96-699c-4aa7-a43d-ba5aba3031a0" /> ## How to test this PR 1. Checkout this branch and `yarn start` 1. `yarn test:e2e:snapshot --headless` 2. Ensure all tests pass ## Notes - Alternate approaches not chosen - I did experiment with masking the entire page footer, since that was the most frequent trigger of failures due to dotted border issues, but still encountered failures due to links within the page content, so that didn't feel like the most helpful approach. - I considered breaking full-page tests into smaller element tests, but found that with the masking of `.u-usa-flag` and modifying the link border style, we were able to avoid the effort needed to significantly refactor how these tests are implemented. ## Screenshots ![screencapture-localhost-9323-2025-01-09-11_33_55](https://github.com/user-attachments/assets/be36de36-78b5-4bd4-a16d-ff2b2f60c14f)
- Loading branch information
Showing
68 changed files
with
22 additions
and
5 deletions.
There are no files selected for viewing
Binary file modified
BIN
-768 Bytes
(100%)
...User-Profile-Checking-for-form-errors-based-on-user-input-1-chromium-darwin.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-831 Bytes
(100%)
...User-Profile-Checking-for-form-errors-based-on-user-input-2-chromium-darwin.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-760 Bytes
(100%)
...te-the-User-Profile-Checking-for-input-length-restriction-1-chromium-darwin.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-885 Bytes
(100%)
...te-the-User-Profile-Checking-for-input-length-restriction-2-chromium-darwin.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-1.26 KB
(100%)
...t-of-Contact-Checking-for-form-errors-based-on-user-input-1-chromium-darwin.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-929 Bytes
(100%)
...t-of-Contact-Checking-for-form-errors-based-on-user-input-2-chromium-darwin.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-1.94 KB
(100%)
...ontact-Checking-for-unicode-tolerance-based-on-user-input-1-chromium-darwin.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-921 Bytes
(100%)
...ontact-Checking-for-unicode-tolerance-based-on-user-input-2-chromium-darwin.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-762 Bytes
(100%)
...sLogic.spec.ts-snapshots/Filing-step-routing-Errors-Logic-1-chromium-darwin.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-742 Bytes
(100%)
...yntax.spec.ts-snapshots/Filing-step-routing-Errors-Syntax-1-chromium-darwin.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-854 Bytes
(100%)
...ing/noUpload.spec.ts-snapshots/Filing-step-routing-Upload-1-chromium-darwin.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-870 Bytes
(100%)
...ct.spec.ts-snapshots/Filing-step-routing-Point-of-Contact-1-chromium-darwin.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-792 Bytes
(100%)
...g/warnings.spec.ts-snapshots/Filing-step-routing-Warnings-1-chromium-darwin.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-768 Bytes
(100%)
...pages/filing-app/formAlerts.spec.ts-snapshots/Form-Alerts-1-chromium-darwin.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-895 Bytes
(100%)
...ages/filing-app/formAlerts.spec.ts-snapshots/Form-Alerts-10-chromium-darwin.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-913 Bytes
(99%)
...ages/filing-app/formAlerts.spec.ts-snapshots/Form-Alerts-11-chromium-darwin.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-697 Bytes
(100%)
...ages/filing-app/formAlerts.spec.ts-snapshots/Form-Alerts-12-chromium-darwin.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-830 Bytes
(100%)
...ages/filing-app/formAlerts.spec.ts-snapshots/Form-Alerts-13-chromium-darwin.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-1.06 KB
(100%)
...ages/filing-app/formAlerts.spec.ts-snapshots/Form-Alerts-14-chromium-darwin.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-1.04 KB
(100%)
...ages/filing-app/formAlerts.spec.ts-snapshots/Form-Alerts-15-chromium-darwin.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-1001 Bytes
(100%)
...ages/filing-app/formAlerts.spec.ts-snapshots/Form-Alerts-16-chromium-darwin.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-1.02 KB
(100%)
...ages/filing-app/formAlerts.spec.ts-snapshots/Form-Alerts-17-chromium-darwin.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-713 Bytes
(100%)
...pages/filing-app/formAlerts.spec.ts-snapshots/Form-Alerts-2-chromium-darwin.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-865 Bytes
(100%)
...pages/filing-app/formAlerts.spec.ts-snapshots/Form-Alerts-3-chromium-darwin.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-941 Bytes
(100%)
...pages/filing-app/formAlerts.spec.ts-snapshots/Form-Alerts-4-chromium-darwin.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-1015 Bytes
(100%)
...pages/filing-app/formAlerts.spec.ts-snapshots/Form-Alerts-5-chromium-darwin.png
Oops, something went wrong.
Binary file modified
BIN
-950 Bytes
(100%)
...pages/filing-app/formAlerts.spec.ts-snapshots/Form-Alerts-6-chromium-darwin.png
Oops, something went wrong.
Binary file modified
BIN
-895 Bytes
(100%)
...pages/filing-app/formAlerts.spec.ts-snapshots/Form-Alerts-7-chromium-darwin.png
Oops, something went wrong.
Binary file modified
BIN
-964 Bytes
(100%)
...pages/filing-app/formAlerts.spec.ts-snapshots/Form-Alerts-8-chromium-darwin.png
Oops, something went wrong.
Binary file modified
BIN
-972 Bytes
(100%)
...pages/filing-app/formAlerts.spec.ts-snapshots/Form-Alerts-9-chromium-darwin.png
Oops, something went wrong.
Binary file modified
BIN
+74.3 KB
(110%)
...s/Sign-and-submit-complete-filing-flow-with-only-warnings-1-chromium-darwin.png
Oops, something went wrong.
Binary file modified
BIN
-765 Bytes
(99%)
...s.spec.ts-snapshots/Blocking-API-Calls---Error-Boundaries-1-chromium-darwin.png
Oops, something went wrong.
Binary file modified
BIN
-744 Bytes
(99%)
...s.spec.ts-snapshots/Blocking-API-Calls---Error-Boundaries-2-chromium-darwin.png
Oops, something went wrong.
Binary file modified
BIN
-678 Bytes
(100%)
...s.spec.ts-snapshots/Blocking-API-Calls---Error-Boundaries-3-chromium-darwin.png
Oops, something went wrong.
Binary file modified
BIN
-830 Bytes
(100%)
...s.spec.ts-snapshots/Blocking-API-Calls---Error-Boundaries-4-chromium-darwin.png
Oops, something went wrong.
Binary file modified
BIN
-776 Bytes
(99%)
...s.spec.ts-snapshots/Blocking-API-Calls---Error-Boundaries-5-chromium-darwin.png
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file modified
BIN
-762 Bytes
(100%)
...eUploadLogicErrors.spec.ts-snapshots/Resolve-Errors-Logic-1-chromium-darwin.png
Oops, something went wrong.
Binary file modified
BIN
-876 Bytes
(100%)
...eUploadLogicErrors.spec.ts-snapshots/Resolve-Errors-Logic-2-chromium-darwin.png
Oops, something went wrong.
Binary file modified
BIN
-884 Bytes
(100%)
...eUploadLogicErrors.spec.ts-snapshots/Resolve-Errors-Logic-3-chromium-darwin.png
Oops, something went wrong.
Binary file modified
BIN
-882 Bytes
(100%)
...eUploadLogicErrors.spec.ts-snapshots/Resolve-Errors-Logic-4-chromium-darwin.png
Oops, something went wrong.
Binary file modified
BIN
-882 Bytes
(100%)
...eUploadLogicErrors.spec.ts-snapshots/Resolve-Errors-Logic-5-chromium-darwin.png
Oops, something went wrong.
Binary file modified
BIN
-882 Bytes
(100%)
...eUploadLogicErrors.spec.ts-snapshots/Resolve-Errors-Logic-6-chromium-darwin.png
Oops, something went wrong.
Binary file modified
BIN
-941 Bytes
(100%)
...ploadSyntaxErrors.spec.ts-snapshots/Resolve-Errors-Syntax-1-chromium-darwin.png
Oops, something went wrong.
Binary file modified
BIN
-1007 Bytes
(100%)
...itutionProfile.spec.ts-snapshots/Institution-Profile-Page-1-chromium-darwin.png
Oops, something went wrong.
Binary file modified
BIN
-845 Bytes
(100%)
...-lending-platform/Navigation.spec.ts-snapshots/Navigation-1-chromium-darwin.png
Oops, something went wrong.
Binary file modified
BIN
-587 Bytes
(100%)
...-lending-platform/Navigation.spec.ts-snapshots/Navigation-2-chromium-darwin.png
Oops, something went wrong.
Binary file modified
BIN
-891 Bytes
(99%)
...-lending-platform/Navigation.spec.ts-snapshots/Navigation-3-chromium-darwin.png
Oops, something went wrong.
Binary file modified
BIN
-1007 Bytes
(100%)
...-lending-platform/Navigation.spec.ts-snapshots/Navigation-4-chromium-darwin.png
Oops, something went wrong.
Binary file modified
BIN
-982 Bytes
(100%)
...-lending-platform/Navigation.spec.ts-snapshots/Navigation-5-chromium-darwin.png
Oops, something went wrong.
Binary file modified
BIN
-986 Bytes
(100%)
...-lending-platform/Navigation.spec.ts-snapshots/Navigation-6-chromium-darwin.png
Oops, something went wrong.
Binary file modified
BIN
-424 Bytes
(100%)
...shots/Complete-User-Profile----No-Associations----process-1-chromium-darwin.png
Oops, something went wrong.
Binary file modified
BIN
-602 Bytes
(100%)
...shots/Complete-User-Profile----No-Associations----process-2-chromium-darwin.png
Oops, something went wrong.
Binary file modified
BIN
-996 Bytes
(100%)
...er-Profile-with-Bad-Unicode----No-Associations----process-1-chromium-darwin.png
Oops, something went wrong.
Binary file modified
BIN
-1007 Bytes
(100%)
...Profile.spec.ts-snapshots/Update-Institution-Profile-Page-1-chromium-darwin.png
Oops, something went wrong.
Binary file modified
BIN
-982 Bytes
(100%)
...Profile.spec.ts-snapshots/Update-Institution-Profile-Page-2-chromium-darwin.png
Oops, something went wrong.
Binary file modified
BIN
-905 Bytes
(100%)
...Profile.spec.ts-snapshots/Update-Institution-Profile-Page-3-chromium-darwin.png
Oops, something went wrong.
Binary file modified
BIN
-980 Bytes
(100%)
...Profile.spec.ts-snapshots/Update-Institution-Profile-Page-4-chromium-darwin.png
Oops, something went wrong.
Binary file modified
BIN
-662 Bytes
(99%)
...Profile.spec.ts-snapshots/Update-Institution-Profile-Page-5-chromium-darwin.png
Oops, something went wrong.
Binary file modified
BIN
-852 Bytes
(100%)
...ts/Update-Institution-Profile-Page-Check-Character-Limits-1-chromium-darwin.png
Oops, something went wrong.
Binary file modified
BIN
-937 Bytes
(99%)
...-platform/UserProfile.spec.ts-snapshots/User-Profile-Page-1-chromium-darwin.png
Oops, something went wrong.
Binary file modified
BIN
-760 Bytes
(99%)
...ticated-homepage-Registering-with-an-invalid-email-domain-1-chromium-darwin.png
Oops, something went wrong.
Binary file modified
BIN
-986 Bytes
(100%)
...napshots/Unauthenticated-homepage-Paperwork-Reduction-Act-1-chromium-darwin.png
Oops, something went wrong.
Binary file modified
BIN
-949 Bytes
(100%)
...spec.ts-snapshots/Unauthenticated-homepage-Privacy-Notice-1-chromium-darwin.png
Oops, something went wrong.
Binary file modified
BIN
-763 Bytes
(99%)
...spec.ts-snapshots/Unauthenticated-homepage-Privacy-Notice-2-chromium-darwin.png
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
a { | ||
/* | ||
Dotted borders are inconsistently rendered, causing test flake. | ||
Since this is a border style defined in the CFPB Design System, | ||
we should be safe not validating this styling as part of our app testing. | ||
*/ | ||
border-style: solid; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters