-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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 Config not using the current value. #27189
Comments
I cloned your repo and it worked for me, also on Windows 11, so I can't explain why it didn't work for you unfortunately. |
@MikeMcC399 I pulled the repo on my personal laptop, which is also Windows 11. And was able to run replicate the issue as before. I'm running the latest LTS version of Node.js, npm and Angular CLI: I then ran the following commands:
I then chose the Chrome browser: I then selected Settings / Project settings / Resolved configuration and as you can see it is showing the value However as you can see from the contents of the This example is as basic as you can get. It is a example Angular application generated through the My guess would be there is something going wrong when Angular CLI is loading Cypress. I initially though I had missed something or done something wrong. However Cypress is saying that the Out of interest what version of Angular CLI are you using when you were not able to replicate the issue? |
My apologies! I was not using exactly your repro steps. When Cypress is started using I used instead So this problem may be more suited to investigation via Angular rather than Cypress, but I would leave it here for the time being. |
@MikeMcC399 thank you, that's actually really helpful as it provides me with a work around. I'm currently evaluating Cypress as a replacement for Protractor. Cypress looks to be a very good fit. I was using the following the two articles: And got as far as setting up the config when I ran in to difficulties. Looking at your suggestions combined with the info from the article Protractor to Cypress I was able to get the correct value from the config by using the following commands:
Again thank you for your help and hopefully yourselves or somebody on the Angular CLI team can get the ng e2e command working as that is generally the most common workflow for testing in Angular. |
Just an update. I am leaning towards this being an issue with Cypress rather than Angular CLI. The reason for this is I tried using the cypress-run command. And it fails to load the correct baseUrl from the config. Adding cypress to the Angular template project updates the package.json:
The commands are configured via the
For clarity the key difference here are that using cypress open requires running the site via the So to rule out any differences between
Removing all the options for the cypress open makes it work again.
You do have to manually use the |
It looks like this is a consequence of Cypress <=> Angular integration, otherwise the file
In any case you have provided a repo with your issue, so the Cypress / Angular experts can give their opinion. |
Here is another minimal reproduction repro.zip, it is indeed conflicting - I guess the angular schematic is somehow overriding the value. I'm looking into this. |
Yeah no worries. I was assuming the Cypress schematic is part of the Cypress project which I think is where the fault lies. Btw I am really impressed with the Cypress features in particular the videos produced of the test run. This will definitely come in use in our integrated continuous deployment pipeline. As the tests will always be run headless. So having the ability to retrospectively look at a failing test is a very useful feature and clever idea. |
Note that it's planned to disable video collection by default in a future version (see #26157 for details and reasons). That should not prevent you explicitly enabling videos if you migrate to the future version when the time comes. |
This issue has not had any activity in 180 days. Cypress evolves quickly and the reported behavior should be tested on the latest version of Cypress to verify the behavior is still occurring. It will be closed in 14 days if no updates are provided. |
This issue has been closed due to inactivity. |
Current behavior
Created a brand new Angular project using Angular CLI:
ng new TestCypress
Added the Cypress via the Angular Cypress schematic:
ng add @cypress/schematic
Ran the e2e test via:
ng e2e
Everything worked as expected.
I then modified the cypress configuration to change the base url in the typescript config file
cypress.config.ts
.The changes to the settings were not picked up. I stopped the
ng e2e
and re-ran still the resolved configuration correctly shows thebaseUrl
as being resolved tocypress.config.ts
but the value is wrong.Desired behavior
The updated value in the cypress.config.ts file should be the value that is resolved.
Test code to reproduce
The code to replicate the issue can be found here:
Github CypressConfigIssue
Cypress Version
12.16.0
Node version
18.16.1
Operating System
Windows 11
Debug Logs
No response
Other
No response
The text was updated successfully, but these errors were encountered: