-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
feat: support Angular 19 with Cypress Component Testing #30675
Conversation
cypress Run #58606
Run Properties:
|
Project |
cypress
|
Branch Review |
feat/support_angular_19
|
Run status |
Passed #58606
|
Run duration | 19m 35s |
Commit |
7f453d7414: feat: support angular 19 and update tests [run ci]
|
Committer | AtofStryker |
View all properties for this run ↗︎ |
Test results | |
---|---|
Failures |
0
|
Flaky |
5
|
Pending |
1326
|
Skipped |
0
|
Passing |
29379
|
View all changes introduced in this branch ↗︎ |
UI Coverage
46.07%
|
|
---|---|
Untested elements |
187
|
Tested elements |
164
|
Accessibility
92.55%
|
|
---|---|
Failed rules |
3 critical
8 serious
2 moderate
2 minor
|
Failed elements |
892
|
e8781d0
to
5cf8490
Compare
}).catch((e) => { | ||
// If this promise does not settle in Angular 19 it is rejected | ||
// https://github.com/angular/angular/blob/main/CHANGELOG.md#1900-2024-11-19 | ||
// eslint-disable-next-line no-console |
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.
whenStable
now rejects if it doesn't settle in Angular 19
we likely don't want to propagate this failure up and fail, just log it to the console. some users trigger stability manually for some difference use cases (see #30327)
@Component({ selector: 'cy-wrapper-component', template: '' }) | ||
// if using the Wrapper Component (template strings), the component itself cannot be | ||
// a standalone component | ||
@Component({ selector: 'cy-wrapper-component', template: '', standalone: false }) |
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.
since template strings require a references to the actual component in the test module, the component cannot be a standalone component
@@ -25,7 +25,7 @@ const runCommandInProject = (command: string, projectPath: string) => { | |||
|
|||
const cypressSchematicPackagePath = path.join(__dirname, '..') | |||
|
|||
const ANGULAR_PROJECTS: ProjectFixtureDir[] = ['angular-17', 'angular-18'] | |||
const ANGULAR_PROJECTS: ProjectFixtureDir[] = ['angular-18', 'angular-19'] |
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.
dropped 17 here for the schematic testing since it is time consuming and the schematic in 18 follows almost an identical pattern of that in 17
@@ -0,0 +1,96 @@ | |||
{ | |||
"$schema": "./node_modules/@angular/cli/lib/config/schema.json", |
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.
moved from project-fixtures/angular/angular.json
@@ -104,6 +104,13 @@ describe(`Angular CLI versions`, () => { | |||
browser: 'chrome', | |||
expectedExitCode: 0, | |||
}) | |||
|
|||
systemTests.it('angular signals', { |
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 made a booboo when I merged #29621. I wrote the system test but didn't actually add the code to run it 🙈
5cf8490
to
438f978
Compare
438f978
to
0abd1d7
Compare
0abd1d7
to
7f453d7
Compare
Additional details
Cypress 14 will support Angular 19 Component Testing OOTB, with autodetected framework, scaffolding, and setup
Steps to test
take the built binary and test this against a new angular 19 project with the angular cli with
ng new
(or run the project tests).How has the user experience changed?
Cypress Component Testing users will now have angular 19 support built into scaffolding
The main difference with Angular 19 is that
standalone
components are the new default via settingstandalone
totrue
, effectively making thengModule
pattern obsolete. Angular 18 started scaffolding standalone components by default.To make our system tests backwards compatible , I have set the
standalone
option in the component tests tofalse
since they use thengModule
pattern since Angular 17.2-19 use the same project fixture directory. Thestandalone
component option has been around since Angular 14, so this is not an issue for our supported older versions.I also needed to move the
angular.json
out of the angular project fixture and into theangular-17
-angular-19
directories since there are some slight differences in the json structure that are required to get thecypress-schematic
to work correctly (buildTarget
vsbrowserTarget
PR Tasks
cypress-documentation
? chore: update angular docs to include Angular 19 cypress-documentation#6018type definitions
?