cypress 10.3.1 → 10.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (50) hide show
  1. package/angular/CHANGELOG.md +55 -0
  2. package/angular/README.md +154 -0
  3. package/angular/dist/index.d.ts +1 -0
  4. package/angular/dist/index.js +263 -0
  5. package/angular/dist/mount.d.ts +111 -0
  6. package/angular/package.json +70 -0
  7. package/lib/exec/open.js +6 -0
  8. package/lib/tasks/download.js +4 -3
  9. package/mount-utils/CHANGELOG.md +7 -1
  10. package/mount-utils/README.md +7 -0
  11. package/package.json +16 -5
  12. package/react/CHANGELOG.md +20 -19
  13. package/react/README.md +28 -323
  14. package/react/dist/createMount.d.ts +28 -0
  15. package/react/dist/cypress-react.cjs.js +627 -98
  16. package/react/dist/cypress-react.esm-bundler.js +624 -99
  17. package/react/dist/getDisplayName.d.ts +1 -1
  18. package/react/dist/index.d.ts +2 -0
  19. package/react/dist/mount.d.ts +5 -141
  20. package/react/dist/types.d.ts +44 -0
  21. package/react/package.json +3 -5
  22. package/react18/CHANGELOG.md +13 -0
  23. package/react18/dist/cypress-react.cjs.js +633 -0
  24. package/react18/dist/cypress-react.esm-bundler.js +605 -0
  25. package/react18/dist/index.d.ts +5 -0
  26. package/react18/package.json +59 -0
  27. package/types/cypress.d.ts +28 -2
  28. package/types/index.d.ts +1 -1
  29. package/types/{net-stubbing.ts → net-stubbing.d.ts} +0 -0
  30. package/vue/CHANGELOG.md +16 -17
  31. package/vue/README.md +17 -608
  32. package/vue/dist/@vue/test-utils/baseWrapper.d.ts +3 -1
  33. package/vue/dist/@vue/test-utils/config.d.ts +4 -2
  34. package/vue/dist/@vue/test-utils/emit.d.ts +1 -0
  35. package/vue/dist/@vue/test-utils/index.d.ts +2 -1
  36. package/vue/dist/@vue/test-utils/interfaces/wrapperLike.d.ts +2 -2
  37. package/vue/dist/@vue/test-utils/mount.d.ts +2 -0
  38. package/vue/dist/@vue/test-utils/stubs.d.ts +2 -6
  39. package/vue/dist/@vue/test-utils/types.d.ts +1 -1
  40. package/vue/dist/@vue/test-utils/vueWrapper.d.ts +2 -1
  41. package/vue/dist/cypress-vue.cjs.js +5379 -5090
  42. package/vue/dist/cypress-vue.esm-bundler.js +5380 -5091
  43. package/vue/dist/index.d.ts +1 -0
  44. package/vue/package.json +2 -3
  45. package/vue2/CHANGELOG.md +7 -0
  46. package/vue2/README.md +11 -627
  47. package/vue2/dist/cypress-vue2.browser.js +251 -260
  48. package/vue2/dist/cypress-vue2.cjs.js +250 -259
  49. package/vue2/dist/cypress-vue2.esm-bundler.js +248 -257
  50. package/react/dist/cypress-react.browser.js +0 -512
@@ -1,4 +1,4 @@
1
- import { JSX } from './mount';
1
+ import { JSX } from './createMount';
2
2
  /**
3
3
  * Gets the display name of the component when possible.
4
4
  * @param type {JSX} The type object returned from creating the react element.
@@ -1,2 +1,4 @@
1
+ export * from './createMount';
1
2
  export * from './mount';
2
3
  export * from './mountHook';
4
+ export * from './types';
@@ -1,143 +1,7 @@
1
1
  /// <reference types="cypress" />
2
- import * as React from 'react';
3
- import * as ReactDOM from 'react-dom';
4
- import { StyleOptions } from '@cypress/mount-utils';
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
- }) => globalThis.Cypress.Chainable<JQuery<HTMLElement>>;
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
+ }
@@ -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": "2.9.5",
34
+ "vite": "3.0.3",
37
35
  "vite-plugin-require-transform": "1.0.3"
38
36
  },
39
37
  "peerDependencies": {
@@ -0,0 +1,13 @@
1
+ # [@cypress/react18-v1.0.1](https://github.com/cypress-io/cypress/compare/@cypress/react18-v1.0.0...@cypress/react18-v1.0.1) (2022-08-15)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * **react18:** unmount component with react18 API ([#23204](https://github.com/cypress-io/cypress/issues/23204)) ([eab950b](https://github.com/cypress-io/cypress/commit/eab950bec013f9caf5836e3fa58670fde25e2684))
7
+
8
+ # @cypress/react18-v1.0.0 (2022-08-11)
9
+
10
+
11
+ ### Features
12
+
13
+ * React 18 support ([#22876](https://github.com/cypress-io/cypress/issues/22876)) ([f0d3a48](https://github.com/cypress-io/cypress/commit/f0d3a4867907bf6e60468510daa883ccc8dcfb63))