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
DRAFT - WIP - POM for Search Page + Cypress tests #3574
Conversation
Terraform plan for meta No changes. Your infrastructure matches the configuration.
📝 Plan generated in Pull Request Checks #2838 |
Terraform plan for dev No changes. Your infrastructure matches the configuration.
📝 Plan generated in Pull Request Checks #2838 |
Minimum allowed coverage is Generated by 🐒 cobertura-action against 821be14 |
…ress-dpwnloadfile+addSumReport to searchPage.js+methods+searchTests
… modified searchPage.js
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.
The tests look great! One thing for now, and two notes for Soon™.
-
We should rename the
it
blocks, or break them into severalit
's. -
Documentation on running advanced search locally is lacking. A quick blurb on what the materialized view is and how to get it running/how it relates to search would be good. It's not terribly pertinent to this PR, however.
-
The report ID is something that will change with every run of these tests, so we'll want a good way to make sure the correct one gets pulled for use when we run these in the higher environments. Maybe an API call to grab the most recent test submissions report_id, or something like that.
…s in cypress test suite
…into ezpp/3485-pom-search
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.
🎉
Needs further revision based off questions/concerns not addressed here. |
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.
Per discussion with @eazapata23, this branch/PR is going to be restructured a bit before landing.
This PR is now tracked and will close by PR #3574 |
This PR is linked to #3485
This PR will close #3590
This PR will close #3591
In this PR:
downloadFile
for cypress and added it as a task incypress.config.js
support
in Cypress directory, in thecommands.js
file the linerequire(cypress-downloadfile)
was added.Cypress-downloadfile
was added topackage-lock.json
&package.json
search-tests.cy.js
to e2e, which has two tests 1) basic search test & 2) advance search testsearch_page_data
this holds all data for search parameters in one single json file vs before where I originally separated each field into it's own separate json files.page_objects
folder w/ filesearch-page.js
this holds all web elements for search page + summary report and method/functions for interacting with web element.gen-info
added toPage Objects
+ deleted oldgen-info
cypress test.login-gov.js
to include anif else
statement due to the fact that login.gov started to ask if you wanted to add your PIV card as an authentication, I added theif else
to skip this step.initialize-audit.js
to import from thepage_objects
folder.check-access.js
to thepage_objects
folder and deleted it from thesupport
folder.package-lock.json
&package.json
.How to test:
Pull this branch, now since we're using a plugin for cypress, we need to make sure to download it locally on our machine or the tests won't work for search. Make sure you're on the
backend
directory of the project and runnpm i --save-dev cypress-downloadfile
. Once installed, you should see in your IDE a new folder titleddownloads
appear in the cypress directory, it should appear just under cypress but before e2e.Run docker as you normally would and once docker is running on another tab run this command
docker compose exec web /bin/bash
this will get you into docker shell. After that, run this commandpython manage.py materialized_views --create
. (I had to do this since I didn't have materialized view and my search tests would fail but after running command they passed)Now in your terminal, enter your cypress env variables and run npx cypress open
Once cypress is open, run the
full-submission.cy.js
tests should pass may take one or two tries for them but once they are completed run the other test forsearch-tests.cy.js
-- SideNote: BEFORE running search tests, you'll notice that in your cypress downloads folder you won't have anything in there but AFTER running search tests, a
sf-sac-summary-report.xlsx
and/or asingle-audit-report.pdf
will show up, indicating that the download did work.Before Running Search Tests:
search-tests.cy.js
you should able to run a basic search that populates results, selecting a an audit from the table and viewing your summary report and downloading each document successfully.Screen.Recording.2024-04-04.at.12.31.18.PM.mov
After Running Search Tests:
The same applies for testing
advance search fields
but these are commented out for now since basic search returns results.You can also verify search results with dbeaver by checking in
Materialized Views
:PR checklist: submitters
main
into your branch shortly before creating the PR. (You should also be mergingmain
into your branch regularly during development.)git status | grep migrations
. If there are any results, you probably need to add them to the branch for the PR. Your PR should have only one new migration file for each of the component apps, except in rare circumstances; you may need to delete some and re-runpython manage.py makemigrations
to reduce the number to one. (Also, unless in exceptional circumstances, your PR should not delete any migration files.)PR checklist: reviewers
make docker-clean; make docker-first-run && docker compose up
; then rundocker compose exec web /bin/bash -c "python manage.py test"
The larger the PR, the stricter we should be about these points.