Skip to content

Commit e8fc268

Browse files
feat: add support for angular 17 (#28152)
* feat(webpack-dev-server): add support for angular 17 * update changelog * fix broken spec pattern * update to rc 2 for cli * remove = from dependency minVersion lists * update angular 17 rc version and update dep test * add projectDirFolder to fixtures for angular-17 * resolve broken system tests * update ct project dir angular version
1 parent 9f19f9a commit e8fc268

File tree

16 files changed

+3813
-3256
lines changed

16 files changed

+3813
-3256
lines changed

cli/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@
33

44
_Released 11/7/2023 (PENDING)_
55

6+
**Features:**
7+
8+
- Adds Component Testing support for Angular version 17. Addresses [#28153](https://github.com/cypress-io/cypress/issues/28153).
9+
610
**Bugfixes:**
711

812
- Fixed an issue where clicking a link to download a file could cause a page load timeout when the download attribute was missing. Note: download behaviors in experimental Webkit are still an issue. Fixes [#14857](https://github.com/cypress-io/cypress/issues/14857).

npm/webpack-dev-server/cypress/e2e/angular.cy.ts

Lines changed: 35 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,13 @@
22
/// <reference path="../support/e2e.ts" />
33
import type { ProjectFixtureDir } from '@tooling/system-tests/lib/fixtureDirs'
44

5-
const WEBPACK_ANGULAR: ProjectFixtureDir[] = ['angular-13', 'angular-14', 'angular-15', 'angular-16', 'angular-16.1']
5+
const WEBPACK_ANGULAR: ProjectFixtureDir[] = [
6+
'angular-13',
7+
'angular-14',
8+
'angular-15',
9+
'angular-16',
10+
'angular-17',
11+
]
612

713
// Add to this list to focus on a particular permutation
814
const ONLY_PROJECTS: ProjectFixtureDir[] = []
@@ -46,7 +52,9 @@ for (const project of WEBPACK_ANGULAR) {
4652
cy.contains('app.component.cy.ts').click()
4753
cy.waitForSpecToFinish({ passCount: 1 }, 60000)
4854

49-
cy.get('li.command').first().within(() => {
55+
cy.get('li.command')
56+
.first()
57+
.within(() => {
5058
cy.get('.command-method').should('contain', 'mount')
5159
cy.get('.command-message').should('contain', 'AppComponent')
5260
})
@@ -60,7 +68,11 @@ for (const project of WEBPACK_ANGULAR) {
6068
cy.withCtx(async (ctx) => {
6169
await ctx.actions.file.writeFileInProject(
6270
ctx.path.join('src', 'app', 'app.component.html'),
63-
(await ctx.file.readFileInProject(ctx.path.join('src', 'app', 'app.component.html'))).replace('Hello World', 'Hello Cypress'),
71+
(
72+
await ctx.file.readFileInProject(
73+
ctx.path.join('src', 'app', 'app.component.html'),
74+
)
75+
).replace('Hello World', 'Hello Cypress'),
6476
)
6577
})
6678

@@ -69,7 +81,11 @@ for (const project of WEBPACK_ANGULAR) {
6981
cy.withCtx(async (ctx) => {
7082
await ctx.actions.file.writeFileInProject(
7183
ctx.path.join('src', 'app', 'app.component.html'),
72-
(await ctx.file.readFileInProject(ctx.path.join('src', 'app', 'app.component.html'))).replace('Hello Cypress', 'Hello World'),
84+
(
85+
await ctx.file.readFileInProject(
86+
ctx.path.join('src', 'app', 'app.component.html'),
87+
)
88+
).replace('Hello Cypress', 'Hello World'),
7389
)
7490
})
7591

@@ -84,17 +100,26 @@ for (const project of WEBPACK_ANGULAR) {
84100

85101
// Create compilation error
86102
cy.withCtx(async (ctx) => {
87-
const componentFilePath = ctx.path.join('src', 'app', 'app.component.ts')
103+
const componentFilePath = ctx.path.join(
104+
'src',
105+
'app',
106+
'app.component.ts',
107+
)
88108

89109
await ctx.actions.file.writeFileInProject(
90110
componentFilePath,
91-
(await ctx.file.readFileInProject(componentFilePath)).replace('class', 'classaaaaa'),
111+
(
112+
await ctx.file.readFileInProject(componentFilePath)
113+
).replace('class', 'classaaaaa'),
92114
)
93115
})
94116

95117
// The test should fail and the stack trace should appear in the command log
96118
cy.waitForSpecToFinish({ failCount: 1 }, 60000)
97-
cy.contains('The following error originated from your test code, not from Cypress.').should('exist')
119+
cy.contains(
120+
'The following error originated from your test code, not from Cypress.',
121+
).should('exist')
122+
98123
cy.get('.test-err-code-frame').should('be.visible')
99124
})
100125

@@ -105,7 +130,9 @@ for (const project of WEBPACK_ANGULAR) {
105130
cy.withCtx(async (ctx) => {
106131
await ctx.actions.file.writeFileInProject(
107132
ctx.path.join('src', 'app', 'new.component.cy.ts'),
108-
await ctx.file.readFileInProject(ctx.path.join('src', 'app', 'app.component.cy.ts')),
133+
await ctx.file.readFileInProject(
134+
ctx.path.join('src', 'app', 'app.component.cy.ts'),
135+
),
109136
)
110137
})
111138

packages/launchpad/cypress/e2e/config-warning.cy.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -216,9 +216,9 @@ describe('component testing dependency warnings', () => {
216216
cy.get('[data-cy-testingtype="component"]').click()
217217
cy.get('[data-cy="warning-alert"]', { timeout: 12000 }).should('exist')
218218
.should('contain.text', 'Warning: Component Testing Mismatched Dependencies')
219-
.should('contain.text', 'vite. Expected ^=2.0.0 || ^=3.0.0 || ^=4.0.0, found 2.0.0-beta.70')
220-
.should('contain.text', 'react. Expected ^=16.0.0 || ^=17.0.0 || ^=18.0.0, found 15.6.2.')
221-
.should('contain.text', 'react-dom. Expected ^=16.0.0 || ^=17.0.0 || ^=18.0.0 but dependency was not found.')
219+
.should('contain.text', 'vite. Expected ^2.0.0 || ^3.0.0 || ^4.0.0, found 2.0.0-beta.70')
220+
.should('contain.text', 'react. Expected ^16.0.0 || ^17.0.0 || ^18.0.0, found 15.6.2.')
221+
.should('contain.text', 'react-dom. Expected ^16.0.0 || ^17.0.0 || ^18.0.0 but dependency was not found.')
222222

223223
cy.get('.warning-markdown').find('li').should('have.length', 3)
224224
})
@@ -235,7 +235,7 @@ describe('component testing dependency warnings', () => {
235235
cy.get('[data-cy-testingtype="component"]', { timeout: 12000 }).click()
236236
cy.get('[data-cy="warning-alert"]', { timeout: 12000 }).should('exist')
237237
.should('contain.text', 'Warning: Component Testing Mismatched Dependencies')
238-
.should('contain.text', '@vue/cli-service. Expected ^=4.0.0 || ^=5.0.0, found 3.12.1.')
238+
.should('contain.text', '@vue/cli-service. Expected ^4.0.0 || ^5.0.0, found 3.12.1.')
239239
.should('contain.text', 'vue. Expected ^3.0.0, found 2.7.8.')
240240

241241
cy.get('.warning-markdown').find('li').should('have.length', 2)

packages/scaffold-config/src/dependencies.ts

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export const WIZARD_DEPENDENCY_WEBPACK = {
44
package: 'webpack',
55
installer: 'webpack',
66
description: 'Webpack is a module bundler',
7-
minVersion: '^=4.0.0 || ^=5.0.0',
7+
minVersion: '^4.0.0 || ^5.0.0',
88
} as const
99

1010
export const WIZARD_DEPENDENCY_VUE_2 = {
@@ -31,7 +31,7 @@ export const WIZARD_DEPENDENCY_REACT = {
3131
package: 'react',
3232
installer: 'react',
3333
description: 'A JavaScript library for building user interfaces',
34-
minVersion: '^=16.0.0 || ^=17.0.0 || ^=18.0.0',
34+
minVersion: '^16.0.0 || ^17.0.0 || ^18.0.0',
3535
} as const
3636

3737
export const WIZARD_DEPENDENCY_REACT_DOM = {
@@ -40,7 +40,7 @@ export const WIZARD_DEPENDENCY_REACT_DOM = {
4040
package: 'react-dom',
4141
installer: 'react-dom',
4242
description: 'This package serves as the entry point to the DOM and server renderers for React',
43-
minVersion: '^=16.0.0 || ^=17.0.0 || ^=18.0.0',
43+
minVersion: '^16.0.0 || ^17.0.0 || ^18.0.0',
4444
} as const
4545

4646
export const WIZARD_DEPENDENCY_TYPESCRIPT = {
@@ -49,7 +49,7 @@ export const WIZARD_DEPENDENCY_TYPESCRIPT = {
4949
package: 'typescript',
5050
installer: 'typescript',
5151
description: 'TypeScript is a language for application-scale JavaScript',
52-
minVersion: '^=3.4.0 || ^=4.0.0 || ^=5.0.0',
52+
minVersion: '^3.4.0 || ^4.0.0 || ^5.0.0',
5353
} as const
5454

5555
export const WIZARD_DEPENDENCY_REACT_SCRIPTS = {
@@ -58,7 +58,7 @@ export const WIZARD_DEPENDENCY_REACT_SCRIPTS = {
5858
package: 'react-scripts',
5959
installer: 'react-scripts',
6060
description: 'Create React apps with no build configuration',
61-
minVersion: '^=4.0.0 || ^=5.0.0',
61+
minVersion: '^4.0.0 || ^5.0.0',
6262
} as const
6363

6464
export const WIZARD_DEPENDENCY_VUE_CLI_SERVICE = {
@@ -67,7 +67,7 @@ export const WIZARD_DEPENDENCY_VUE_CLI_SERVICE = {
6767
package: '@vue/cli-service',
6868
installer: '@vue/cli-service',
6969
description: 'Standard Tooling for Vue.js Development',
70-
minVersion: '^=4.0.0 || ^=5.0.0',
70+
minVersion: '^4.0.0 || ^5.0.0',
7171
} as const
7272

7373
export const WIZARD_DEPENDENCY_VITE = {
@@ -76,7 +76,7 @@ export const WIZARD_DEPENDENCY_VITE = {
7676
package: 'vite',
7777
installer: 'vite',
7878
description: 'Vite is dev server that serves your source files over native ES modules',
79-
minVersion: '^=2.0.0 || ^=3.0.0 || ^=4.0.0',
79+
minVersion: '^2.0.0 || ^3.0.0 || ^4.0.0',
8080
} as const
8181

8282
export const WIZARD_DEPENDENCY_NUXT = {
@@ -94,7 +94,7 @@ export const WIZARD_DEPENDENCY_NEXT = {
9494
package: 'next',
9595
installer: 'next',
9696
description: 'The React Framework for Production',
97-
minVersion: '^=10.0.0 || ^=11.0.0 || ^=12.0.0 || ^=13.0.0',
97+
minVersion: '^10.0.0 || ^11.0.0 || ^12.0.0 || ^13.0.0',
9898
} as const
9999

100100
export const WIZARD_DEPENDENCY_ANGULAR_CLI = {
@@ -103,7 +103,7 @@ export const WIZARD_DEPENDENCY_ANGULAR_CLI = {
103103
package: '@angular/cli',
104104
installer: '@angular/cli',
105105
description: 'CLI tool that you use to initialize, develop, scaffold, and maintain Angular applications.',
106-
minVersion: '^=13.0.0 || ^=14.0.0 || ^=15.0.0 || ^=16.0.0',
106+
minVersion: '^13.0.0 || ^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0',
107107
} as const
108108

109109
export const WIZARD_DEPENDENCY_ANGULAR_DEVKIT_BUILD_ANGULAR = {
@@ -112,7 +112,7 @@ export const WIZARD_DEPENDENCY_ANGULAR_DEVKIT_BUILD_ANGULAR = {
112112
package: '@angular-devkit/build-angular',
113113
installer: '@angular-devkit/build-angular',
114114
description: 'Angular Webpack build facade',
115-
minVersion: '^=13.0.0 || ^=14.0.0 || ^=15.0.0 || ^=16.0.0',
115+
minVersion: '^13.0.0 || ^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0',
116116
} as const
117117

118118
export const WIZARD_DEPENDENCY_ANGULAR_CORE = {
@@ -121,7 +121,7 @@ export const WIZARD_DEPENDENCY_ANGULAR_CORE = {
121121
package: '@angular/core',
122122
installer: '@angular/core',
123123
description: 'The core of the Angular framework',
124-
minVersion: '^=13.0.0 || ^=14.0.0 || ^=15.0.0 || ^=16.0.0',
124+
minVersion: '^13.0.0 || ^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0',
125125
} as const
126126

127127
export const WIZARD_DEPENDENCY_ANGULAR_COMMON = {
@@ -130,7 +130,7 @@ export const WIZARD_DEPENDENCY_ANGULAR_COMMON = {
130130
package: '@angular/common',
131131
installer: '@angular/common',
132132
description: 'Commonly needed Angular directives and services',
133-
minVersion: '^=13.0.0 || ^=14.0.0 || ^=15.0.0 || ^=16.0.0',
133+
minVersion: '^13.0.0 || ^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0',
134134
} as const
135135

136136
export const WIZARD_DEPENDENCY_ANGULAR_PLATFORM_BROWSER_DYNAMIC = {
@@ -139,7 +139,7 @@ export const WIZARD_DEPENDENCY_ANGULAR_PLATFORM_BROWSER_DYNAMIC = {
139139
package: '@angular/platform-browser-dynamic',
140140
installer: '@angular/platform-browser-dynamic',
141141
description: 'Library for using Angular in a web browser with JIT compilation',
142-
minVersion: '^=13.0.0 || ^=14.0.0 || ^=15.0.0 || ^=16.0.0',
142+
minVersion: '^13.0.0 || ^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0',
143143
} as const
144144

145145
export const WIZARD_DEPENDENCY_SVELTE: Cypress.CypressComponentDependency = {

system-tests/project-fixtures/angular/cypress.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export default defineConfig({
1818
'@angular/platform-browser': require.resolve('@angular/platform-browser'),
1919
'@angular/platform-browser-dynamic/testing': require.resolve('@angular/platform-browser-dynamic/testing'),
2020
'@angular/platform-browser-dynamic': require.resolve('@angular/platform-browser-dynamic'),
21-
'zone.js/testing': require.resolve('zone.js/dist/zone-testing'),
21+
'zone.js/testing': require.resolve('zone.js/testing'),
2222
'zone.js': require.resolve('zone.js'),
2323
},
2424
},

system-tests/projects/angular-16.1/package.json

Lines changed: 0 additions & 39 deletions
This file was deleted.

system-tests/projects/angular-16/package.json

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "angular-16",
2+
"name": "angular-16.1",
33
"version": "0.0.0",
44
"private": true,
55
"scripts": {
@@ -10,22 +10,22 @@
1010
"test": "ng test"
1111
},
1212
"dependencies": {
13-
"@angular/animations": "^16.0.0-next.5",
14-
"@angular/common": "^16.0.0-next.5",
15-
"@angular/compiler": "^16.0.0-next.5",
16-
"@angular/core": "^16.0.0-next.5",
17-
"@angular/forms": "^16.0.0-next.5",
18-
"@angular/platform-browser": "^16.0.0-next.5",
19-
"@angular/platform-browser-dynamic": "^16.0.0-next.5",
20-
"@angular/router": "^16.0.0-next.5",
13+
"@angular/animations": "^16.1.0",
14+
"@angular/common": "^16.1.0",
15+
"@angular/compiler": "^16.1.0",
16+
"@angular/core": "^16.1.0",
17+
"@angular/forms": "^16.1.0",
18+
"@angular/platform-browser": "^16.1.0",
19+
"@angular/platform-browser-dynamic": "^16.1.0",
20+
"@angular/router": "^16.1.0",
2121
"rxjs": "~7.8.0",
2222
"tslib": "^2.3.0",
2323
"zone.js": "~0.13.0"
2424
},
2525
"devDependencies": {
26-
"@angular-devkit/build-angular": "^16.0.0-next.6",
27-
"@angular/cli": "~16.0.0-next.6",
28-
"@angular/compiler-cli": "^16.0.0-next.5",
26+
"@angular-devkit/build-angular": "^16.1.0",
27+
"@angular/cli": "~16.1.0",
28+
"@angular/compiler-cli": "^16.1.0",
2929
"@types/jasmine": "~4.3.0",
3030
"jasmine-core": "~4.5.0",
3131
"karma": "~6.4.0",

system-tests/projects/angular-16/src/app/components/signals.component.cy.ts

Lines changed: 0 additions & 14 deletions
This file was deleted.

system-tests/projects/angular-16/src/app/components/signals.component.ts

Lines changed: 0 additions & 14 deletions
This file was deleted.

0 commit comments

Comments
 (0)