cypress 10.10.0 → 11.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (75) hide show
  1. package/angular/CHANGELOG.md +27 -0
  2. package/angular/dist/index.d.ts +124 -1
  3. package/angular/dist/index.js +59 -59
  4. package/lib/cli.js +15 -1
  5. package/lib/tasks/download.js +3 -7
  6. package/lib/util.js +2 -2
  7. package/mount-utils/CHANGELOG.md +7 -63
  8. package/mount-utils/README.md +5 -23
  9. package/mount-utils/dist/index.d.ts +25 -39
  10. package/mount-utils/dist/index.js +33 -112
  11. package/mount-utils/package.json +1 -0
  12. package/package.json +5 -4
  13. package/react/CHANGELOG.md +12 -55
  14. package/react/README.md +2 -22
  15. package/react/dist/cypress-react.cjs.js +92 -219
  16. package/react/dist/cypress-react.esm-bundler.js +92 -220
  17. package/react/dist/index.d.ts +111 -4
  18. package/react18/CHANGELOG.md +6 -106
  19. package/react18/dist/cypress-react.cjs.js +117 -180
  20. package/react18/dist/cypress-react.esm-bundler.js +103 -167
  21. package/react18/dist/index.d.ts +78 -6
  22. package/react18/package.json +1 -0
  23. package/svelte/CHANGELOG.md +20 -0
  24. package/svelte/dist/cypress-svelte.cjs.js +19 -114
  25. package/svelte/dist/cypress-svelte.esm-bundler.js +19 -114
  26. package/svelte/dist/index.d.ts +201 -1
  27. package/types/cypress-npm-api.d.ts +1 -1
  28. package/types/cypress.d.ts +43 -21
  29. package/vue/CHANGELOG.md +13 -101
  30. package/vue/README.md +4 -8
  31. package/vue/dist/cypress-vue.cjs.js +70 -153
  32. package/vue/dist/cypress-vue.esm-bundler.js +70 -153
  33. package/vue/dist/index.d.ts +1352 -104
  34. package/vue/package.json +1 -1
  35. package/vue2/CHANGELOG.md +15 -50
  36. package/vue2/README.md +3 -7
  37. package/vue2/dist/cypress-vue2.cjs.js +87 -211
  38. package/vue2/dist/cypress-vue2.esm-bundler.js +86 -210
  39. package/vue2/dist/index.d.ts +341 -172
  40. package/vue2/package.json +1 -3
  41. package/angular/dist/mount.d.ts +0 -112
  42. package/react/dist/createMount.d.ts +0 -31
  43. package/react/dist/getDisplayName.d.ts +0 -8
  44. package/react/dist/mount.d.ts +0 -8
  45. package/react/dist/mountHook.d.ts +0 -12
  46. package/react/dist/types.d.ts +0 -45
  47. package/svelte/dist/mount.d.ts +0 -30
  48. package/vue/dist/@vue/test-utils/baseWrapper.d.ts +0 -63
  49. package/vue/dist/@vue/test-utils/components/RouterLinkStub.d.ts +0 -21
  50. package/vue/dist/@vue/test-utils/config.d.ts +0 -30
  51. package/vue/dist/@vue/test-utils/constants/dom-events.d.ts +0 -900
  52. package/vue/dist/@vue/test-utils/createDomEvent.d.ts +0 -9
  53. package/vue/dist/@vue/test-utils/domWrapper.d.ts +0 -18
  54. package/vue/dist/@vue/test-utils/emit.d.ts +0 -5
  55. package/vue/dist/@vue/test-utils/errorWrapper.d.ts +0 -1
  56. package/vue/dist/@vue/test-utils/index.d.ts +0 -11
  57. package/vue/dist/@vue/test-utils/interfaces/wrapperLike.d.ts +0 -56
  58. package/vue/dist/@vue/test-utils/mount.d.ts +0 -35
  59. package/vue/dist/@vue/test-utils/stubs.d.ts +0 -22
  60. package/vue/dist/@vue/test-utils/types.d.ts +0 -125
  61. package/vue/dist/@vue/test-utils/utils/autoUnmount.d.ts +0 -5
  62. package/vue/dist/@vue/test-utils/utils/compileSlots.d.ts +0 -2
  63. package/vue/dist/@vue/test-utils/utils/componentName.d.ts +0 -4
  64. package/vue/dist/@vue/test-utils/utils/find.d.ts +0 -10
  65. package/vue/dist/@vue/test-utils/utils/flushPromises.d.ts +0 -1
  66. package/vue/dist/@vue/test-utils/utils/getRootNodes.d.ts +0 -2
  67. package/vue/dist/@vue/test-utils/utils/isElement.d.ts +0 -1
  68. package/vue/dist/@vue/test-utils/utils/isElementVisible.d.ts +0 -6
  69. package/vue/dist/@vue/test-utils/utils/matchName.d.ts +0 -1
  70. package/vue/dist/@vue/test-utils/utils/stringifyNode.d.ts +0 -1
  71. package/vue/dist/@vue/test-utils/utils/vueCompatSupport.d.ts +0 -8
  72. package/vue/dist/@vue/test-utils/utils/vueShared.d.ts +0 -3
  73. package/vue/dist/@vue/test-utils/utils.d.ts +0 -13
  74. package/vue/dist/@vue/test-utils/vueWrapper.d.ts +0 -35
  75. package/vue/dist/@vue/test-utils/wrapperFactory.d.ts +0 -14
@@ -1,172 +1,341 @@
1
- /// <reference types="cypress" />
2
- /// <reference types="cypress" />
3
- import Vue from 'vue';
4
- import { VueTestUtilsConfigOptions, Wrapper } from '@vue/test-utils';
5
- import { StyleOptions } from '@cypress/mount-utils';
6
- /**
7
- * Type for component passed to "mount"
8
- *
9
- * @interface VueComponent
10
- * @example
11
- * import Hello from './Hello.vue'
12
- * ^^^^^ this type
13
- * mount(Hello)
14
- */
15
- declare type VueComponent = Vue.ComponentOptions<any> | Vue.VueConstructor;
16
- /**
17
- * Options to pass to the component when creating it, like
18
- * props.
19
- *
20
- * @interface ComponentOptions
21
- */
22
- declare type ComponentOptions = Record<string, unknown>;
23
- declare type VueLocalComponents = Record<string, VueComponent>;
24
- declare type VueFilters = {
25
- [key: string]: (value: string) => string;
26
- };
27
- declare type VueMixin = unknown;
28
- declare type VueMixins = VueMixin | VueMixin[];
29
- declare type VuePluginOptions = unknown;
30
- declare type VuePlugin = unknown | [unknown, VuePluginOptions];
31
- /**
32
- * A single Vue plugin or a list of plugins to register
33
- */
34
- declare type VuePlugins = VuePlugin[];
35
- /**
36
- * Additional Vue services to register while mounting the component, like
37
- * local components, plugins, etc.
38
- *
39
- * @interface MountOptionsExtensions
40
- * @see https://github.com/cypress-io/cypress/tree/develop/npm/vue#examples
41
- */
42
- interface MountOptionsExtensions {
43
- /**
44
- * Extra local components
45
- *
46
- * @memberof MountOptionsExtensions
47
- * @see https://github.com/cypress-io/cypress/tree/develop/npm/vue#examples
48
- * @example
49
- * import Hello from './Hello.vue'
50
- * // imagine Hello needs AppComponent
51
- * // that it uses in its template like <app-component ... />
52
- * // during testing we can replace it with a mock component
53
- * const appComponent = ...
54
- * const components = {
55
- * 'app-component': appComponent
56
- * },
57
- * mount(Hello, { extensions: { components }})
58
- */
59
- components?: VueLocalComponents;
60
- /**
61
- * Optional Vue filters to install while mounting the component
62
- *
63
- * @memberof MountOptionsExtensions
64
- * @see https://github.com/cypress-io/cypress/tree/develop/npm/vue#examples
65
- * @example
66
- * const filters = {
67
- * reverse: (s) => s.split('').reverse().join(''),
68
- * }
69
- * mount(Hello, { extensions: { filters }})
70
- */
71
- filters?: VueFilters;
72
- /**
73
- * Optional Vue mixin(s) to install when mounting the component
74
- *
75
- * @memberof MountOptionsExtensions
76
- * @alias mixins
77
- * @see https://github.com/cypress-io/cypress/tree/develop/npm/vue#examples
78
- */
79
- mixin?: VueMixins;
80
- /**
81
- * Optional Vue mixin(s) to install when mounting the component
82
- *
83
- * @memberof MountOptionsExtensions
84
- * @alias mixin
85
- * @see https://github.com/cypress-io/cypress/tree/develop/npm/vue#examples
86
- */
87
- mixins?: VueMixins;
88
- /**
89
- * A single plugin or multiple plugins.
90
- *
91
- * @see https://github.com/cypress-io/cypress/tree/develop/npm/vue#examples
92
- * @alias plugins
93
- * @memberof MountOptionsExtensions
94
- */
95
- use?: VuePlugins;
96
- /**
97
- * A single plugin or multiple plugins.
98
- *
99
- * @see https://github.com/cypress-io/cypress/tree/develop/npm/vue#examples
100
- * @alias use
101
- * @memberof MountOptionsExtensions
102
- */
103
- plugins?: VuePlugins;
104
- }
105
- /**
106
- * Options controlling how the component is going to be mounted,
107
- * including global Vue plugins and extensions.
108
- *
109
- * @interface MountOptions
110
- */
111
- interface MountOptions {
112
- /**
113
- * Vue instance to use.
114
- *
115
- * @deprecated
116
- * @memberof MountOptions
117
- */
118
- vue: unknown;
119
- /**
120
- * Extra Vue plugins, mixins, local components to register while
121
- * mounting this component
122
- *
123
- * @memberof MountOptions
124
- * @see https://github.com/cypress-io/cypress/tree/develop/npm/vue#examples
125
- */
126
- extensions: MountOptionsExtensions;
127
- }
128
- /**
129
- * Utility type for union of options passed to "mount(..., options)"
130
- */
131
- declare type MountOptionsArgument = Partial<ComponentOptions & MountOptions & StyleOptions & VueTestUtilsConfigOptions>;
132
- declare global {
133
- namespace Cypress {
134
- interface Cypress {
135
- /**
136
- * Mounted Vue instance is available under Cypress.vue
137
- * @memberof Cypress
138
- * @example
139
- * mount(Greeting)
140
- * .then(() => {
141
- * Cypress.vue.message = 'Hello There'
142
- * })
143
- * // new message is displayed
144
- * cy.contains('Hello There').should('be.visible')
145
- */
146
- vue: Vue;
147
- vueWrapper: Wrapper<Vue>;
148
- }
149
- }
150
- }
151
- /**
152
- * Mounts a Vue component inside Cypress browser.
153
- * @param {object} component imported from Vue file
154
- * @example
155
- * import Greeting from './Greeting.vue'
156
- * import { mount } from '@cypress/vue2'
157
- * it('works', () => {
158
- * // pass props, additional extensions, etc
159
- * mount(Greeting, { ... })
160
- * // use any Cypress command to test the component
161
- * cy.get('#greeting').should('be.visible')
162
- * })
163
- */
164
- export declare const mount: (component: VueComponent, optionsOrProps?: MountOptionsArgument) => Cypress.Chainable<Cypress.AUTWindow>;
165
- /**
166
- * Helper function for mounting a component quickly in test hooks.
167
- * @example
168
- * import {mountCallback} from '@cypress/vue2'
169
- * beforeEach(mountVue(component, options))
170
- */
171
- export declare const mountCallback: (component: VueComponent, options?: MountOptionsArgument) => () => Cypress.Chainable<Cypress.AUTWindow>;
172
- export {};
1
+ /// <reference types="cypress" />
2
+
3
+ import Vue, { ComponentOptions as ComponentOptions$1, FunctionalComponentOptions, Component } from 'vue';
4
+
5
+ type Prop<T> = { (): T } | { new(...args: never[]): T & object } | { new(...args: string[]): Function }
6
+
7
+ type PropType<T> = Prop<T> | Prop<T>[];
8
+
9
+ type PropValidator<T> = PropOptions<T> | PropType<T>;
10
+
11
+ interface PropOptions<T=any> {
12
+ type?: PropType<T>;
13
+ required?: boolean;
14
+ default?: T | null | undefined | (() => T | null | undefined);
15
+ validator?(value: T): boolean;
16
+ }
17
+
18
+ type RecordPropsDefinition<T> = {
19
+ [K in keyof T]: PropValidator<T[K]>
20
+ }
21
+ type ArrayPropsDefinition<T> = (keyof T)[];
22
+ type PropsDefinition<T> = ArrayPropsDefinition<T> | RecordPropsDefinition<T>;
23
+
24
+ type DefaultProps = Record<string, any>;
25
+
26
+ /**
27
+ * Utility type to declare an extended Vue constructor
28
+ */
29
+ type VueClass<V extends Vue> = (new (...args: any[]) => V) & typeof Vue
30
+
31
+ /**
32
+ * Utility type for a selector
33
+ */
34
+ type Selector = string | Component
35
+
36
+ /**
37
+ * Utility type for ref options object that can be used as a Selector
38
+ */
39
+ type RefSelector = {
40
+ ref: string
41
+ }
42
+
43
+ /**
44
+ * Utility type for name options object that can be used as a Selector
45
+ */
46
+ type NameSelector = {
47
+ name: string
48
+ }
49
+
50
+ /**
51
+ * Base class of Wrapper and WrapperArray
52
+ * It has common methods on both Wrapper and WrapperArray
53
+ */
54
+ interface BaseWrapper {
55
+ contains (selector: Selector): boolean
56
+ exists (): boolean
57
+ isVisible (): boolean
58
+
59
+ attributes(): { [name: string]: string }
60
+ attributes(key: string): string | void
61
+ classes(): Array<string>
62
+ classes(className: string): boolean
63
+ props(): { [name: string]: any }
64
+ props(key: string): any | void
65
+ overview(): void
66
+
67
+ is (selector: Selector): boolean
68
+ isEmpty (): boolean
69
+ isVueInstance (): boolean
70
+
71
+ setData (data: object): Promise<void> | void
72
+ setMethods (data: object): void
73
+ setProps (props: object): Promise<void> | void
74
+
75
+ setValue (value: any): Promise<void> | void
76
+ setChecked (checked?: boolean): Promise<void> | void
77
+ setSelected (): Promise<void> | void
78
+
79
+ trigger (eventName: string, options?: object): Promise<void> | void
80
+ destroy (): void
81
+ selector: Selector | void
82
+ }
83
+
84
+ interface Wrapper<V extends Vue | null, el extends Element = Element> extends BaseWrapper {
85
+ readonly vm: V
86
+ readonly element: el
87
+ readonly options: WrapperOptions
88
+
89
+ get<R extends Vue> (selector: VueClass<R>): Wrapper<R>
90
+ get<R extends Vue> (selector: ComponentOptions$1<R>): Wrapper<R>
91
+ get<Props = DefaultProps, PropDefs = PropsDefinition<Props>>(selector: FunctionalComponentOptions<Props, PropDefs>): Wrapper<Vue>
92
+ get<el extends Element>(selector: string): Wrapper<Vue, el>
93
+ get (selector: RefSelector): Wrapper<Vue>
94
+ get (selector: NameSelector): Wrapper<Vue>
95
+
96
+ getComponent<R extends Vue> (selector: VueClass<R>): Wrapper<R>
97
+ getComponent<R extends Vue> (selector: ComponentOptions$1<R>): Wrapper<R>
98
+ getComponent<Props = DefaultProps, PropDefs = PropsDefinition<Props>>(selector: FunctionalComponentOptions<Props, PropDefs>): Wrapper<Vue>
99
+ getComponent (selector: RefSelector): Wrapper<Vue>
100
+ getComponent (selector: NameSelector): Wrapper<Vue>
101
+
102
+ find<R extends Vue> (selector: VueClass<R>): Wrapper<R>
103
+ find<R extends Vue> (selector: ComponentOptions$1<R>): Wrapper<R>
104
+ find<Props = DefaultProps, PropDefs = PropsDefinition<Props>>(selector: FunctionalComponentOptions<Props, PropDefs>): Wrapper<Vue>
105
+ find<el extends Element>(selector: string): Wrapper<Vue, el>
106
+ find (selector: RefSelector): Wrapper<Vue>
107
+ find (selector: NameSelector): Wrapper<Vue>
108
+
109
+ findAll<R extends Vue> (selector: VueClass<R>): WrapperArray<R>
110
+ findAll<R extends Vue> (selector: ComponentOptions$1<R>): WrapperArray<R>
111
+ findAll<Props = DefaultProps, PropDefs = PropsDefinition<Props>>(selector: FunctionalComponentOptions<Props, PropDefs>): WrapperArray<Vue>
112
+ findAll (selector: string): WrapperArray<Vue>
113
+ findAll (selector: RefSelector): WrapperArray<Vue>
114
+ findAll (selector: NameSelector): WrapperArray<Vue>
115
+
116
+ findComponent<R extends Vue> (selector: VueClass<R>): Wrapper<R>
117
+ findComponent<R extends Vue> (selector: ComponentOptions$1<R>): Wrapper<R>
118
+ findComponent<Props = DefaultProps, PropDefs = PropsDefinition<Props>>(selector: FunctionalComponentOptions<Props, PropDefs>): Wrapper<Vue>
119
+ findComponent (selector: RefSelector): Wrapper<Vue>
120
+ findComponent (selector: NameSelector): Wrapper<Vue>
121
+
122
+ findAllComponents<R extends Vue> (selector: VueClass<R>): WrapperArray<R>
123
+ findAllComponents<R extends Vue> (selector: ComponentOptions$1<R>): WrapperArray<R>
124
+ findAllComponents<Props = DefaultProps, PropDefs = PropsDefinition<Props>>(selector: FunctionalComponentOptions<Props, PropDefs>): WrapperArray<Vue>
125
+ findAllComponents(selector: RefSelector): WrapperArray<Vue>
126
+ findAllComponents(selector: NameSelector): WrapperArray<Vue>
127
+
128
+ html (): string
129
+ text (): string
130
+ name (): string
131
+
132
+ emitted (): { [name: string]: Array<Array<any>>|undefined }
133
+ emitted (event: string): Array<any>|undefined
134
+ emittedByOrder (): Array<{ name: string, args: Array<any> }>
135
+ }
136
+
137
+ interface WrapperArray<V extends Vue> extends BaseWrapper {
138
+ readonly length: number;
139
+ readonly wrappers: Array<Wrapper<V>>;
140
+
141
+ at(index: number): Wrapper<V>;
142
+ filter(
143
+ predicate: (
144
+ value: Wrapper<V>,
145
+ index: number,
146
+ array: Wrapper<V>[]
147
+ ) => any
148
+ ): WrapperArray<Vue>;
149
+ }
150
+
151
+ interface WrapperOptions {
152
+ attachedToDocument?: boolean
153
+ }
154
+
155
+ interface VueTestUtilsConfigOptions {
156
+ stubs: Record<string, Component | boolean | string>
157
+ mocks: Record<string, any>
158
+ methods: Record<string, Function>
159
+ provide?: Record<string, any>,
160
+ showDeprecationWarnings?: boolean
161
+ deprecationWarningHandler?: Function
162
+ }
163
+
164
+ /**
165
+ * Type for component passed to "mount"
166
+ *
167
+ * @interface VueComponent
168
+ * @example
169
+ * import Hello from './Hello.vue'
170
+ * ^^^^^ this type
171
+ * mount(Hello)
172
+ */
173
+ declare type VueComponent = Vue.ComponentOptions<any> | Vue.VueConstructor;
174
+ /**
175
+ * Options to pass to the component when creating it, like
176
+ * props.
177
+ *
178
+ * @interface ComponentOptions
179
+ */
180
+ declare type ComponentOptions = Record<string, unknown>;
181
+ declare type VueLocalComponents = Record<string, VueComponent>;
182
+ declare type VueFilters = {
183
+ [key: string]: (value: string) => string;
184
+ };
185
+ declare type VueMixin = unknown;
186
+ declare type VueMixins = VueMixin | VueMixin[];
187
+ declare type VuePluginOptions = unknown;
188
+ declare type VuePlugin = unknown | [unknown, VuePluginOptions];
189
+ /**
190
+ * A single Vue plugin or a list of plugins to register
191
+ */
192
+ declare type VuePlugins = VuePlugin[];
193
+ /**
194
+ * Additional Vue services to register while mounting the component, like
195
+ * local components, plugins, etc.
196
+ *
197
+ * @interface MountOptionsExtensions
198
+ * @see https://github.com/cypress-io/cypress/tree/develop/npm/vue#examples
199
+ */
200
+ interface MountOptionsExtensions {
201
+ /**
202
+ * Extra local components
203
+ *
204
+ * @memberof MountOptionsExtensions
205
+ * @see https://github.com/cypress-io/cypress/tree/develop/npm/vue#examples
206
+ * @example
207
+ * import Hello from './Hello.vue'
208
+ * // imagine Hello needs AppComponent
209
+ * // that it uses in its template like <app-component ... />
210
+ * // during testing we can replace it with a mock component
211
+ * const appComponent = ...
212
+ * const components = {
213
+ * 'app-component': appComponent
214
+ * },
215
+ * mount(Hello, { extensions: { components }})
216
+ */
217
+ components?: VueLocalComponents;
218
+ /**
219
+ * Optional Vue filters to install while mounting the component
220
+ *
221
+ * @memberof MountOptionsExtensions
222
+ * @see https://github.com/cypress-io/cypress/tree/develop/npm/vue#examples
223
+ * @example
224
+ * const filters = {
225
+ * reverse: (s) => s.split('').reverse().join(''),
226
+ * }
227
+ * mount(Hello, { extensions: { filters }})
228
+ */
229
+ filters?: VueFilters;
230
+ /**
231
+ * Optional Vue mixin(s) to install when mounting the component
232
+ *
233
+ * @memberof MountOptionsExtensions
234
+ * @alias mixins
235
+ * @see https://github.com/cypress-io/cypress/tree/develop/npm/vue#examples
236
+ */
237
+ mixin?: VueMixins;
238
+ /**
239
+ * Optional Vue mixin(s) to install when mounting the component
240
+ *
241
+ * @memberof MountOptionsExtensions
242
+ * @alias mixin
243
+ * @see https://github.com/cypress-io/cypress/tree/develop/npm/vue#examples
244
+ */
245
+ mixins?: VueMixins;
246
+ /**
247
+ * A single plugin or multiple plugins.
248
+ *
249
+ * @see https://github.com/cypress-io/cypress/tree/develop/npm/vue#examples
250
+ * @alias plugins
251
+ * @memberof MountOptionsExtensions
252
+ */
253
+ use?: VuePlugins;
254
+ /**
255
+ * A single plugin or multiple plugins.
256
+ *
257
+ * @see https://github.com/cypress-io/cypress/tree/develop/npm/vue#examples
258
+ * @alias use
259
+ * @memberof MountOptionsExtensions
260
+ */
261
+ plugins?: VuePlugins;
262
+ }
263
+ /**
264
+ * Options controlling how the component is going to be mounted,
265
+ * including global Vue plugins and extensions.
266
+ *
267
+ * @interface MountOptions
268
+ */
269
+ interface MountOptions {
270
+ /**
271
+ * Vue instance to use.
272
+ *
273
+ * @deprecated
274
+ * @memberof MountOptions
275
+ */
276
+ vue: unknown;
277
+ /**
278
+ * Extra Vue plugins, mixins, local components to register while
279
+ * mounting this component
280
+ *
281
+ * @memberof MountOptions
282
+ * @see https://github.com/cypress-io/cypress/tree/develop/npm/vue#examples
283
+ */
284
+ extensions: MountOptionsExtensions;
285
+ }
286
+ /**
287
+ * Utility type for union of options passed to "mount(..., options)"
288
+ */
289
+ declare type MountOptionsArgument = Partial<ComponentOptions & MountOptions & VueTestUtilsConfigOptions>;
290
+ declare global {
291
+ namespace Cypress {
292
+ interface Cypress {
293
+ /**
294
+ * Mounted Vue instance is available under Cypress.vue
295
+ * @memberof Cypress
296
+ * @example
297
+ * mount(Greeting)
298
+ * .then(() => {
299
+ * Cypress.vue.message = 'Hello There'
300
+ * })
301
+ * // new message is displayed
302
+ * cy.contains('Hello There').should('be.visible')
303
+ */
304
+ vue: Vue;
305
+ vueWrapper: Wrapper<Vue>;
306
+ }
307
+ }
308
+ }
309
+ /**
310
+ * Mounts a Vue component inside Cypress browser.
311
+ * @param {VueComponent} component imported from Vue file
312
+ * @param {MountOptionsArgument} optionsOrProps used to pass options to component being mounted
313
+ * @returns {Cypress.Chainable<{wrapper: Wrapper<T>, component: T}
314
+ * @example
315
+ * import { mount } from '@cypress/vue'
316
+ * import { Stepper } from './Stepper.vue'
317
+ *
318
+ * it('mounts', () => {
319
+ * cy.mount(Stepper)
320
+ * cy.get('[data-cy=increment]').click()
321
+ * cy.get('[data-cy=counter]').should('have.text', '1')
322
+ * })
323
+ * @see {@link https://on.cypress.io/mounting-vue} for more details.
324
+ *
325
+ */
326
+ declare const mount: (component: VueComponent, optionsOrProps?: MountOptionsArgument) => Cypress.Chainable<{
327
+ wrapper: Wrapper<Vue, Element>;
328
+ component: Wrapper<Vue, Element>['vm'];
329
+ }>;
330
+ /**
331
+ * Helper function for mounting a component quickly in test hooks.
332
+ * @example
333
+ * import {mountCallback} from '@cypress/vue2'
334
+ * beforeEach(mountVue(component, options))
335
+ *
336
+ * Removed as of Cypress 11.0.0.
337
+ * @see https://on.cypress.io/migration-11-0-0-component-testing-updates
338
+ */
339
+ declare const mountCallback: (component: VueComponent, options?: MountOptionsArgument) => () => void;
340
+
341
+ export { mount, mountCallback };
package/vue2/package.json CHANGED
@@ -11,13 +11,11 @@
11
11
  "test": "echo \"Tests for @cypress/vue2 are run from system-tests\"",
12
12
  "watch": "yarn build --watch --watch.exclude ./dist/**/*"
13
13
  },
14
- "dependencies": {
15
- "@vue/test-utils": "^1.1.3"
16
- },
17
14
  "devDependencies": {
18
15
  "@cypress/mount-utils": "0.0.0-development",
19
16
  "@rollup/plugin-json": "^4.1.0",
20
17
  "@rollup/plugin-replace": "^2.3.1",
18
+ "@vue/test-utils": "^1.3.1",
21
19
  "tslib": "^2.1.0",
22
20
  "typescript": "^4.7.4",
23
21
  "vue": "2.6.12"
@@ -1,112 +0,0 @@
1
- /// <reference types="cypress" />
2
- /// <reference types="cypress" />
3
- import 'zone.js';
4
- import 'zone.js/testing';
5
- import { Type } from '@angular/core';
6
- import { ComponentFixture, TestModuleMetadata } from '@angular/core/testing';
7
- /**
8
- * Additional module configurations needed while mounting the component, like
9
- * providers, declarations, imports and even component @Inputs()
10
- *
11
- *
12
- * @interface MountConfig
13
- * @see https://angular.io/api/core/testing/TestModuleMetadata
14
- */
15
- export interface MountConfig<T> extends TestModuleMetadata {
16
- /**
17
- * @memberof MountConfig
18
- * @description flag to automatically create a cy.spy() for every component @Output() property
19
- * @example
20
- * export class ButtonComponent {
21
- * @Output clicked = new EventEmitter()
22
- * }
23
- *
24
- * cy.mount(ButtonComponent, { autoSpyOutputs: true })
25
- * cy.get('@clickedSpy).should('have.been.called')
26
- */
27
- autoSpyOutputs?: boolean;
28
- /**
29
- * @memberof MountConfig
30
- * @description flag defaulted to true to automatically detect changes in your components
31
- */
32
- autoDetectChanges?: boolean;
33
- /**
34
- * @memberof MountConfig
35
- * @example
36
- * import { ButtonComponent } from 'button/button.component'
37
- * it('renders a button with Save text', () => {
38
- * cy.mount(ButtonComponent, { componentProperties: { text: 'Save' }})
39
- * cy.get('button').contains('Save')
40
- * })
41
- *
42
- * it('renders a button with a cy.spy() replacing EventEmitter', () => {
43
- * cy.mount(ButtonComponent, {
44
- * componentProperties: {
45
- * clicked: cy.spy().as('mySpy)
46
- * }
47
- * })
48
- * cy.get('button').click()
49
- * cy.get('@mySpy').should('have.been.called')
50
- * })
51
- */
52
- componentProperties?: Partial<{
53
- [P in keyof T]: T[P];
54
- }>;
55
- }
56
- /**
57
- * Type that the `mount` function returns
58
- * @type MountResponse<T>
59
- */
60
- export declare type MountResponse<T> = {
61
- /**
62
- * Fixture for debugging and testing a component.
63
- *
64
- * @memberof MountResponse
65
- * @see https://angular.io/api/core/testing/ComponentFixture
66
- */
67
- fixture: ComponentFixture<T>;
68
- /**
69
- * The instance of the root component class
70
- *
71
- * @memberof MountResponse
72
- * @see https://angular.io/api/core/testing/ComponentFixture#componentInstance
73
- */
74
- component: T;
75
- };
76
- /**
77
- * Mounts an Angular component inside Cypress browser
78
- *
79
- * @param {Type<T> | string} component Angular component being mounted or its template
80
- * @param {MountConfig<T>} config configuration used to configure the TestBed
81
- * @example
82
- * import { HelloWorldComponent } from 'hello-world/hello-world.component'
83
- * import { MyService } from 'services/my.service'
84
- * import { SharedModule } from 'shared/shared.module';
85
- * import { mount } from '@cypress/angular'
86
- * it('can mount', () => {
87
- * mount(HelloWorldComponent, {
88
- * providers: [MyService],
89
- * imports: [SharedModule]
90
- * })
91
- * cy.get('h1').contains('Hello World')
92
- * })
93
- *
94
- * or
95
- *
96
- * it('can mount with template', () => {
97
- * mount('<app-hello-world></app-hello-world>', {
98
- * declarations: [HelloWorldComponent],
99
- * providers: [MyService],
100
- * imports: [SharedModule]
101
- * })
102
- * })
103
- * @returns Cypress.Chainable<MountResponse<T>>
104
- */
105
- export declare function mount<T>(component: Type<T> | string, config?: MountConfig<T>): Cypress.Chainable<MountResponse<T>>;
106
- /**
107
- * Creates a new Event Emitter and then spies on it's `emit` method
108
- *
109
- * @param {string} alias name you want to use for your cy.spy() alias
110
- * @returns EventEmitter<T>
111
- */
112
- export declare const createOutputSpy: <T>(alias: string) => any;