Closed wiegell closed 3 months ago
the baseUrl being set in the cypress.config.ts file most likely won't be picked up unless the devServerTarget doesn't return a baseUrl.
The order is executor option baseUrl then devserver returned baseUrl. Since the angular dev server you're using always returns that value cypress config won't get picked up.
So setting the executor option should work (via cli or project.json)
what command are you running and what does the project.json for the e2e target look like?
This issue has been automatically marked as stale because it hasn't had any recent activity. It will be closed in 14 days if no further activity occurs. If we missed this issue please reply to keep it active. Thanks for being a part of the Nx community! 🙏
I can't reproduce the issue.
Using the reported Nx version (16.1.4) with the following cypress.config.ts
:
import { defineConfig } from 'cypress';
import { nxE2EPreset } from '@nx/cypress/plugins/cypress-preset';
export default defineConfig({
e2e: {
...nxE2EPreset(__dirname),
baseUrl: 'http://localhost:4201',
},
});
And the following serve
target:
"serve": {
"executor": "@angular-devkit/build-angular:dev-server",
"configurations": {
"production": {
"browserTarget": "app1:build:production"
},
"development": {
"browserTarget": "app1:build:development",
"port": 4201
}
},
"defaultConfiguration": "development"
}
The e2e
tests work as expected. They test against the correct baseUrl
. I also confirmed it works in more recent versions of Nx.
Please provide a repo where the issue you're facing can be reproduced.
This issue has been automatically marked as stale because no reproduction was provided within 7 days. Please help us help you. Providing a repository exhibiting the issue helps us diagnose and fix the issue. Any time that we spend reproducing this issue is time taken away from addressing this issue and other issues. This issue will be closed in 21 days if a reproduction is not provided. If a reproduction has been provided, please reply to keep it active. Thanks for being a part of the Nx community! 🙏
This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context.
Current Behavior
This issue is still present: https://github.com/nrwl/nx/issues/1614
The baseurl is not picked up regardless of being set as a cli flag or in cypress.config.ts. Defaulting to 4200 (angular app) no matter what. Setting the --port flag can serve the app at that port, but cy.visit("/") still goes to 4200.
Expected Behavior
Should go to correct url/port
GitHub Repo
No response
Steps to Reproduce
see above
Nx Report
Failure Logs
No response
Operating System
Additional Information
No response