
Security News
The Changelog Podcast: Practical Steps to Stay Safe on npm
Learn the essential steps every developer should take to stay secure on npm and reduce exposure to supply chain attacks.
@cypress/angular
Advanced tools
Mount Angular components in the open source Cypress.io test runner v7.0.0+
Note: This package is bundled with the
cypresspackage and should not need to be installed separately. See the Angular Component Testing Docs for mounting Angular components. Installing and importingmountfrom@cypress/angularshould only be used for advanced use-cases.
npm install --save-dev @cypress/angular
Open cypress test runner
npx cypress open --component
If you need to run test in CI
npx cypress run --component
For more information, please check the official docs for running Cypress and for component testing.
mount is the most important function, allows to mount a given Angular component as a mini web application and interact with it using Cypress commandsMountConfig Configuration used to configure your testcreateOutputSpy factory function that creates new EventEmitter for your component and spies on it's emit method.import { mount } from '@cypress/angular'
import { HelloWorldComponent } from './hello-world.component'
describe('HelloWorldComponent', () => {
it('works', () => {
mount(HelloWorldComponent)
// now use standard Cypress commands
cy.contains('Hello World!').should('be.visible')
})
})
import { mount } from '@cypress/angular'
import { HelloWorldComponent } from './hello-world.component'
describe('HelloWorldComponent', () => {
it('works', () => {
mount('<app-hello-world></app-hello-world>', {
declarations: [HelloWorldComponent]
})
// now use standard Cypress commands
cy.contains('Hello World!').should('be.visible')
})
})
Look at the examples in cypress-component-testing-apps repo. Here in the angular and angular-standalone folders are the two example applications showing various testing scenarios.
| @cypress/angular | cypress |
|---|---|
| >= v1 | >= v10.5 |
Run yarn build to compile and sync packages to the cypress cli package.
This project is licensed under the terms of the MIT license.
FAQs
Test Angular Components with Cypress
The npm package @cypress/angular receives a total of 2,293 weekly downloads. As such, @cypress/angular popularity was classified as popular.
We found that @cypress/angular demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Learn the essential steps every developer should take to stay secure on npm and reduce exposure to supply chain attacks.

Security News
Experts push back on new claims about AI-driven ransomware, warning that hype and sponsored research are distorting how the threat is understood.

Security News
Ruby's creator Matz assumes control of RubyGems and Bundler repositories while former maintainers agree to step back and transfer all rights to end the dispute.