-
Notifications
You must be signed in to change notification settings - Fork 112
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
Cypress setup #2221
base: master
Are you sure you want to change the base?
Cypress setup #2221
Conversation
3d420d7
to
f8297be
Compare
Thank you very much for your initiative to spearhead this project and your contributions on this @scottrosen14. When you're ready for review, please feel free to request it from me, or let me know if you don't see an option to do so, and we'll get you the right permissions. |
ea5d848
to
46b5771
Compare
Hey @anth-volk this is ready for review |
Thanks @scottrosen14! I will probably get around to this late tomorrow. |
b452c14
to
53eb83b
Compare
Hey @anth-volk could you review this? |
@@ -1 +1,14 @@ | |||
{} | |||
{ | |||
"semi": true, |
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.
Curious why you enabled these lint rules. Was this a file that wasn't meant to be merged? Do you feel these would be the best for our linting structure? Or is this personal preference?
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.
Thanks for your work on this @scottrosen14! Getting this sort of end-to-end testing up and running is something we've been wanting to do for quite a while. Unfortunately, I wasn't able to actually get the tests running locally, and since these aren't integrated into the CI/CD structures, I also can't debug that way. I had a couple requests around integrating them in, as well as some questions around your changes to linting. Looking forward to hammering those out with you. Thank you very much!
"prepare-husky": "husky" | ||
"format": "prettier --write \"**/*.{js,jsx,ts,tsx,json,md}\"", | ||
"lint": "eslint . --ext .js,.jsx,.ts,.tsx", | ||
"lint:fix": "npm run lint --fix && npm run format", |
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 think I understand where you're going with this code, but we use the linting code in our CI/CD structure, and at that point, we run npm run lint
. As such, with these changes, the CI/CD won't capture any of the prettier run. I would either revert the lint scripts and lint-related changes or modify .github/workflows/pr.yaml
.
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.
If you could give a little bit more insight into what you were shooting for with these script changes and the .prettierrc.json
code, I think we could ensure the changes meet the needs of the repo.
"prepare-husky": "husky", | ||
"cy:dev": "npm start & wait-on http://localhost:3000 && STAGE_ENV=development cypress run", | ||
"cy:prod": "npm run build && STAGE_ENV=production cypress run", | ||
"cy:dev:open": "npm start & wait-on http://localhost:3000 && STAGE_ENV=development cypress open", |
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.
We currently use two relevant CI/CD scripts for testing:
.github/workflows/pr.yaml
runs whenever a PR is opened, while .github/workflows/push.yaml
runs whenever a PR is approved and pushed. Could you modify these to run the relevant scripts? I'm guessing that would mean running npm run cy:dev
inside the PR workflow and cy:prod
in the push, but I'm unfamiliar with Cypress, so would the open
scripts be more correct here?
describe("PolicyEngine Homepage", () => { | ||
const regexArg = /the\s(us|u\.s\.|usa|united states)/; | ||
|
||
beforeEach(() => { |
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.
When I run these tests locally, none of the tests actually run, as I get this error here:
Running: home.cy.js (1 of 1)
PolicyEngine Homepage
1) "before each" hook for "should redirect from root to US homepage by default"
0 passing (747ms)
1 failing
1) PolicyEngine Homepage
"before each" hook for "should redirect from root to US homepage by default":
CypressError: `cy.visit()` failed trying to load:
/
We failed looking for this file at the path:
/Users/administrator/Documents/forks/scottrosen14/policyengine-app/
The internal Cypress web server responded with:
> 404: Not Found
I admit, it may be my setup, as I'm unfamiliar with Cypress, but wanted to highlight this.
Description
Fixes #2220
Changes
Screenshots
Please include concise visuals (videos, screenshots, etc.) demonstrating the code in action and the impact of changes. Many on the team use a free tool called Loom to capture and share short clips, but feel free to utilize any tool you'd like. Screenshots of the code itself can also be helpful, but are usually not necessary.
Testing
Note: When using create-react-app, REACT_APP must be prepended to env var name.
When running smoke screen, you must add appropriate env vars for
REACT_APP_POLICYENGINE_DOMAIN