Angular API
Methods​
mount​
import { mount } from 'cypress/angular'
| Description | Mounts an Angular component inside Cypress browser | 
| Signature | mount<T>(component: Type<T> | string, config?: MountConfig<T>): Cypress.Chainable<MountResponse<T>> | 
| Returns | Cypress.Chainable<MountResponse> | 
| Name | Type | Description | 
| component | Type<T> | string | Angular component being mounted or its template | 
| config | MountConfig<T> (optional) | 
Example​
import { mount } from '@cypress/angular'
import { StepperComponent } from './stepper.component'
import { MyService } from 'services/my.service'
import { SharedModule } from 'shared/shared.module'
it('mounts', () => {
  mount(StepperComponent, {
    providers: [MyService],
    imports: [SharedModule],
  })
  cy.get('[data-cy=increment]').click()
  cy.get('[data-cy=counter]').should('have.text', '1')
})
// or
it('mounts with template', () => {
  mount('<app-stepper></app-stepper>', {
    declarations: [StepperComponent],
  })
})
createOutputSpy​
import { createOutputSpy } from 'cypress/angular'
| Description | Creates a new Event Emitter and then spies on it's emitmethod | 
| Signature | (alias: string) => any | 
| Returns | EventEmitter<T> | 
| Name | Type | Description | 
| alias | string | alias name you want to use for your cy.spy() alias | 
Example​
import { StepperComponent } from './stepper.component'
import { mount, createOutputSpy } from '@cypress/angular'
it('Has spy', () => {
  mount(StepperComponent, { change: createOutputSpy('changeSpy') })
  cy.get('[data-cy=increment]').click()
  cy.get('@changeSpy').should('have.been.called')
})
Interfaces​
MountConfig​
Additional module configurations needed while mounting the component, like providers, declarations, imports and even component @Inputs()
| Name | Type | Description | 
| autoSpyOutputs | boolean (optional) | flag to automatically create a cy.spy() for every component @Output() property | 
| autoDetectChanges | boolean (optional) | flag defaulted to true to automatically detect changes in your components | 
| componentProperties | Partial<{[P in keyof T]: T[P] extends InputSignal<infer V> ? InputSignal<V> | WritableSignal<V> | V : T[P]}> (optional) | signal based inference types need only apply if you are using signals within your component tests | 
MountResponse​
Type that the mount function yields
| Name | Type | Description | 
| fixture | ComponentFixture<T> | Fixture for debugging and testing a component. | 
| component | T | The instance of the root component class | 
See https://angular.io/api/core/testing/ComponentFixture#componentInstance