cypress 13.2.0 → 13.3.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (46) hide show
  1. package/angular/angular/README.md +10 -0
  2. package/angular/angular/dist/index.d.ts +128 -0
  3. package/angular/angular/dist/index.js +333 -0
  4. package/angular/angular/package.json +77 -0
  5. package/angular/package.json +9 -1
  6. package/lib/exec/spawn.js +1 -1
  7. package/lib/util.js +1 -1
  8. package/mount-utils/mount-utils/README.md +140 -0
  9. package/mount-utils/mount-utils/dist/index.d.ts +40 -0
  10. package/mount-utils/mount-utils/dist/index.js +68 -0
  11. package/mount-utils/mount-utils/package.json +46 -0
  12. package/mount-utils/package.json +10 -1
  13. package/package.json +20 -4
  14. package/react/package.json +13 -0
  15. package/react/react/README.md +14 -0
  16. package/react/react/dist/cypress-react.cjs.js +943 -0
  17. package/react/react/dist/cypress-react.esm-bundler.js +917 -0
  18. package/react/react/dist/index.d.ts +111 -0
  19. package/react/react/package.json +111 -0
  20. package/react18/package.json +10 -0
  21. package/react18/react18/README.md +7 -0
  22. package/react18/react18/dist/cypress-react.cjs.js +592 -0
  23. package/react18/react18/dist/cypress-react.esm-bundler.js +569 -0
  24. package/react18/react18/dist/index.d.ts +78 -0
  25. package/react18/react18/package.json +71 -0
  26. package/svelte/package.json +13 -1
  27. package/svelte/svelte/README.md +15 -0
  28. package/svelte/svelte/dist/cypress-svelte.cjs.js +122 -0
  29. package/svelte/svelte/dist/cypress-svelte.esm-bundler.js +120 -0
  30. package/svelte/svelte/dist/index.d.ts +201 -0
  31. package/svelte/svelte/package.json +56 -0
  32. package/types/cypress.d.ts +2 -2
  33. package/vue/package.json +13 -1
  34. package/vue/vue/README.md +14 -0
  35. package/vue/vue/dist/cypress-vue.cjs.js +8582 -0
  36. package/vue/vue/dist/cypress-vue.esm-bundler.js +8560 -0
  37. package/vue/vue/dist/index.d.ts +1392 -0
  38. package/vue/vue/package.json +96 -0
  39. package/vue2/dist/cypress-vue2.cjs.js +1 -1
  40. package/vue2/dist/cypress-vue2.esm-bundler.js +1 -1
  41. package/vue2/package.json +13 -1
  42. package/vue2/vue2/README.md +7 -0
  43. package/vue2/vue2/dist/cypress-vue2.cjs.js +20045 -0
  44. package/vue2/vue2/dist/cypress-vue2.esm-bundler.js +20042 -0
  45. package/vue2/vue2/dist/index.d.ts +364 -0
  46. package/vue2/vue2/package.json +65 -0
@@ -0,0 +1,364 @@
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 VueDirectives = {
186
+ [key: string]: Function | Object;
187
+ };
188
+ declare type VueMixin = unknown;
189
+ declare type VueMixins = VueMixin | VueMixin[];
190
+ declare type VuePluginOptions = unknown;
191
+ declare type VuePlugin = unknown | [unknown, VuePluginOptions];
192
+ /**
193
+ * A single Vue plugin or a list of plugins to register
194
+ */
195
+ declare type VuePlugins = VuePlugin[];
196
+ /**
197
+ * Additional Vue services to register while mounting the component, like
198
+ * local components, plugins, etc.
199
+ *
200
+ * @interface MountOptionsExtensions
201
+ * @see https://github.com/cypress-io/cypress/tree/develop/npm/vue#examples
202
+ */
203
+ interface MountOptionsExtensions {
204
+ /**
205
+ * Extra local components
206
+ *
207
+ * @memberof MountOptionsExtensions
208
+ * @see https://github.com/cypress-io/cypress/tree/develop/npm/vue#examples
209
+ * @example
210
+ * import Hello from './Hello.vue'
211
+ * // imagine Hello needs AppComponent
212
+ * // that it uses in its template like <app-component ... />
213
+ * // during testing we can replace it with a mock component
214
+ * const appComponent = ...
215
+ * const components = {
216
+ * 'app-component': appComponent
217
+ * },
218
+ * mount(Hello, { extensions: { components }})
219
+ */
220
+ components?: VueLocalComponents;
221
+ /**
222
+ * Optional Vue filters to install while mounting the component
223
+ *
224
+ * @memberof MountOptionsExtensions
225
+ * @see https://github.com/cypress-io/cypress/tree/develop/npm/vue#examples
226
+ * @example
227
+ * const filters = {
228
+ * reverse: (s) => s.split('').reverse().join(''),
229
+ * }
230
+ * mount(Hello, { extensions: { filters }})
231
+ */
232
+ filters?: VueFilters;
233
+ /**
234
+ * Optional Vue mixin(s) to install when mounting the component
235
+ *
236
+ * @memberof MountOptionsExtensions
237
+ * @alias mixins
238
+ * @see https://github.com/cypress-io/cypress/tree/develop/npm/vue#examples
239
+ */
240
+ mixin?: VueMixins;
241
+ /**
242
+ * Optional Vue mixin(s) to install when mounting the component
243
+ *
244
+ * @memberof MountOptionsExtensions
245
+ * @alias mixin
246
+ * @see https://github.com/cypress-io/cypress/tree/develop/npm/vue#examples
247
+ */
248
+ mixins?: VueMixins;
249
+ /**
250
+ * A single plugin or multiple plugins.
251
+ *
252
+ * @see https://github.com/cypress-io/cypress/tree/develop/npm/vue#examples
253
+ * @alias plugins
254
+ * @memberof MountOptionsExtensions
255
+ */
256
+ use?: VuePlugins;
257
+ /**
258
+ * A single plugin or multiple plugins.
259
+ *
260
+ * @see https://github.com/cypress-io/cypress/tree/develop/npm/vue#examples
261
+ * @alias use
262
+ * @memberof MountOptionsExtensions
263
+ */
264
+ plugins?: VuePlugins;
265
+ /**
266
+ * Optional Vue directives to install while mounting the component
267
+ *
268
+ * @memberof MountOptionsExtensions
269
+ * @see https://github.com/cypress-io/cypress/tree/develop/npm/vue#examples
270
+ * @example
271
+ * const directives = {
272
+ * custom: {
273
+ * name: 'custom',
274
+ * bind (el, binding) {
275
+ * el.dataset['custom'] = binding.value
276
+ * },
277
+ * unbind (el) {
278
+ * el.removeAttribute('data-custom')
279
+ * },
280
+ * },
281
+ * }
282
+ * mount(Hello, { extensions: { directives }})
283
+ */
284
+ directives?: VueDirectives;
285
+ }
286
+ /**
287
+ * Options controlling how the component is going to be mounted,
288
+ * including global Vue plugins and extensions.
289
+ *
290
+ * @interface MountOptions
291
+ */
292
+ interface MountOptions {
293
+ /**
294
+ * Vue instance to use.
295
+ *
296
+ * @deprecated
297
+ * @memberof MountOptions
298
+ */
299
+ vue: unknown;
300
+ /**
301
+ * Extra Vue plugins, mixins, local components to register while
302
+ * mounting this component
303
+ *
304
+ * @memberof MountOptions
305
+ * @see https://github.com/cypress-io/cypress/tree/develop/npm/vue#examples
306
+ */
307
+ extensions: MountOptionsExtensions;
308
+ }
309
+ /**
310
+ * Utility type for union of options passed to "mount(..., options)"
311
+ */
312
+ declare type MountOptionsArgument = Partial<ComponentOptions & MountOptions & VueTestUtilsConfigOptions>;
313
+ declare global {
314
+ namespace Cypress {
315
+ interface Cypress {
316
+ /**
317
+ * Mounted Vue instance is available under Cypress.vue
318
+ * @memberof Cypress
319
+ * @example
320
+ * mount(Greeting)
321
+ * .then(() => {
322
+ * Cypress.vue.message = 'Hello There'
323
+ * })
324
+ * // new message is displayed
325
+ * cy.contains('Hello There').should('be.visible')
326
+ */
327
+ vue: Vue;
328
+ vueWrapper: Wrapper<Vue>;
329
+ }
330
+ }
331
+ }
332
+ /**
333
+ * Mounts a Vue component inside Cypress browser.
334
+ * @param {VueComponent} component imported from Vue file
335
+ * @param {MountOptionsArgument} optionsOrProps used to pass options to component being mounted
336
+ * @returns {Cypress.Chainable<{wrapper: Wrapper<T>, component: T}
337
+ * @example
338
+ * import { mount } from '@cypress/vue'
339
+ * import { Stepper } from './Stepper.vue'
340
+ *
341
+ * it('mounts', () => {
342
+ * cy.mount(Stepper)
343
+ * cy.get('[data-cy=increment]').click()
344
+ * cy.get('[data-cy=counter]').should('have.text', '1')
345
+ * })
346
+ * @see {@link https://on.cypress.io/mounting-vue} for more details.
347
+ *
348
+ */
349
+ declare const mount: (component: VueComponent, optionsOrProps?: MountOptionsArgument) => Cypress.Chainable<{
350
+ wrapper: Wrapper<Vue, Element>;
351
+ component: Wrapper<Vue, Element>['vm'];
352
+ }>;
353
+ /**
354
+ * Helper function for mounting a component quickly in test hooks.
355
+ * @example
356
+ * import {mountCallback} from '@cypress/vue2'
357
+ * beforeEach(mountVue(component, options))
358
+ *
359
+ * Removed as of Cypress 11.0.0.
360
+ * @see https://on.cypress.io/migration-11-0-0-component-testing-updates
361
+ */
362
+ declare const mountCallback: (component: VueComponent, options?: MountOptionsArgument) => () => void;
363
+
364
+ export { mount, mountCallback };
@@ -0,0 +1,65 @@
1
+ {
2
+ "name": "@cypress/vue2",
3
+ "version": "0.0.0-development",
4
+ "description": "Browser-based Component Testing for Vue.js@2 with Cypress.io ✌️🌲",
5
+ "main": "dist/cypress-vue2.cjs.js",
6
+ "scripts": {
7
+ "check-ts": "tsc --noEmit",
8
+ "build": "rimraf dist && yarn rollup -c rollup.config.mjs",
9
+ "postbuild": "node ../../scripts/sync-exported-npm-with-cli.js",
10
+ "test": "echo \"Tests for @cypress/vue2 are run from system-tests\"",
11
+ "watch": "yarn build --watch --watch.exclude ./dist/**/*",
12
+ "lint": "eslint --ext .js,.jsx,.ts,.tsx,.json,.vue .",
13
+ "test-ci": "node ../../scripts/run-ct-examples.js --examplesList=./examples.env"
14
+ },
15
+ "devDependencies": {
16
+ "@cypress/mount-utils": "0.0.0-development",
17
+ "@rollup/plugin-json": "^4.1.0",
18
+ "@rollup/plugin-replace": "^2.3.1",
19
+ "@vue/test-utils": "^1.3.1",
20
+ "tslib": "^2.1.0",
21
+ "typescript": "^4.7.4",
22
+ "vue": "2.6.12"
23
+ },
24
+ "peerDependencies": {
25
+ "cypress": ">=4.5.0",
26
+ "vue": "^2.0.0"
27
+ },
28
+ "files": [
29
+ "dist/**/*",
30
+ "src/**/*.js"
31
+ ],
32
+ "engines": {
33
+ "node": ">=8"
34
+ },
35
+ "types": "dist/index.d.ts",
36
+ "license": "MIT",
37
+ "repository": {
38
+ "type": "git",
39
+ "url": "https://github.com/cypress-io/cypress.git"
40
+ },
41
+ "homepage": "https://github.com/cypress-io/cypress/blob/develop/npm/vue/#readme",
42
+ "bugs": "https://github.com/cypress-io/cypress/issues/new?assignees=&labels=npm%3A%20%40cypress%2Fvue&template=1-bug-report.md&title=",
43
+ "keywords": [
44
+ "cypress",
45
+ "vue"
46
+ ],
47
+ "unpkg": "dist/cypress-vue2.browser.js",
48
+ "module": "dist/cypress-vue2.esm-bundler.js",
49
+ "publishConfig": {
50
+ "access": "public"
51
+ },
52
+ "nx": {
53
+ "targets": {
54
+ "build": {
55
+ "outputs": [
56
+ "{workspaceRoot}/cli/vue2",
57
+ "{projectRoot}/dist"
58
+ ]
59
+ }
60
+ },
61
+ "implicitDependencies": [
62
+ "!cypress"
63
+ ]
64
+ }
65
+ }