cypress 13.17.0 → 14.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (73) hide show
  1. package/angular/README.md +5 -0
  2. package/angular/angular/README.md +5 -0
  3. package/angular/angular/dist/index.d.ts +11 -2
  4. package/angular/angular/dist/index.js +944 -4
  5. package/angular/angular/package.json +16 -9
  6. package/angular/dist/index.d.ts +11 -2
  7. package/angular/dist/index.js +944 -4
  8. package/angular/package.json +16 -9
  9. package/lib/cli.js +1 -30
  10. package/lib/exec/spawn.js +17 -7
  11. package/mount-utils/dist/index.d.ts +0 -28
  12. package/mount-utils/dist/index.js +0 -27
  13. package/mount-utils/mount-utils/dist/index.d.ts +0 -28
  14. package/mount-utils/mount-utils/dist/index.js +0 -27
  15. package/package.json +5 -23
  16. package/react/README.md +5 -0
  17. package/react/dist/cypress-react.cjs.js +21 -676
  18. package/react/dist/cypress-react.esm-bundler.js +22 -676
  19. package/react/dist/index.d.ts +13 -30
  20. package/react/package.json +13 -15
  21. package/react/react/README.md +5 -0
  22. package/react/react/dist/cypress-react.cjs.js +21 -676
  23. package/react/react/dist/cypress-react.esm-bundler.js +22 -676
  24. package/react/react/dist/index.d.ts +13 -30
  25. package/react/react/package.json +13 -15
  26. package/svelte/README.md +6 -2
  27. package/svelte/dist/cypress-svelte.cjs.js +12 -12
  28. package/svelte/dist/cypress-svelte.esm-bundler.js +12 -12
  29. package/svelte/dist/index.d.ts +8 -179
  30. package/svelte/package.json +2 -2
  31. package/svelte/svelte/README.md +6 -2
  32. package/svelte/svelte/dist/cypress-svelte.cjs.js +12 -12
  33. package/svelte/svelte/dist/cypress-svelte.esm-bundler.js +12 -12
  34. package/svelte/svelte/dist/index.d.ts +8 -179
  35. package/svelte/svelte/package.json +2 -2
  36. package/types/cypress.d.ts +32 -49
  37. package/types/net-stubbing.d.ts +2 -7
  38. package/vue/dist/cypress-vue.cjs.js +380 -275
  39. package/vue/dist/cypress-vue.esm-bundler.js +382 -276
  40. package/vue/dist/index.d.ts +61 -78
  41. package/vue/package.json +2 -5
  42. package/vue/vue/dist/cypress-vue.cjs.js +380 -275
  43. package/vue/vue/dist/cypress-vue.esm-bundler.js +382 -276
  44. package/vue/vue/dist/index.d.ts +61 -78
  45. package/vue/vue/package.json +2 -5
  46. package/angular-signals/README.md +0 -11
  47. package/angular-signals/angular-signals/README.md +0 -11
  48. package/angular-signals/angular-signals/dist/index.d.ts +0 -136
  49. package/angular-signals/angular-signals/dist/index.js +0 -1861
  50. package/angular-signals/angular-signals/package.json +0 -74
  51. package/angular-signals/dist/index.d.ts +0 -136
  52. package/angular-signals/dist/index.js +0 -1861
  53. package/angular-signals/package.json +0 -74
  54. package/react18/README.md +0 -7
  55. package/react18/dist/cypress-react.cjs.js +0 -597
  56. package/react18/dist/cypress-react.esm-bundler.js +0 -574
  57. package/react18/dist/index.d.ts +0 -78
  58. package/react18/package.json +0 -71
  59. package/react18/react18/README.md +0 -7
  60. package/react18/react18/dist/cypress-react.cjs.js +0 -597
  61. package/react18/react18/dist/cypress-react.esm-bundler.js +0 -574
  62. package/react18/react18/dist/index.d.ts +0 -78
  63. package/react18/react18/package.json +0 -71
  64. package/vue2/README.md +0 -7
  65. package/vue2/dist/cypress-vue2.cjs.js +0 -20045
  66. package/vue2/dist/cypress-vue2.esm-bundler.js +0 -20042
  67. package/vue2/dist/index.d.ts +0 -207
  68. package/vue2/package.json +0 -65
  69. package/vue2/vue2/README.md +0 -7
  70. package/vue2/vue2/dist/cypress-vue2.cjs.js +0 -20045
  71. package/vue2/vue2/dist/cypress-vue2.esm-bundler.js +0 -20042
  72. package/vue2/vue2/dist/index.d.ts +0 -207
  73. package/vue2/vue2/package.json +0 -65
@@ -1,7 +1,7 @@
1
1
  /// <reference types="cypress" />
2
2
 
3
3
  import * as vue from 'vue';
4
- import { ComponentInternalInstance, FunctionalComponent, ComponentOptions, Component, Directive, Plugin as Plugin$1, AppConfig, VNode, VNodeProps, ComponentPublicInstance, ComputedOptions, MethodOptions, CreateComponentPublicInstance, ComponentCustomProperties, App, ConcreteComponent, Prop, EmitsOptions, ComponentOptionsMixin, ExtractPropTypes, ExtractDefaultPropTypes, DefineComponent, ComponentOptionsWithoutProps, ComponentOptionsWithArrayProps, ComponentPropsOptions, ComponentOptionsWithObjectProps, AllowedComponentProps, ComponentCustomProps } from 'vue';
4
+ import { ComponentInternalInstance, FunctionalComponent, ComponentOptions, Component, Directive, Plugin as Plugin$1, AppConfig, VNode, VNodeProps, ComponentPublicInstance, ComputedOptions, MethodOptions, CreateComponentPublicInstance, App, ConcreteComponent, DefineComponent, Prop, EmitsOptions, ComponentOptionsMixin, ExtractPropTypes, ExtractDefaultPropTypes, ComponentOptionsWithoutProps, ComponentOptionsWithArrayProps, ComponentPropsOptions, ComponentOptionsWithObjectProps, AllowedComponentProps, ComponentCustomProps } from 'vue';
5
5
 
6
6
  interface RefSelector {
7
7
  ref: string;
@@ -22,7 +22,7 @@ type RawProps = VNodeProps & {
22
22
  __v_isVNode?: never;
23
23
  [Symbol.iterator]?: never;
24
24
  } & Record<string, any>;
25
- interface MountingOptions$1<Props, Data = {}> {
25
+ interface BaseMountingOptions<Props, Data = {}> {
26
26
  /**
27
27
  * Overrides component's default data. Must be a function.
28
28
  * @see https://test-utils.vuejs.org/api/#data
@@ -53,18 +53,32 @@ interface MountingOptions$1<Props, Data = {}> {
53
53
  * Provides global mounting options to the component.
54
54
  */
55
55
  global?: GlobalMountOptions$1;
56
+ /**
57
+ * Automatically stub out all the child components.
58
+ * @default false
59
+ * @see https://test-utils.vuejs.org/api/#slots
60
+ */
61
+ shallow?: boolean;
62
+ }
63
+ /**
64
+ * Mounting options for `mount` and `shallowMount`
65
+ */
66
+ interface MountingOptions$1<Props, Data = {}> extends BaseMountingOptions<Props, Data> {
56
67
  /**
57
68
  * Specify where to mount the component.
58
69
  * Can be a valid CSS selector, or an Element connected to the document.
59
70
  * @see https://test-utils.vuejs.org/api/#attachto
60
71
  */
61
- attachTo?: HTMLElement | string;
72
+ attachTo?: Element | string;
73
+ }
74
+ /**
75
+ * Mounting options for `renderToString`
76
+ */
77
+ interface RenderMountingOptions<Props, Data = {}> extends BaseMountingOptions<Props, Data> {
62
78
  /**
63
- * Automatically stub out all the child components.
64
- * @default false
65
- * @see https://test-utils.vuejs.org/api/#slots
79
+ * Attach to is not available in SSR mode
66
80
  */
67
- shallow?: boolean;
81
+ attachTo?: never;
68
82
  }
69
83
  type Stub = boolean | Component | Directive;
70
84
  type Stubs = Record<string, Stub> | Array<string>;
@@ -1150,9 +1164,7 @@ declare abstract class BaseWrapper<ElementType extends Node> implements WrapperL
1150
1164
  trigger(eventString: string, options?: TriggerOptions): Promise<void>;
1151
1165
  }
1152
1166
 
1153
- declare class VueWrapper<T extends Omit<ComponentPublicInstance, '$emit' | keyof ComponentCustomProperties> & {
1154
- $emit: (event: any, ...args: any[]) => void;
1155
- } & ComponentCustomProperties = ComponentPublicInstance> extends BaseWrapper<Node> {
1167
+ declare class VueWrapper<VM = unknown, T extends ComponentPublicInstance = VM & ComponentPublicInstance> extends BaseWrapper<Node> {
1156
1168
  private readonly componentVM;
1157
1169
  private readonly rootVM;
1158
1170
  private readonly __app;
@@ -1168,17 +1180,15 @@ declare class VueWrapper<T extends Omit<ComponentPublicInstance, '$emit' | keyof
1168
1180
  findAll<K extends keyof SVGElementTagNameMap>(selector: K): DOMWrapper<SVGElementTagNameMap[K]>[];
1169
1181
  findAll<T extends Element>(selector: string): DOMWrapper<T>[];
1170
1182
  private attachNativeEventListener;
1171
- get element(): Element;
1183
+ get element(): T['$el'];
1172
1184
  get vm(): T;
1173
- props(): {
1174
- [key: string]: any;
1175
- };
1176
- props(selector: string): any;
1185
+ props(): T['$props'];
1186
+ props<Selector extends keyof T['$props']>(selector: Selector): T['$props'][Selector];
1177
1187
  emitted<T = unknown>(): Record<string, T[]>;
1178
1188
  emitted<T = unknown[]>(eventName: string): undefined | T[];
1179
1189
  isVisible(): boolean;
1180
1190
  setData(data: Record<string, unknown>): Promise<void>;
1181
- setProps(props: Record<string, unknown>): Promise<void>;
1191
+ setProps(props: Partial<T['$props']>): Promise<void>;
1182
1192
  setValue(value: unknown, prop?: string): Promise<void>;
1183
1193
  unmount(): void;
1184
1194
  }
@@ -1186,6 +1196,10 @@ declare class VueWrapper<T extends Omit<ComponentPublicInstance, '$emit' | keyof
1186
1196
  type CustomCreateStub = (params: {
1187
1197
  name: string;
1188
1198
  component: ConcreteComponent;
1199
+ registerStub: (config: {
1200
+ source: Component;
1201
+ stub: Component;
1202
+ }) => void;
1189
1203
  }) => ConcreteComponent;
1190
1204
 
1191
1205
  interface GlobalConfigOptions {
@@ -1216,36 +1230,35 @@ declare class Pluggable<Instance = DOMWrapper<Node>> {
1216
1230
  reset(): void;
1217
1231
  }
1218
1232
 
1219
- type PublicProps$1 = VNodeProps & AllowedComponentProps & ComponentCustomProps;
1220
- type ComponentMountingOptions$1<T> = T extends DefineComponent<infer PropsOrPropOptions, any, infer D, any, any> ? MountingOptions$1<Partial<ExtractDefaultPropTypes<PropsOrPropOptions>> & Omit<Readonly<ExtractPropTypes<PropsOrPropOptions>> & PublicProps$1, keyof ExtractDefaultPropTypes<PropsOrPropOptions>>, D> & Record<string, any> : MountingOptions$1<any>;
1221
- declare function renderToString<V extends {}>(originalComponent: {
1222
- new (...args: any[]): V;
1223
- __vccOpts: any;
1224
- }, options?: MountingOptions$1<any> & Record<string, any>): Promise<string>;
1225
- declare function renderToString<V extends {}, P>(originalComponent: {
1226
- new (...args: any[]): V;
1227
- __vccOpts: any;
1228
- defaultProps?: Record<string, Prop<any>> | string[];
1229
- }, options?: MountingOptions$1<P & PublicProps$1> & Record<string, any>): Promise<string>;
1230
- declare function renderToString<V extends {}>(originalComponent: {
1231
- new (...args: any[]): V;
1232
- registerHooks(keys: string[]): void;
1233
- }, options?: MountingOptions$1<any> & Record<string, any>): Promise<string>;
1234
- declare function renderToString<V extends {}, P>(originalComponent: {
1235
- new (...args: any[]): V;
1236
- props(Props: P): any;
1237
- registerHooks(keys: string[]): void;
1238
- }, options?: MountingOptions$1<P & PublicProps$1> & Record<string, any>): Promise<string>;
1239
- declare function renderToString<Props extends {}, E extends EmitsOptions = {}>(originalComponent: FunctionalComponent<Props, E>, options?: MountingOptions$1<Props & PublicProps$1> & Record<string, any>): Promise<string>;
1240
- declare function renderToString<PropsOrPropOptions = {}, RawBindings = {}, D = {}, C extends ComputedOptions = ComputedOptions, M extends MethodOptions = MethodOptions, Mixin extends ComponentOptionsMixin = ComponentOptionsMixin, Extends extends ComponentOptionsMixin = ComponentOptionsMixin, E extends EmitsOptions = Record<string, any>, EE extends string = string, PP = PublicProps$1, Props = Readonly<ExtractPropTypes<PropsOrPropOptions>>, Defaults extends {} = ExtractDefaultPropTypes<PropsOrPropOptions>>(component: DefineComponent<PropsOrPropOptions, RawBindings, D, C, M, Mixin, Extends, E, EE, PP, Props, Defaults>, options?: MountingOptions$1<Partial<Defaults> & Omit<Props & PublicProps$1, keyof Defaults>, D> & Record<string, any>): Promise<string>;
1241
- declare function renderToString<T extends DefineComponent<any, any, any, any, any>>(component: T, options?: ComponentMountingOptions$1<T>): Promise<string>;
1242
- declare function renderToString<Props = {}, RawBindings = {}, D extends {} = {}, C extends ComputedOptions = {}, M extends Record<string, Function> = {}, E extends EmitsOptions = Record<string, any>, Mixin extends ComponentOptionsMixin = ComponentOptionsMixin, Extends extends ComponentOptionsMixin = ComponentOptionsMixin, EE extends string = string>(componentOptions: ComponentOptionsWithoutProps<Props, RawBindings, D, C, M, E, Mixin, Extends, EE>, options?: MountingOptions$1<Props & PublicProps$1, D>): Promise<string>;
1243
- declare function renderToString<PropNames extends string, RawBindings, D extends {}, C extends ComputedOptions = {}, M extends Record<string, Function> = {}, E extends EmitsOptions = Record<string, any>, Mixin extends ComponentOptionsMixin = ComponentOptionsMixin, Extends extends ComponentOptionsMixin = ComponentOptionsMixin, EE extends string = string, Props extends Readonly<{
1244
- [key in PropNames]?: any;
1245
- }> = Readonly<{
1246
- [key in PropNames]?: any;
1247
- }>>(componentOptions: ComponentOptionsWithArrayProps<PropNames, RawBindings, D, C, M, E, Mixin, Extends, EE, Props>, options?: MountingOptions$1<Props & PublicProps$1, D>): Promise<string>;
1248
- declare function renderToString<PropsOptions extends Readonly<ComponentPropsOptions>, RawBindings, D extends {}, C extends ComputedOptions = {}, M extends Record<string, Function> = {}, E extends EmitsOptions = Record<string, any>, Mixin extends ComponentOptionsMixin = ComponentOptionsMixin, Extends extends ComponentOptionsMixin = ComponentOptionsMixin, EE extends string = string>(componentOptions: ComponentOptionsWithObjectProps<PropsOptions, RawBindings, D, C, M, E, Mixin, Extends, EE>, options?: MountingOptions$1<ExtractPropTypes<PropsOptions> & PublicProps$1, D>): Promise<string>;
1233
+ type ComponentProps<T> = T extends new (...args: any) => {
1234
+ $props: infer P;
1235
+ } ? NonNullable<P> : T extends (props: infer P, ...args: any) => any ? P : {};
1236
+ type ComponentSlots<T> = T extends new (...args: any) => {
1237
+ $slots: infer S;
1238
+ } ? NonNullable<S> : T extends (props: any, ctx: {
1239
+ slots: infer S;
1240
+ attrs: any;
1241
+ emit: any;
1242
+ }, ...args: any) => any ? NonNullable<S> : {};
1243
+
1244
+ type ShimSlotReturnType<T> = T extends (...args: infer P) => any ? (...args: P) => any : never;
1245
+ type WithArray<T> = T | T[];
1246
+ type ComponentData<T> = T extends {
1247
+ data?(...args: any): infer D;
1248
+ } ? D : {};
1249
+ type ComponentMountingOptions$1<T, P extends ComponentProps<T> = ComponentProps<T>> = Omit<MountingOptions$1<P, ComponentData<T>>, 'slots'> & {
1250
+ slots?: {
1251
+ [K in keyof ComponentSlots<T>]: WithArray<ShimSlotReturnType<ComponentSlots<T>[K]> | string | VNode | (new () => any) | {
1252
+ template: string;
1253
+ }>;
1254
+ };
1255
+ } & Record<string, unknown>;
1256
+
1257
+ declare function renderToString<T, C = T extends ((...args: any) => any) | (new (...args: any) => any) ? T : T extends {
1258
+ props?: infer Props;
1259
+ } ? DefineComponent<Props extends Readonly<(infer PropNames)[]> | (infer PropNames)[] ? {
1260
+ [key in PropNames extends string ? PropNames : string]?: any;
1261
+ } : Props> : DefineComponent>(originalComponent: T, options?: ComponentMountingOptions$1<C> & Pick<RenderMountingOptions<any>, 'attachTo'>): Promise<string>;
1249
1262
 
1250
1263
  declare function createWrapperError<T extends object>(wrapperType: 'DOMWrapper' | 'VueWrapper'): T;
1251
1264
 
@@ -1258,27 +1271,7 @@ declare const VueTestUtils: {
1258
1271
  renderToString: typeof renderToString;
1259
1272
  enableAutoUnmount: typeof enableAutoUnmount;
1260
1273
  disableAutoUnmount: typeof disableAutoUnmount;
1261
- RouterLinkStub: DefineComponent<{
1262
- to: {
1263
- type: (ObjectConstructor | StringConstructor)[];
1264
- required: true;
1265
- };
1266
- custom: {
1267
- type: BooleanConstructor;
1268
- default: boolean;
1269
- };
1270
- }, unknown, unknown, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, VNodeProps & AllowedComponentProps & ComponentCustomProps, Readonly<ExtractPropTypes<{
1271
- to: {
1272
- type: (ObjectConstructor | StringConstructor)[];
1273
- required: true;
1274
- };
1275
- custom: {
1276
- type: BooleanConstructor;
1277
- default: boolean;
1278
- };
1279
- }>>, {
1280
- custom: boolean;
1281
- }>;
1274
+ RouterLinkStub: any;
1282
1275
  VueWrapper: typeof VueWrapper;
1283
1276
  DOMWrapper: typeof DOMWrapper;
1284
1277
  BaseWrapper: typeof BaseWrapper;
@@ -1378,15 +1371,5 @@ declare function mount<PropsOptions extends Readonly<ComponentPropsOptions>, Raw
1378
1371
  wrapper: VueWrapper<ComponentPublicInstance<ExtractPropTypes<PropsOptions>, RawBindings, D, C, M, E, VNodeProps & ExtractPropTypes<PropsOptions>>>;
1379
1372
  component: VueWrapper<ComponentPublicInstance<ExtractPropTypes<PropsOptions>, RawBindings, D, C, M, E, VNodeProps & ExtractPropTypes<PropsOptions>>>['vm'];
1380
1373
  }>;
1381
- /**
1382
- * Helper function for mounting a component quickly in test hooks.
1383
- * @example
1384
- * import {mountCallback} from '@cypress/vue'
1385
- * beforeEach(mountVue(component, options))
1386
- *
1387
- * Removed as of Cypress 11.0.0.
1388
- * @see https://on.cypress.io/migration-11-0-0-component-testing-updates
1389
- */
1390
- declare function mountCallback(component: any, options?: any): () => void;
1391
1374
 
1392
- export { CyMountOptions, VueTestUtils, mount, mountCallback };
1375
+ export { CyMountOptions, VueTestUtils, mount };
@@ -18,7 +18,7 @@
18
18
  "@cypress/mount-utils": "0.0.0-development",
19
19
  "@vitejs/plugin-vue": "5.0.4",
20
20
  "@vue/compiler-sfc": "3.2.47",
21
- "@vue/test-utils": "2.3.2",
21
+ "@vue/test-utils": "2.4.6",
22
22
  "axios": "0.21.2",
23
23
  "cypress": "0.0.0-development",
24
24
  "debug": "^4.3.4",
@@ -42,7 +42,7 @@
42
42
  "src/**/*.js"
43
43
  ],
44
44
  "engines": {
45
- "node": ">=8"
45
+ "node": ">=18"
46
46
  },
47
47
  "types": "dist/index.d.ts",
48
48
  "license": "MIT",
@@ -82,9 +82,6 @@
82
82
  "nx": {
83
83
  "targets": {
84
84
  "build": {
85
- "dependsOn": [
86
- "!@cypress/react18:build"
87
- ],
88
85
  "outputs": [
89
86
  "{workspaceRoot}/cli/vue",
90
87
  "{projectRoot}/dist"
@@ -1,11 +0,0 @@
1
- # @cypress/angular-signals
2
-
3
- Mount Angular components in the open source [Cypress.io](https://www.cypress.io/) test runner. This package is an extension of `@cypress/angular`, but with [signals](https://angular.dev/guide/signals) support.
4
-
5
- > **Note:** This package is bundled with the `cypress` package and should not need to be installed separately. See the [Angular Component Testing Docs](https://docs.cypress.io/guides/component-testing/angular/overview) for mounting Angular components. Installing and importing `mount` from `@cypress/angular-signals` should only be done for advanced use-cases.
6
-
7
- ## Development
8
-
9
- Run `yarn build` to compile and sync packages to the `cypress` cli package.
10
-
11
- ## [Changelog](./CHANGELOG.md)
@@ -1,11 +0,0 @@
1
- # @cypress/angular-signals
2
-
3
- Mount Angular components in the open source [Cypress.io](https://www.cypress.io/) test runner. This package is an extension of `@cypress/angular`, but with [signals](https://angular.dev/guide/signals) support.
4
-
5
- > **Note:** This package is bundled with the `cypress` package and should not need to be installed separately. See the [Angular Component Testing Docs](https://docs.cypress.io/guides/component-testing/angular/overview) for mounting Angular components. Installing and importing `mount` from `@cypress/angular-signals` should only be done for advanced use-cases.
6
-
7
- ## Development
8
-
9
- Run `yarn build` to compile and sync packages to the `cypress` cli package.
10
-
11
- ## [Changelog](./CHANGELOG.md)
@@ -1,136 +0,0 @@
1
- /// <reference types="cypress" />
2
-
3
- import { InputSignal, WritableSignal, Type } from '@angular/core';
4
- import { TestModuleMetadata, ComponentFixture, TestComponentRenderer } from '@angular/core/testing';
5
-
6
- /**
7
- * Additional module configurations needed while mounting the component, like
8
- * providers, declarations, imports and even component @Inputs()
9
- *
10
- * @interface MountConfig
11
- * @see https://angular.io/api/core/testing/TestModuleMetadata
12
- */
13
- interface MountConfig<T> extends TestModuleMetadata {
14
- /**
15
- * @memberof MountConfig
16
- * @description flag to automatically create a cy.spy() for every component @Output() property
17
- * @example
18
- * export class ButtonComponent {
19
- * @Output clicked = new EventEmitter()
20
- * }
21
- *
22
- * cy.mount(ButtonComponent, { autoSpyOutputs: true })
23
- * cy.get('@clickedSpy).should('have.been.called')
24
- */
25
- autoSpyOutputs?: boolean;
26
- /**
27
- * @memberof MountConfig
28
- * @description flag defaulted to true to automatically detect changes in your components
29
- */
30
- autoDetectChanges?: boolean;
31
- /**
32
- * @memberof MountConfig
33
- * @example
34
- * import { ButtonComponent } from 'button/button.component'
35
- * it('renders a button with Save text', () => {
36
- * cy.mount(ButtonComponent, { componentProperties: { text: 'Save' }})
37
- * cy.get('button').contains('Save')
38
- * })
39
- *
40
- * it('renders a button with a cy.spy() replacing EventEmitter', () => {
41
- * cy.mount(ButtonComponent, {
42
- * componentProperties: {
43
- * clicked: cy.spy().as('mySpy)
44
- * }
45
- * })
46
- * cy.get('button').click()
47
- * cy.get('@mySpy').should('have.been.called')
48
- * })
49
- */
50
- componentProperties?: Partial<{
51
- [P in keyof T]: T[P] extends InputSignal<infer V> ? InputSignal<V> | WritableSignal<V> | V : T[P];
52
- }>;
53
- }
54
- /**
55
- * Type that the `mount` function returns
56
- * @type MountResponse<T>
57
- */
58
- type MountResponse<T> = {
59
- /**
60
- * Fixture for debugging and testing a component.
61
- *
62
- * @memberof MountResponse
63
- * @see https://angular.io/api/core/testing/ComponentFixture
64
- */
65
- fixture: ComponentFixture<T>;
66
- /**
67
- * The instance of the root component class
68
- *
69
- * @memberof MountResponse
70
- * @see https://angular.io/api/core/testing/ComponentFixture#componentInstance
71
- */
72
- component: T;
73
- };
74
- declare class CypressTestComponentRenderer extends TestComponentRenderer {
75
- insertRootElement(rootElId: string): void;
76
- removeAllRootElements(): void;
77
- }
78
- /**
79
- * Mounts an Angular component inside Cypress browser
80
- *
81
- * @param component Angular component being mounted or its template
82
- * @param config configuration used to configure the TestBed
83
- * @example
84
- * import { mount } from '@cypress/angular-signals'
85
- * import { StepperComponent } from './stepper.component'
86
- * import { MyService } from 'services/my.service'
87
- * import { SharedModule } from 'shared/shared.module';
88
- * it('mounts', () => {
89
- * mount(StepperComponent, {
90
- * providers: [MyService],
91
- * imports: [SharedModule]
92
- * })
93
- * cy.get('[data-cy=increment]').click()
94
- * cy.get('[data-cy=counter]').should('have.text', '1')
95
- * })
96
- *
97
- * // or
98
- *
99
- * it('mounts with template', () => {
100
- * mount('<app-stepper></app-stepper>', {
101
- * declarations: [StepperComponent],
102
- * })
103
- * })
104
- *
105
- * @see {@link https://on.cypress.io/mounting-angular} for more details.
106
- *
107
- * @returns A component and component fixture
108
- */
109
- declare function mount<T>(component: Type<T> | string, config?: MountConfig<T>): Cypress.Chainable<MountResponse<T>>;
110
- /**
111
- * Creates a new Event Emitter and then spies on it's `emit` method
112
- *
113
- * @param {string} alias name you want to use for your cy.spy() alias
114
- * @returns EventEmitter<T>
115
- * @example
116
- * import { StepperComponent } from './stepper.component'
117
- * import { mount, createOutputSpy } from '@cypress/angular-signals'
118
- *
119
- * it('Has spy', () => {
120
- * mount(StepperComponent, { componentProperties: { change: createOutputSpy('changeSpy') } })
121
- * cy.get('[data-cy=increment]').click()
122
- * cy.get('@changeSpy').should('have.been.called')
123
- * })
124
- *
125
- * // Or for use with Angular Signals following the output nomenclature.
126
- * // see https://v17.angular.io/guide/model-inputs#differences-between-model-and-input/
127
- *
128
- * it('Has spy', () => {
129
- * mount(StepperComponent, { componentProperties: { count: signal(0), countChange: createOutputSpy('countChange') } })
130
- * cy.get('[data-cy=increment]').click()
131
- * cy.get('@countChange').should('have.been.called')
132
- * })
133
- */
134
- declare const createOutputSpy: <T>(alias: string) => any;
135
-
136
- export { CypressTestComponentRenderer, MountConfig, MountResponse, createOutputSpy, mount };