cypress 10.11.0 → 11.0.0
Sign up to get free protection for your applications and to get access to all the features.
- package/angular/CHANGELOG.md +20 -0
- package/angular/dist/index.d.ts +124 -1
- package/angular/dist/index.js +59 -59
- package/lib/cli.js +15 -1
- package/lib/tasks/download.js +3 -7
- package/lib/util.js +2 -2
- package/mount-utils/CHANGELOG.md +14 -0
- package/mount-utils/README.md +5 -23
- package/mount-utils/dist/index.d.ts +25 -39
- package/mount-utils/dist/index.js +33 -112
- package/mount-utils/package.json +1 -0
- package/package.json +3 -3
- package/react/CHANGELOG.md +27 -0
- package/react/README.md +2 -22
- package/react/dist/cypress-react.cjs.js +92 -219
- package/react/dist/cypress-react.esm-bundler.js +92 -220
- package/react/dist/index.d.ts +111 -4
- package/react18/CHANGELOG.md +13 -0
- package/react18/dist/cypress-react.cjs.js +117 -180
- package/react18/dist/cypress-react.esm-bundler.js +103 -167
- package/react18/dist/index.d.ts +78 -6
- package/react18/package.json +1 -0
- package/svelte/CHANGELOG.md +20 -0
- package/svelte/dist/cypress-svelte.cjs.js +19 -114
- package/svelte/dist/cypress-svelte.esm-bundler.js +19 -114
- package/svelte/dist/index.d.ts +201 -1
- package/types/cypress.d.ts +18 -10
- package/vue/CHANGELOG.md +34 -0
- package/vue/README.md +4 -8
- package/vue/dist/cypress-vue.cjs.js +68 -151
- package/vue/dist/cypress-vue.esm-bundler.js +68 -151
- package/vue/dist/index.d.ts +1352 -104
- package/vue/package.json +1 -1
- package/vue2/CHANGELOG.md +27 -0
- package/vue2/README.md +3 -7
- package/vue2/dist/cypress-vue2.cjs.js +87 -211
- package/vue2/dist/cypress-vue2.esm-bundler.js +86 -210
- package/vue2/dist/index.d.ts +341 -172
- package/vue2/package.json +1 -3
- package/angular/dist/mount.d.ts +0 -112
- package/react/dist/createMount.d.ts +0 -31
- package/react/dist/getDisplayName.d.ts +0 -8
- package/react/dist/mount.d.ts +0 -8
- package/react/dist/mountHook.d.ts +0 -12
- package/react/dist/types.d.ts +0 -45
- package/svelte/dist/mount.d.ts +0 -30
- package/vue/dist/@vue/test-utils/baseWrapper.d.ts +0 -63
- package/vue/dist/@vue/test-utils/components/RouterLinkStub.d.ts +0 -21
- package/vue/dist/@vue/test-utils/config.d.ts +0 -30
- package/vue/dist/@vue/test-utils/constants/dom-events.d.ts +0 -900
- package/vue/dist/@vue/test-utils/createDomEvent.d.ts +0 -9
- package/vue/dist/@vue/test-utils/domWrapper.d.ts +0 -18
- package/vue/dist/@vue/test-utils/emit.d.ts +0 -5
- package/vue/dist/@vue/test-utils/errorWrapper.d.ts +0 -1
- package/vue/dist/@vue/test-utils/index.d.ts +0 -11
- package/vue/dist/@vue/test-utils/interfaces/wrapperLike.d.ts +0 -56
- package/vue/dist/@vue/test-utils/mount.d.ts +0 -35
- package/vue/dist/@vue/test-utils/stubs.d.ts +0 -22
- package/vue/dist/@vue/test-utils/types.d.ts +0 -125
- package/vue/dist/@vue/test-utils/utils/autoUnmount.d.ts +0 -5
- package/vue/dist/@vue/test-utils/utils/compileSlots.d.ts +0 -2
- package/vue/dist/@vue/test-utils/utils/componentName.d.ts +0 -4
- package/vue/dist/@vue/test-utils/utils/find.d.ts +0 -10
- package/vue/dist/@vue/test-utils/utils/flushPromises.d.ts +0 -1
- package/vue/dist/@vue/test-utils/utils/getRootNodes.d.ts +0 -2
- package/vue/dist/@vue/test-utils/utils/isElement.d.ts +0 -1
- package/vue/dist/@vue/test-utils/utils/isElementVisible.d.ts +0 -6
- package/vue/dist/@vue/test-utils/utils/matchName.d.ts +0 -1
- package/vue/dist/@vue/test-utils/utils/stringifyNode.d.ts +0 -1
- package/vue/dist/@vue/test-utils/utils/vueCompatSupport.d.ts +0 -8
- package/vue/dist/@vue/test-utils/utils/vueShared.d.ts +0 -3
- package/vue/dist/@vue/test-utils/utils.d.ts +0 -13
- package/vue/dist/@vue/test-utils/vueWrapper.d.ts +0 -35
- package/vue/dist/@vue/test-utils/wrapperFactory.d.ts +0 -14
package/vue2/dist/index.d.ts
CHANGED
@@ -1,172 +1,341 @@
|
|
1
|
-
/// <reference types="cypress" />
|
2
|
-
|
3
|
-
import Vue from 'vue';
|
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
|
-
|
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"
|
package/angular/dist/mount.d.ts
DELETED
@@ -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;
|