cypress 10.11.0 → 11.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (74) hide show
  1. package/angular/CHANGELOG.md +20 -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 +14 -0
  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 +3 -3
  13. package/react/CHANGELOG.md +27 -0
  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 +13 -0
  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.d.ts +18 -10
  28. package/vue/CHANGELOG.md +34 -0
  29. package/vue/README.md +4 -8
  30. package/vue/dist/cypress-vue.cjs.js +68 -151
  31. package/vue/dist/cypress-vue.esm-bundler.js +68 -151
  32. package/vue/dist/index.d.ts +1352 -104
  33. package/vue/package.json +1 -1
  34. package/vue2/CHANGELOG.md +27 -0
  35. package/vue2/README.md +3 -7
  36. package/vue2/dist/cypress-vue2.cjs.js +87 -211
  37. package/vue2/dist/cypress-vue2.esm-bundler.js +86 -210
  38. package/vue2/dist/index.d.ts +341 -172
  39. package/vue2/package.json +1 -3
  40. package/angular/dist/mount.d.ts +0 -112
  41. package/react/dist/createMount.d.ts +0 -31
  42. package/react/dist/getDisplayName.d.ts +0 -8
  43. package/react/dist/mount.d.ts +0 -8
  44. package/react/dist/mountHook.d.ts +0 -12
  45. package/react/dist/types.d.ts +0 -45
  46. package/svelte/dist/mount.d.ts +0 -30
  47. package/vue/dist/@vue/test-utils/baseWrapper.d.ts +0 -63
  48. package/vue/dist/@vue/test-utils/components/RouterLinkStub.d.ts +0 -21
  49. package/vue/dist/@vue/test-utils/config.d.ts +0 -30
  50. package/vue/dist/@vue/test-utils/constants/dom-events.d.ts +0 -900
  51. package/vue/dist/@vue/test-utils/createDomEvent.d.ts +0 -9
  52. package/vue/dist/@vue/test-utils/domWrapper.d.ts +0 -18
  53. package/vue/dist/@vue/test-utils/emit.d.ts +0 -5
  54. package/vue/dist/@vue/test-utils/errorWrapper.d.ts +0 -1
  55. package/vue/dist/@vue/test-utils/index.d.ts +0 -11
  56. package/vue/dist/@vue/test-utils/interfaces/wrapperLike.d.ts +0 -56
  57. package/vue/dist/@vue/test-utils/mount.d.ts +0 -35
  58. package/vue/dist/@vue/test-utils/stubs.d.ts +0 -22
  59. package/vue/dist/@vue/test-utils/types.d.ts +0 -125
  60. package/vue/dist/@vue/test-utils/utils/autoUnmount.d.ts +0 -5
  61. package/vue/dist/@vue/test-utils/utils/compileSlots.d.ts +0 -2
  62. package/vue/dist/@vue/test-utils/utils/componentName.d.ts +0 -4
  63. package/vue/dist/@vue/test-utils/utils/find.d.ts +0 -10
  64. package/vue/dist/@vue/test-utils/utils/flushPromises.d.ts +0 -1
  65. package/vue/dist/@vue/test-utils/utils/getRootNodes.d.ts +0 -2
  66. package/vue/dist/@vue/test-utils/utils/isElement.d.ts +0 -1
  67. package/vue/dist/@vue/test-utils/utils/isElementVisible.d.ts +0 -6
  68. package/vue/dist/@vue/test-utils/utils/matchName.d.ts +0 -1
  69. package/vue/dist/@vue/test-utils/utils/stringifyNode.d.ts +0 -1
  70. package/vue/dist/@vue/test-utils/utils/vueCompatSupport.d.ts +0 -8
  71. package/vue/dist/@vue/test-utils/utils/vueShared.d.ts +0 -3
  72. package/vue/dist/@vue/test-utils/utils.d.ts +0 -13
  73. package/vue/dist/@vue/test-utils/vueWrapper.d.ts +0 -35
  74. package/vue/dist/@vue/test-utils/wrapperFactory.d.ts +0 -14
@@ -1,31 +0,0 @@
1
- /// <reference types="cypress" />
2
- /// <reference types="cypress" />
3
- /// <reference types="cypress" />
4
- /// <reference types="cypress" />
5
- import * as React from 'react';
6
- import type { InternalMountOptions, MountOptions, MountReturn, UnmountArgs } from './types';
7
- /**
8
- * Create an `mount` function. Performs all the non-React-version specific
9
- * behavior related to mounting. The React-version-specific code
10
- * is injected. This helps us to maintain a consistent public API
11
- * and handle breaking changes in React's rendering API.
12
- *
13
- * This is designed to be consumed by `npm/react{16,17,18}`, and other React adapters,
14
- * or people writing adapters for third-party, custom adapters.
15
- */
16
- export declare const makeMountFn: (type: 'mount' | 'rerender', jsx: React.ReactNode, options?: MountOptions, rerenderKey?: string, internalMountOptions?: InternalMountOptions) => globalThis.Cypress.Chainable<MountReturn>;
17
- /**
18
- * Create an `unmount` function. Performs all the non-React-version specific
19
- * behavior related to unmounting.
20
- *
21
- * This is designed to be consumed by `npm/react{16,17,18}`, and other React adapters,
22
- * or people writing adapters for third-party, custom adapters.
23
- */
24
- export declare const makeUnmountFn: (options: UnmountArgs) => Cypress.Chainable<undefined>;
25
- declare const _mount: (jsx: React.ReactNode, options?: MountOptions) => Cypress.Chainable<MountReturn>;
26
- export declare const createMount: (defaultOptions: MountOptions) => (element: React.ReactElement, options?: MountOptions) => Cypress.Chainable<MountReturn>;
27
- /** @deprecated Should be removed in the next major version */
28
- export default _mount;
29
- export interface JSX extends Function {
30
- displayName: string;
31
- }
@@ -1,8 +0,0 @@
1
- import { JSX } from './createMount';
2
- /**
3
- * Gets the display name of the component when possible.
4
- * @param type {JSX} The type object returned from creating the react element.
5
- * @param fallbackName {string} The alias, or fallback name to use when the name cannot be derived.
6
- * @link https://github.com/facebook/react-devtools/blob/master/backend/getDisplayName.js
7
- */
8
- export default function getDisplayName(type: JSX, fallbackName?: string): string;
@@ -1,8 +0,0 @@
1
- /// <reference types="cypress" />
2
- /// <reference types="cypress" />
3
- import React from 'react';
4
- import type { MountOptions } from './types';
5
- export declare function mount(jsx: React.ReactNode, options?: MountOptions, rerenderKey?: string): Cypress.Chainable<import("./types").MountReturn>;
6
- export declare function unmount(options?: {
7
- log: boolean;
8
- }): Cypress.Chainable<undefined>;
@@ -1,12 +0,0 @@
1
- /// <reference types="cypress" />
2
- /// <reference types="cypress" />
3
- declare type MountHookResult<T> = {
4
- readonly current: T | null | undefined;
5
- readonly error: Error | null;
6
- };
7
- /**
8
- * Mounts a React hook function in a test component for testing.
9
- *
10
- */
11
- export declare const mountHook: <T>(hookFn: (...args: any[]) => T) => Cypress.Chainable<MountHookResult<T>>;
12
- export {};
@@ -1,45 +0,0 @@
1
- /// <reference types="cypress" />
2
- /// <reference types="cypress" />
3
- import type React from 'react';
4
- import type { StyleOptions } from '@cypress/mount-utils';
5
- export interface UnmountArgs {
6
- log: boolean;
7
- boundComponentMessage?: string;
8
- }
9
- export declare type MountOptions = Partial<StyleOptions & MountReactComponentOptions>;
10
- export interface MountReactComponentOptions {
11
- alias: string;
12
- ReactDom: typeof import('react-dom');
13
- /**
14
- * Log the mounting command into Cypress Command Log,
15
- * true by default.
16
- */
17
- log: boolean;
18
- /**
19
- * Render component in React [strict mode](https://reactjs.org/docs/strict-mode.html)
20
- * It activates additional checks and warnings for child components.
21
- */
22
- strict: boolean;
23
- }
24
- export interface InternalMountOptions {
25
- reactDom: typeof import('react-dom');
26
- render: (reactComponent: ReturnType<typeof React.createElement>, el: HTMLElement, reactDomToUse: typeof import('react-dom')) => void;
27
- unmount: (options: UnmountArgs) => void;
28
- cleanup: () => boolean;
29
- }
30
- export interface MountReturn {
31
- /**
32
- * The component that was rendered.
33
- */
34
- component: React.ReactNode;
35
- /**
36
- * Rerenders the specified component with new props. This allows testing of components that store state (`setState`)
37
- * or have asynchronous updates (`useEffect`, `useLayoutEffect`).
38
- */
39
- rerender: (component: React.ReactNode) => globalThis.Cypress.Chainable<MountReturn>;
40
- /**
41
- * Removes the mounted component.
42
- * @see `unmount`
43
- */
44
- unmount: (payload: UnmountArgs) => void;
45
- }
@@ -1,30 +0,0 @@
1
- /// <reference types="cypress" />
2
- /// <reference types="cypress" />
3
- import { StyleOptions } from '@cypress/mount-utils';
4
- import type { ComponentConstructorOptions, ComponentProps, SvelteComponent } from 'svelte';
5
- declare type SvelteConstructor<T> = new (...args: any[]) => T;
6
- declare type SvelteComponentOptions<T extends SvelteComponent> = Omit<ComponentConstructorOptions<ComponentProps<T>>, 'hydrate' | 'target' | '$$inline'>;
7
- export interface MountOptions<T extends SvelteComponent> extends SvelteComponentOptions<T>, Partial<StyleOptions> {
8
- log?: boolean;
9
- }
10
- export interface MountReturn<T extends SvelteComponent> {
11
- component: T;
12
- }
13
- /**
14
- * Mounts a Svelte component inside the Cypress browser
15
- *
16
- * @param {SvelteConstructor<T>} Component Svelte component being mounted
17
- * @param {MountReturn<T extends SvelteComponent>} options options to customize the component being mounted
18
- * @returns Cypress.Chainable<MountReturn>
19
- *
20
- * @example
21
- * import Counter from './Counter.svelte'
22
- * import { mount } from 'cypress/svelte'
23
- *
24
- * it('should render', () => {
25
- * mount(Counter, { props: { count: 42 } })
26
- * cy.get('button').contains(42)
27
- * })
28
- */
29
- export declare function mount<T extends SvelteComponent>(Component: SvelteConstructor<T>, options?: MountOptions<T>): Cypress.Chainable<MountReturn<T>>;
30
- export {};
@@ -1,63 +0,0 @@
1
- import type { TriggerOptions } from './createDomEvent';
2
- import { ComponentInternalInstance, ComponentOptions, ComponentPublicInstance, ComputedOptions, CreateComponentPublicInstance, FunctionalComponent, MethodOptions } from 'vue';
3
- import { DomEventNameWithModifier } from './constants/dom-events';
4
- import type { VueWrapper } from './vueWrapper';
5
- import { DefinedComponent, FindAllComponentsSelector, FindComponentSelector, NameSelector, RefSelector, VueNode } from './types';
6
- import WrapperLike from './interfaces/wrapperLike';
7
- import type { DOMWrapper } from './domWrapper';
8
- export default abstract class BaseWrapper<ElementType extends Node> implements WrapperLike {
9
- protected readonly wrapperElement: VueNode<ElementType>;
10
- protected abstract getRootNodes(): VueNode[];
11
- get element(): VueNode<ElementType>;
12
- constructor(element: ElementType);
13
- protected findAllDOMElements(selector: string): Element[];
14
- find<K extends keyof HTMLElementTagNameMap>(selector: K): DOMWrapper<HTMLElementTagNameMap[K]>;
15
- find<K extends keyof SVGElementTagNameMap>(selector: K): DOMWrapper<SVGElementTagNameMap[K]>;
16
- find<T extends Element = Element>(selector: string): DOMWrapper<T>;
17
- find<T extends Node = Node>(selector: string | RefSelector): DOMWrapper<T>;
18
- abstract findAll<K extends keyof HTMLElementTagNameMap>(selector: K): DOMWrapper<HTMLElementTagNameMap[K]>[];
19
- abstract findAll<K extends keyof SVGElementTagNameMap>(selector: K): DOMWrapper<SVGElementTagNameMap[K]>[];
20
- abstract findAll<T extends Element>(selector: string): DOMWrapper<T>[];
21
- abstract findAll(selector: string): DOMWrapper<Element>[];
22
- findComponent<T extends never>(selector: string): WrapperLike;
23
- findComponent<Props, RawBindings = any, D = any, C extends ComputedOptions = ComputedOptions, M extends MethodOptions = MethodOptions>(selector: ComponentOptions<Props, RawBindings, D, C, M>): VueWrapper<CreateComponentPublicInstance<Props, RawBindings, D, C, M>>;
24
- findComponent<T extends ComponentOptions>(selector: string): VueWrapper<T extends ComponentOptions<infer Props, infer RawBindings, infer D, infer C, infer M> ? CreateComponentPublicInstance<Props, RawBindings, D, C, M> : VueWrapper<CreateComponentPublicInstance>>;
25
- findComponent<T extends DefinedComponent>(selector: T | Exclude<FindComponentSelector, FunctionalComponent>): VueWrapper<InstanceType<T>>;
26
- findComponent<T extends FunctionalComponent>(selector: T): DOMWrapper<Node>;
27
- findComponent<T extends FunctionalComponent>(selector: string): DOMWrapper<Element>;
28
- findComponent<T extends never>(selector: NameSelector | RefSelector): VueWrapper;
29
- findComponent<T extends ComponentPublicInstance>(selector: T | FindComponentSelector): VueWrapper<T>;
30
- findComponent<T extends never>(selector: FindComponentSelector): WrapperLike;
31
- findAllComponents<T extends never>(selector: string): WrapperLike[];
32
- findAllComponents<T extends DefinedComponent>(selector: T | Exclude<FindAllComponentsSelector, FunctionalComponent>): VueWrapper<InstanceType<T>>[];
33
- findAllComponents<T extends FunctionalComponent>(selector: T): DOMWrapper<Node>[];
34
- findAllComponents<T extends FunctionalComponent>(selector: string): DOMWrapper<Element>[];
35
- findAllComponents<T extends never>(selector: NameSelector): VueWrapper[];
36
- findAllComponents<T extends ComponentPublicInstance>(selector: T | FindAllComponentsSelector): VueWrapper<T>[];
37
- findAllComponents<T extends never>(selector: FindAllComponentsSelector): WrapperLike[];
38
- abstract setValue(value?: any): Promise<void>;
39
- html(): string;
40
- classes(): string[];
41
- classes(className: string): boolean;
42
- attributes(): {
43
- [key: string]: string;
44
- };
45
- attributes(key: string): string | undefined;
46
- text(): string;
47
- exists(): boolean;
48
- get<K extends keyof HTMLElementTagNameMap>(selector: K): Omit<DOMWrapper<HTMLElementTagNameMap[K]>, 'exists'>;
49
- get<K extends keyof SVGElementTagNameMap>(selector: K): Omit<DOMWrapper<SVGElementTagNameMap[K]>, 'exists'>;
50
- get<T extends Element = Element>(selector: string): Omit<DOMWrapper<T>, 'exists'>;
51
- get<T extends Node = Node>(selector: string | RefSelector): Omit<DOMWrapper<T>, 'exists'>;
52
- getComponent<T extends never>(selector: string): Omit<WrapperLike, 'exists'>;
53
- getComponent<T extends DefinedComponent>(selector: T | Exclude<FindComponentSelector, FunctionalComponent>): Omit<VueWrapper<InstanceType<T>>, 'exists'>;
54
- getComponent<T extends FunctionalComponent>(selector: T | string): Omit<DOMWrapper<Element>, 'exists'>;
55
- getComponent<T extends never>(selector: NameSelector | RefSelector): Omit<VueWrapper, 'exists'>;
56
- getComponent<T extends ComponentPublicInstance>(selector: T | FindComponentSelector): Omit<VueWrapper<T>, 'exists'>;
57
- getComponent<T extends never>(selector: FindComponentSelector): Omit<WrapperLike, 'exists'>;
58
- protected isDisabled: () => boolean;
59
- isVisible(): boolean;
60
- protected abstract getCurrentComponent(): ComponentInternalInstance | void;
61
- trigger(eventString: DomEventNameWithModifier, options?: TriggerOptions): Promise<void>;
62
- trigger(eventString: string, options?: TriggerOptions): Promise<void>;
63
- }
@@ -1,21 +0,0 @@
1
- export declare const RouterLinkStub: import("vue").DefineComponent<{
2
- to: {
3
- type: (StringConstructor | ObjectConstructor)[];
4
- required: true;
5
- };
6
- custom: {
7
- type: BooleanConstructor;
8
- default: boolean;
9
- };
10
- }, unknown, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, Record<string, any>, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
11
- to: {
12
- type: (StringConstructor | ObjectConstructor)[];
13
- required: true;
14
- };
15
- custom: {
16
- type: BooleanConstructor;
17
- default: boolean;
18
- };
19
- }>>, {
20
- custom: boolean;
21
- }>;
@@ -1,30 +0,0 @@
1
- import { GlobalMountOptions, Stub } from './types';
2
- import { VueWrapper } from './vueWrapper';
3
- import { DOMWrapper } from './domWrapper';
4
- import { CustomCreateStub } from './stubs';
5
- export interface GlobalConfigOptions {
6
- global: Required<Omit<GlobalMountOptions, 'stubs'>> & {
7
- stubs: Record<string, Stub>;
8
- };
9
- plugins: {
10
- VueWrapper: Pluggable<VueWrapper>;
11
- DOMWrapper: Pluggable<DOMWrapper<Node>>;
12
- createStubs?: CustomCreateStub;
13
- };
14
- renderStubDefaultSlot: boolean;
15
- }
16
- interface Plugin<Instance, O> {
17
- handler(instance: Instance): Record<string, any>;
18
- handler(instance: Instance, options: O): Record<string, any>;
19
- options: O;
20
- }
21
- declare class Pluggable<Instance = DOMWrapper<Node>> {
22
- installedPlugins: Plugin<Instance, any>[];
23
- install<O>(handler: (instance: Instance) => Record<string, any>): void;
24
- install<O>(handler: (instance: Instance, options: O) => Record<string, any>, options: O): void;
25
- extend(instance: Instance): void;
26
- /** For testing */
27
- reset(): void;
28
- }
29
- export declare const config: GlobalConfigOptions;
30
- export {};