Cypress component test setup not working with Angular
See original GitHub issueCurrent Behavior
When following the steps described at https://nx.dev/packages/cypress with a completely fresh repository one ends up with an error.
There is a separate documentation for component testing but it only features a react package that is not available yet for angular https://nx.dev/cypress/cypress-component-testing.
Calling cypress open
from the app folder and letting cypress do the job also results in issues.
Expected Behavior
Component tests work
Steps to Reproduce
Follow the steps documented at https://nx.dev/packages/cypress
Failure Logs
Error: Could not find a project with projectType "application" in "angular.json"
which makes sense as the angular.json
now looks like this and the “real” information is in the project.
{
"$schema": "./node_modules/nx/schemas/workspace-schema.json",
"version": 2,
"projects": {
"one": "apps/one",
"one-e2e": "apps/one-e2e"
}
}
my package.json
looks like this
"dependencies": {
"@angular/animations": "~14.1.1",
"@angular/common": "~14.1.1",
"@angular/compiler": "~14.1.1",
"@angular/core": "~14.1.1",
"@angular/forms": "~14.1.1",
"@angular/platform-browser": "~14.1.1",
"@angular/platform-browser-dynamic": "~14.1.1",
"@angular/router": "~14.1.1",
"@nrwl/angular": "14.5.6",
"rxjs": "~7.4.0",
"tslib": "^2.3.0",
"zone.js": "~0.11.4"
},
"devDependencies": {
"@angular-devkit/build-angular": "~14.1.1",
"@angular-eslint/eslint-plugin": "~14.0.0",
"@angular-eslint/eslint-plugin-template": "~14.0.0",
"@angular-eslint/template-parser": "~14.0.0",
"@angular/cli": "~14.1.0",
"@angular/compiler-cli": "~14.1.1",
"@angular/language-service": "~14.1.1",
"@nrwl/cli": "14.5.6",
"@nrwl/cypress": "14.5.6",
"@nrwl/eslint-plugin-nx": "14.5.6",
"@nrwl/jest": "14.5.6",
"@nrwl/linter": "14.5.6",
"@nrwl/workspace": "14.5.6",
"@types/jest": "27.4.1",
"@types/node": "16.11.7",
"@typescript-eslint/eslint-plugin": "^5.29.0",
"@typescript-eslint/parser": "^5.29.0",
"cypress": "^10.2.0",
"eslint": "~8.15.0",
"eslint-config-prettier": "8.1.0",
"eslint-plugin-cypress": "^2.10.3",
"jest": "27.5.1",
"jest-preset-angular": "~11.1.2",
"nx": "14.5.6",
"prettier": "^2.6.2",
"ts-jest": "27.1.4",
"ts-node": "10.9.1",
"typescript": "~4.7.2"
}
Issue Analytics
- State:
- Created a year ago
- Reactions:2
- Comments:9 (4 by maintainers)
Top Results From Across the Web
Angular Quickstart - Cypress Documentation
Whenever you run Cypress for the first time, the app will prompt you to set up either E2E Testing or Component Testing. Click...
Read more >Testing Angular Components Using Cypress - Marmicode
Whatever framework you are using, and even without frameworks, component testing is a challenging topic as there is no one-size-fits-all ...
Read more >CSS is not loading for Cypress component testing using angular
from 'cypress-angular-unit-test' · import ; from './toast.component' · import ; from '@angular/core/testing' · import ; from '@nexus/angular' · import ...
Read more >How to perform Component Testing using Cypress
Step 1: Create a sample react application · Step 2: Install the required dependencies · Step 3: Install the Cypress test automation tool...
Read more >@nrwl/react:cypress-component-configuration | Nx
Component testing requires a build target to correctly run the component test dev server. This option can be manually specified with --build-target=some-react- ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Just as an update, we are working on this with the Cypress team. 😄
Stay tuned for updates.
@basti-n Can you open a separate issue since this is a different setup/error that the initial issue?