-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Expand file tree
/
Copy pathcomponent_testing_spec.ts
More file actions
173 lines (149 loc) · 4.73 KB
/
component_testing_spec.ts
File metadata and controls
173 lines (149 loc) · 4.73 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
import systemTests from '../lib/system-tests'
describe('component testing projects', function () {
systemTests.setup()
systemTests.it('react-vite-ts-configured', {
project: 'react-vite-ts-configured',
testingType: 'component',
spec: 'src/App.cy.tsx',
browser: 'chrome',
expectedExitCode: 0,
})
systemTests.it('vue3-webpack-ts-configured', {
project: 'vue3-webpack-ts-configured',
testingType: 'component',
spec: 'src/components/HelloWorld.cy.ts',
browser: 'chrome',
expectedExitCode: 0,
})
systemTests.it('vue3-vite-ts-configured', {
project: 'vue3-vite-ts-configured',
testingType: 'component',
spec: 'src/components/HelloWorld.cy.ts',
browser: 'chrome',
expectedExitCode: 0,
})
systemTests.it('nextjs-configured', {
project: 'nextjs-configured',
testingType: 'component',
spec: 'components/button.cy.jsx',
browser: 'chrome',
expectedExitCode: 0,
})
})
const REACT_MAJOR_VERSIONS = ['18', '19'] as const
describe(`React major versions with Vite`, function () {
systemTests.setup()
for (const majorVersion of REACT_MAJOR_VERSIONS) {
it(`executes all of the tests for React v${majorVersion} with Vite`, function () {
return systemTests.exec(this, {
project: `react${majorVersion}`,
configFile: 'cypress-vite-default.config.ts',
spec: 'src/App.cy.jsx,src/Unmount.cy.jsx,src/Rerendering.cy.jsx,src/mount.cy.jsx',
testingType: 'component',
browser: 'chrome',
snapshot: true,
expectedExitCode: 0,
})
})
}
})
describe(`React major versions with Webpack`, function () {
systemTests.setup()
for (const majorVersion of REACT_MAJOR_VERSIONS) {
it(`executes all of the tests for React v${majorVersion} with Webpack`, function () {
return systemTests.exec(this, {
project: `react${majorVersion}`,
configFile: 'cypress-webpack.config.ts',
spec: 'src/App.cy.jsx,src/Unmount.cy.jsx,src/Rerendering.cy.jsx,src/mount.cy.jsx',
testingType: 'component',
browser: 'chrome',
snapshot: true,
expectedExitCode: 0,
})
})
}
})
const ANGULAR_VERSIONS = ['18', '19', '20'] as const
describe(`Angular CLI versions`, () => {
systemTests.setup()
for (const version of ANGULAR_VERSIONS) {
systemTests.it(`v${version} with mount tests`, {
project: `angular-${version}`,
spec: 'src/**/*.cy.ts,!src/app/errors.cy.ts',
testingType: 'component',
browser: 'chrome',
expectedExitCode: 0,
})
}
// NOTE: Angular 21 has to be tested separate because it uses the zoneless mount function,
// which doesn't support zone.js any longer OR support autoDetectChanges or autoSpyOutputs
systemTests.it(`v21 with mount tests`, {
project: `angular-21`,
spec: 'src/**/*.cy.ts,!src/app/errors.cy.ts',
testingType: 'component',
browser: 'chrome',
expectedExitCode: 0,
})
systemTests.it('angular 19 custom config', {
project: 'angular-custom-config',
spec: 'src/app/my-component.cy.ts',
testingType: 'component',
browser: 'chrome',
expectedExitCode: 0,
})
systemTests.it('angular custom root', {
project: 'angular-custom-root',
spec: 'ui/app/app.component.cy.ts',
testingType: 'component',
browser: 'chrome',
expectedExitCode: 0,
})
systemTests.it('angular signals', {
project: 'angular-signals',
testingType: 'component',
browser: 'chrome',
expectedExitCode: 0,
})
})
describe('svelte component testing', () => {
systemTests.setup()
// svelte-webpack-configured is currently difficult to test.
// This is currently tested as a binary-like system-test inside CI.
// We can unskip this test and remove the binary-like CircleCI test
// once https://github.com/sveltejs/svelte-loader/issues/243 is resolved.
systemTests.it.skip(`svelte + webpack`, {
project: `svelte-webpack-configured`,
testingType: 'component',
spec: '**/*.cy.ts,!src/lib/errors.cy.ts',
browser: 'chrome',
expectedExitCode: 0,
})
systemTests.it(`svelte + vite`, {
project: `svelte-vite-configured`,
testingType: 'component',
spec: '**/*.cy.ts,!src/lib/errors.cy.ts',
browser: 'chrome',
expectedExitCode: 0,
})
})
describe('Vue major versions with Vite', () => {
systemTests.setup()
systemTests.it('vue 3', {
project: `vue3`,
testingType: 'component',
spec: '**/*.cy.js',
browser: 'chrome',
expectedExitCode: 0,
})
})
describe('experimentalSingleTabRunMode', function () {
systemTests.setup()
systemTests.it('executes all specs in a single tab', {
project: 'experimentalSingleTabRunMode',
testingType: 'component',
spec: '**/*.cy.js',
browser: 'chrome',
snapshot: true,
expectedExitCode: 2,
})
})