forked from cypress-io/cypress
-
Notifications
You must be signed in to change notification settings - Fork 0
/
component_testing_spec.ts
185 lines (158 loc) · 4.8 KB
/
component_testing_spec.ts
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
174
175
176
177
178
179
180
181
182
183
184
185
import systemTests from '../lib/system-tests'
describe('component testing projects', function () {
systemTests.setup()
systemTests.it('create-react-app-configured', {
project: 'create-react-app-configured',
testingType: 'component',
spec: 'src/App.cy.jsx',
browser: 'chrome',
expectedExitCode: 0,
})
systemTests.it('vueclivue2-configured', {
project: 'vueclivue2-configured',
testingType: 'component',
spec: 'src/**/*.cy.js',
browser: 'electron',
expectedExitCode: 0,
})
systemTests.it('vueclivue3-configured', {
project: 'vueclivue3-configured',
testingType: 'component',
spec: 'src/components/HelloWorld.cy.js',
browser: 'chrome',
expectedExitCode: 0,
})
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-vite-ts-configured', {
project: 'vue3-vite-ts-configured',
testingType: 'component',
spec: 'src/components/HelloWorld.cy.ts',
browser: 'chrome',
expectedExitCode: 0,
})
// TODO: Figure out correct dependencies to make Next.js, 11-12 work.
systemTests.it.skip('nextjs-configured', {
project: 'nextjs-configured',
testingType: 'component',
spec: 'components/button.cy.jsx',
browser: 'chrome',
expectedExitCode: 0,
})
systemTests.it('nuxtjs-vue2-configured', {
project: 'nuxtjs-vue2-configured',
testingType: 'component',
spec: 'components/Tutorial.cy.js',
browser: 'chrome',
expectedExitCode: 0,
})
systemTests.it('vuecli5vue3-configured', {
project: 'vuecli5vue3-configured',
testingType: 'component',
spec: 'src/components/HelloWorld.cy.js',
browser: 'chrome',
expectedExitCode: 0,
})
})
const REACT_MAJOR_VERSIONS = ['17', '18'] 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.config.ts',
spec: 'src/App.cy.jsx,src/Unmount.cy.jsx,src/UsingLegacyMount.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/UsingLegacyMount.cy.jsx,src/Rerendering.cy.jsx,src/mount.cy.jsx',
testingType: 'component',
browser: 'chrome',
snapshot: true,
expectedExitCode: 0,
})
})
}
})
const ANGULAR_MAJOR_VERSIONS = ['13', '14', '15']
describe(`Angular CLI major versions`, () => {
systemTests.setup()
for (const majorVersion of ANGULAR_MAJOR_VERSIONS) {
let spec = 'src/**/*.cy.ts,!src/app/errors.cy.ts'
if (majorVersion === '13') {
spec = `${spec},!src/app/components/standalone.component.cy.ts`
}
systemTests.it(`v${majorVersion} with mount tests`, {
project: `angular-${majorVersion}`,
spec,
testingType: 'component',
browser: 'chrome',
expectedExitCode: 0,
})
}
systemTests.it('angular 14 custom config', {
project: 'angular-custom-config',
spec: 'src/app/my-component.cy.ts',
testingType: 'component',
browser: 'chrome',
expectedExitCode: 0,
})
})
describe('svelte component testing', () => {
systemTests.setup()
for (const bundler of ['webpack', 'vite']) {
systemTests.it(`svelte + ${bundler}`, {
project: `svelte-${bundler}`,
testingType: 'component',
spec: '**/*.cy.js,!src/errors.cy.js',
browser: 'chrome',
expectedExitCode: 0,
})
}
})
describe('Vue major versions with Vite', () => {
systemTests.setup()
systemTests.it('vue 2', {
project: `vue2`,
testingType: 'component',
spec: '**/*.cy.js',
browser: 'chrome',
expectedExitCode: 0,
})
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,
})
})