cypress 10.3.0 → 10.5.0
Sign up to get free protection for your applications and to get access to all the features.
- package/angular/CHANGELOG.md +55 -0
- package/angular/README.md +154 -0
- package/angular/dist/index.d.ts +1 -0
- package/angular/dist/index.js +263 -0
- package/angular/dist/mount.d.ts +111 -0
- package/angular/package.json +70 -0
- package/lib/exec/open.js +7 -2
- package/lib/exec/spawn.js +7 -2
- package/mount-utils/CHANGELOG.md +7 -1
- package/mount-utils/README.md +7 -0
- package/mount-utils/dist/index.js +8 -1
- package/mount-utils/package.json +1 -0
- package/package.json +26 -10
- package/react/CHANGELOG.md +13 -19
- package/react/README.md +28 -323
- package/react/dist/createMount.d.ts +28 -0
- package/react/dist/cypress-react.cjs.js +643 -99
- package/react/dist/cypress-react.esm-bundler.js +640 -100
- package/react/dist/getDisplayName.d.ts +1 -1
- package/react/dist/index.d.ts +2 -0
- package/react/dist/mount.d.ts +5 -141
- package/react/dist/types.d.ts +44 -0
- package/react/package.json +3 -5
- package/react18/CHANGELOG.md +6 -0
- package/react18/dist/cypress-react.cjs.js +633 -0
- package/react18/dist/cypress-react.esm-bundler.js +605 -0
- package/react18/dist/index.d.ts +5 -0
- package/react18/package.json +59 -0
- package/types/cypress.d.ts +24 -3
- package/types/index.d.ts +1 -1
- package/types/{net-stubbing.ts → net-stubbing.d.ts} +0 -0
- package/vue/CHANGELOG.md +16 -17
- package/vue/README.md +17 -607
- package/vue/dist/@vue/test-utils/baseWrapper.d.ts +63 -0
- package/vue/dist/@vue/test-utils/components/RouterLinkStub.d.ts +21 -0
- package/vue/dist/@vue/test-utils/config.d.ts +30 -0
- package/vue/dist/@vue/test-utils/constants/dom-events.d.ts +900 -0
- package/vue/dist/@vue/test-utils/createDomEvent.d.ts +9 -0
- package/vue/dist/@vue/test-utils/domWrapper.d.ts +18 -0
- package/vue/dist/@vue/test-utils/emit.d.ts +5 -0
- package/vue/dist/@vue/test-utils/errorWrapper.d.ts +1 -0
- package/vue/dist/@vue/test-utils/index.d.ts +11 -0
- package/vue/dist/@vue/test-utils/interfaces/wrapperLike.d.ts +56 -0
- package/vue/dist/@vue/test-utils/mount.d.ts +35 -0
- package/vue/dist/@vue/test-utils/stubs.d.ts +22 -0
- package/vue/dist/@vue/test-utils/types.d.ts +125 -0
- package/vue/dist/@vue/test-utils/utils/autoUnmount.d.ts +5 -0
- package/vue/dist/@vue/test-utils/utils/compileSlots.d.ts +2 -0
- package/vue/dist/@vue/test-utils/utils/componentName.d.ts +4 -0
- package/vue/dist/@vue/test-utils/utils/find.d.ts +10 -0
- package/vue/dist/@vue/test-utils/utils/flushPromises.d.ts +1 -0
- package/vue/dist/@vue/test-utils/utils/getRootNodes.d.ts +2 -0
- package/vue/dist/@vue/test-utils/utils/isElement.d.ts +1 -0
- package/vue/dist/@vue/test-utils/utils/isElementVisible.d.ts +6 -0
- package/vue/dist/@vue/test-utils/utils/matchName.d.ts +1 -0
- package/vue/dist/@vue/test-utils/utils/stringifyNode.d.ts +1 -0
- package/vue/dist/@vue/test-utils/utils/vueCompatSupport.d.ts +8 -0
- package/vue/dist/@vue/test-utils/utils/vueShared.d.ts +3 -0
- package/vue/dist/@vue/test-utils/utils.d.ts +13 -0
- package/vue/dist/@vue/test-utils/vueWrapper.d.ts +35 -0
- package/vue/dist/@vue/test-utils/wrapperFactory.d.ts +14 -0
- package/vue/dist/cypress-vue.cjs.js +5585 -5211
- package/vue/dist/cypress-vue.esm-bundler.js +5586 -5213
- package/vue/dist/index.d.ts +35 -3
- package/vue/package.json +11 -8
- package/vue2/CHANGELOG.md +7 -0
- package/vue2/README.md +11 -627
- package/vue2/dist/cypress-vue2.browser.js +267 -261
- package/vue2/dist/cypress-vue2.cjs.js +266 -260
- package/vue2/dist/cypress-vue2.esm-bundler.js +264 -258
- package/vue2/package.json +1 -1
- package/react/dist/cypress-react.browser.js +0 -497
package/react/dist/index.d.ts
CHANGED
package/react/dist/mount.d.ts
CHANGED
@@ -1,143 +1,7 @@
|
|
1
1
|
/// <reference types="cypress" />
|
2
|
-
import
|
3
|
-
import
|
4
|
-
|
5
|
-
|
6
|
-
* Mount a React component in a blank document; register it as an alias
|
7
|
-
* To access: use an alias or original component reference
|
8
|
-
* @function mount
|
9
|
-
* @param {React.ReactElement} jsx - component to mount
|
10
|
-
* @param {MountOptions} [options] - options, like alias, styles
|
11
|
-
* @see https://github.com/bahmutov/@cypress/react
|
12
|
-
* @see https://glebbahmutov.com/blog/my-vision-for-component-tests/
|
13
|
-
* @example
|
14
|
-
```
|
15
|
-
import Hello from './hello.jsx'
|
16
|
-
import { mount } from '@cypress/react'
|
17
|
-
it('works', () => {
|
18
|
-
mount(<Hello onClick={cy.stub()} />)
|
19
|
-
// use Cypress commands
|
20
|
-
cy.contains('Hello').click()
|
21
|
-
})
|
22
|
-
```
|
23
|
-
**/
|
24
|
-
export declare const mount: (jsx: React.ReactNode, options?: MountOptions) => globalThis.Cypress.Chainable<MountReturn>;
|
25
|
-
/**
|
26
|
-
* Removes the mounted component. Notice this command automatically
|
27
|
-
* queues up the `unmount` into Cypress chain, thus you don't need `.then`
|
28
|
-
* to call it.
|
29
|
-
* @see https://github.com/cypress-io/cypress/tree/develop/npm/react/cypress/component/basic/unmount
|
30
|
-
* @example
|
31
|
-
```
|
32
|
-
import { mount, unmount } from '@cypress/react'
|
33
|
-
it('works', () => {
|
34
|
-
mount(...)
|
35
|
-
// interact with the component using Cypress commands
|
36
|
-
// whenever you want to unmount
|
37
|
-
unmount()
|
38
|
-
})
|
39
|
-
```
|
40
|
-
*/
|
41
|
-
export declare const unmount: (options?: {
|
2
|
+
import React from 'react';
|
3
|
+
import type { MountOptions } from './types';
|
4
|
+
export declare function mount(jsx: React.ReactNode, options?: MountOptions, rerenderKey?: string): Cypress.Chainable<import("./types").MountReturn>;
|
5
|
+
export declare function unmount(options?: {
|
42
6
|
log: boolean;
|
43
|
-
})
|
44
|
-
/**
|
45
|
-
* Creates new instance of `mount` function with default options
|
46
|
-
* @function createMount
|
47
|
-
* @param {MountOptions} [defaultOptions] - defaultOptions for returned `mount` function
|
48
|
-
* @returns new instance of `mount` with assigned options
|
49
|
-
* @example
|
50
|
-
* ```
|
51
|
-
* import Hello from './hello.jsx'
|
52
|
-
* import { createMount } from '@cypress/react'
|
53
|
-
*
|
54
|
-
* const mount = createMount({ strict: true, cssFile: 'path/to/any/css/file.css' })
|
55
|
-
*
|
56
|
-
* it('works', () => {
|
57
|
-
* mount(<Hello />)
|
58
|
-
* // use Cypress commands
|
59
|
-
* cy.get('button').should('have.css', 'color', 'rgb(124, 12, 109)')
|
60
|
-
* })
|
61
|
-
```
|
62
|
-
**/
|
63
|
-
export declare const createMount: (defaultOptions: MountOptions) => (element: React.ReactElement, options?: Partial<StyleOptions & MountReactComponentOptions> | undefined) => globalThis.Cypress.Chainable<MountReturn>;
|
64
|
-
/** @deprecated Should be removed in the next major version */
|
65
|
-
export default mount;
|
66
|
-
export interface ReactModule {
|
67
|
-
name: string;
|
68
|
-
type: string;
|
69
|
-
location: string;
|
70
|
-
source: string;
|
71
|
-
}
|
72
|
-
export interface MountReactComponentOptions {
|
73
|
-
alias: string;
|
74
|
-
ReactDom: typeof ReactDOM;
|
75
|
-
/**
|
76
|
-
* Log the mounting command into Cypress Command Log,
|
77
|
-
* true by default.
|
78
|
-
*/
|
79
|
-
log: boolean;
|
80
|
-
/**
|
81
|
-
* Render component in React [strict mode](https://reactjs.org/docs/strict-mode.html)
|
82
|
-
* It activates additional checks and warnings for child components.
|
83
|
-
*/
|
84
|
-
strict: boolean;
|
85
|
-
}
|
86
|
-
export declare type MountOptions = Partial<StyleOptions & MountReactComponentOptions>;
|
87
|
-
export interface MountReturn {
|
88
|
-
/**
|
89
|
-
* The component that was rendered.
|
90
|
-
*/
|
91
|
-
component: React.ReactNode;
|
92
|
-
/**
|
93
|
-
* Rerenders the specified component with new props. This allows testing of components that store state (`setState`)
|
94
|
-
* or have asynchronous updates (`useEffect`, `useLayoutEffect`).
|
95
|
-
*/
|
96
|
-
rerender: (component: React.ReactNode) => globalThis.Cypress.Chainable<MountReturn>;
|
97
|
-
/**
|
98
|
-
* Removes the mounted component.
|
99
|
-
* @see `unmount`
|
100
|
-
*/
|
101
|
-
unmount: () => globalThis.Cypress.Chainable<JQuery<HTMLElement>>;
|
102
|
-
}
|
103
|
-
/**
|
104
|
-
* The `type` property from the transpiled JSX object.
|
105
|
-
* @example
|
106
|
-
* const { type } = React.createElement('div', null, 'Hello')
|
107
|
-
* const { type } = <div>Hello</div>
|
108
|
-
*/
|
109
|
-
export interface JSX extends Function {
|
110
|
-
displayName: string;
|
111
|
-
}
|
112
|
-
export declare namespace Cypress {
|
113
|
-
interface Cypress {
|
114
|
-
stylesCache: any;
|
115
|
-
React: string;
|
116
|
-
ReactDOM: string;
|
117
|
-
Styles: string;
|
118
|
-
modules: ReactModule[];
|
119
|
-
}
|
120
|
-
interface Chainable<Subject> {
|
121
|
-
state: (key: string) => any;
|
122
|
-
/**
|
123
|
-
* Mount a React component in a blank document; register it as an alias
|
124
|
-
* To access: use an alias or original component reference
|
125
|
-
* @function cy.mount
|
126
|
-
* @param {Object} jsx - component to mount
|
127
|
-
* @param {string} [Component] - alias to use later
|
128
|
-
* @example
|
129
|
-
```
|
130
|
-
import Hello from './hello.jsx'
|
131
|
-
// mount and access by alias
|
132
|
-
cy.mount(<Hello />, 'Hello')
|
133
|
-
// using default alias
|
134
|
-
cy.get('@Component')
|
135
|
-
// using specified alias
|
136
|
-
cy.get('@Hello').its('state').should(...)
|
137
|
-
// using original component
|
138
|
-
cy.get(Hello)
|
139
|
-
```
|
140
|
-
**/
|
141
|
-
get<S = any>(alias: string | symbol | Function, options?: Partial<any>): Chainable<any>;
|
142
|
-
}
|
143
|
-
}
|
7
|
+
}): Cypress.Chainable<undefined>;
|
@@ -0,0 +1,44 @@
|
|
1
|
+
/// <reference types="cypress" />
|
2
|
+
import type React from 'react';
|
3
|
+
import type { StyleOptions } from '@cypress/mount-utils';
|
4
|
+
export interface UnmountArgs {
|
5
|
+
log: boolean;
|
6
|
+
boundComponentMessage?: string;
|
7
|
+
}
|
8
|
+
export declare type MountOptions = Partial<StyleOptions & MountReactComponentOptions>;
|
9
|
+
export interface MountReactComponentOptions {
|
10
|
+
alias: string;
|
11
|
+
ReactDom: typeof import('react-dom');
|
12
|
+
/**
|
13
|
+
* Log the mounting command into Cypress Command Log,
|
14
|
+
* true by default.
|
15
|
+
*/
|
16
|
+
log: boolean;
|
17
|
+
/**
|
18
|
+
* Render component in React [strict mode](https://reactjs.org/docs/strict-mode.html)
|
19
|
+
* It activates additional checks and warnings for child components.
|
20
|
+
*/
|
21
|
+
strict: boolean;
|
22
|
+
}
|
23
|
+
export interface InternalMountOptions {
|
24
|
+
reactDom: typeof import('react-dom');
|
25
|
+
render: (reactComponent: ReturnType<typeof React.createElement>, el: HTMLElement, reactDomToUse: typeof import('react-dom')) => void;
|
26
|
+
unmount: (options: UnmountArgs) => void;
|
27
|
+
cleanup: () => boolean;
|
28
|
+
}
|
29
|
+
export interface MountReturn {
|
30
|
+
/**
|
31
|
+
* The component that was rendered.
|
32
|
+
*/
|
33
|
+
component: React.ReactNode;
|
34
|
+
/**
|
35
|
+
* Rerenders the specified component with new props. This allows testing of components that store state (`setState`)
|
36
|
+
* or have asynchronous updates (`useEffect`, `useLayoutEffect`).
|
37
|
+
*/
|
38
|
+
rerender: (component: React.ReactNode) => globalThis.Cypress.Chainable<MountReturn>;
|
39
|
+
/**
|
40
|
+
* Removes the mounted component.
|
41
|
+
* @see `unmount`
|
42
|
+
*/
|
43
|
+
unmount: (payload: UnmountArgs) => void;
|
44
|
+
}
|
package/react/package.json
CHANGED
@@ -14,17 +14,14 @@
|
|
14
14
|
"test": "yarn cy:run",
|
15
15
|
"watch": "yarn build --watch --watch.exclude ./dist/**/*"
|
16
16
|
},
|
17
|
-
"dependencies": {
|
18
|
-
"debug": "^4.3.2"
|
19
|
-
},
|
20
17
|
"devDependencies": {
|
21
18
|
"@cypress/mount-utils": "0.0.0-development",
|
22
19
|
"@rollup/plugin-commonjs": "^17.1.0",
|
23
20
|
"@rollup/plugin-node-resolve": "^11.1.1",
|
21
|
+
"@types/semver": "7.3.9",
|
24
22
|
"@vitejs/plugin-react": "1.3.1",
|
25
23
|
"axios": "0.21.2",
|
26
24
|
"cypress": "0.0.0-development",
|
27
|
-
"cypress-plugin-snapshots": "1.4.4",
|
28
25
|
"prop-types": "15.7.2",
|
29
26
|
"react": "16.8.6",
|
30
27
|
"react-dom": "16.8.6",
|
@@ -32,8 +29,9 @@
|
|
32
29
|
"react-router-dom": "6.0.0-alpha.1",
|
33
30
|
"rollup": "^2.38.5",
|
34
31
|
"rollup-plugin-typescript2": "^0.29.0",
|
32
|
+
"semver": "^7.3.2",
|
35
33
|
"typescript": "^4.2.3",
|
36
|
-
"vite": "
|
34
|
+
"vite": "3.0.3",
|
37
35
|
"vite-plugin-require-transform": "1.0.3"
|
38
36
|
},
|
39
37
|
"peerDependencies": {
|