Driver FixRecommendedSound, Wi-Fi or graphics acting up? Check drivers firstFind missing or outdated drivers fast.Check DriversOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsSlow PC?RecommendedPC slow today? Run a repair scan before it gets worseResolve common Windows issues and optimize system performance.Scan Now×
Skip to content
World desk6 min

Add Cypress to an Angular Workflow With Nx

A practical guide to adding Cypress to an existing Angular Nx workspace, with separate setup paths for E2E and component testing.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

To add Cypress to an existing Angular app in an Nx workspace, install Nx’s Cypress plugin with nx add @nx/cypress, then choose the right setup: use Nx’s Cypress configuration generator for end-to-end tests, or the Angular component-configuration generator for component tests. They exercise different things and use different server and build targets.

Choose E2E or component testing

End-to-end (E2E) tests drive the application in a browser through its served URL, making them a fit for user-visible flows across the app. Component tests exercise Angular components through Cypress’s component-testing support; Cypress starts its own component dev server, while Nx uses a build target to establish the project context.

Decision E2E Angular component testing
What runs in the browser The running application A component or library component in the configured component environment
Generator for an existing project @nx/cypress:configuration @nx/angular:cypress-component-configuration
Server/build relationship Use the app’s dev-server target or an explicit base URL Provide an eligible Angular build target; Cypress owns the component dev server
Common Nx target e2e component-test

Use E2E when the behavior depends on navigating or interacting with the application as a whole. Use component testing when you want to verify a component’s rendering and behavior without making the app’s full user journey the test subject. You can configure both if the repository needs both kinds of coverage.

Install the Nx Cypress plugin

  1. From the workspace root, run nx add @nx/cypress. Nx recommends keeping Nx package versions in sync; using nx add installs the matching plugin for the workspace.
  2. Check the workspace’s installed Nx and Cypress versions and package constraints before changing dependencies. Nx’s rolling Cypress introduction, retrieved October 3, 2026, lists support for Cypress >= 13 < 16. Treat that as the documented range at that time, not a promise for every older workspace or a reason to override its dependency constraints. See Nx with Cypress.

Set up E2E tests for an existing Angular app

Generate the configuration

Replace your-app-name with the project name recognized by Nx from its project configuration or package metadata:

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
nx g @nx/cypress:configuration --project=your-app-name

This generator configures the supplied project; it does not create a separate E2E project. If you want Cypress to use a specific application URL rather than having the configured Nx target start the app, provide a base URL:

nx g @nx/cypress:configuration --project=your-app-name --baseUrl=http://localhost:4200

Use the URL for the exact app instance your tests should cover. Cypress needs a base URL when neither a configured base URL nor a dev-server target is available. The Nx executor configuration for E2E uses a Cypress config path, testingType: "e2e", and typically the app’s devServerTarget. For CI, a static-serving target may be appropriate for the application. Consult Nx’s Cypress executor options and check the generated target in your workspace.

Run the E2E target

After generation, run the configured target, commonly:

nx e2e your-app-name

Target names are configurable, so use the target actually present in your project rather than assuming the default. The task should start or connect to the configured app and run Cypress against it.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Set up Angular component testing

Generate the component-test configuration

Run the Angular generator for the project that contains the Angular components:

nx g @nx/angular:cypress-component-configuration --project=my-angular-project

The generator adds Nx-ready Cypress component-test files and configuration. Nx’s current Cypress plugin documentation lists the supported Cypress range as >= 13 < 16; an older Angular generator reference mentions Cypress 10.7.0 as a minimum for component testing. That older minimum is not a recommendation to install an older Cypress major. Confirm compatibility against the versions in your workspace and the current Nx documentation. See the Angular generator reference.

Choose and verify the build target

Nx may infer the build target from project-graph usage. If it cannot determine the right one, pass it explicitly:

nx g @nx/angular:cypress-component-configuration 
  --project=my-angular-project 
  --build-target=my-angular-app:build

The target must use an eligible Angular builder: @nx/angular:webpack-browser or @angular-devkit/build-angular:browser, as specified in Nx’s Angular generator reference. It may belong to a different project from the component under test—for example, an app that consumes a library. Check the workspace project graph and the actual builder before copying the example: project assets, scripts, and styles available to a component can depend on the selected build target.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

For component tests, the target should set skipServe: true. Cypress supplies the component dev server, so Nx should not serve the app as it does for a typical E2E task. Nx still needs the build target as configuration context. The Angular generator sets skipServe: true automatically; inspect the generated target if configuration has been customized. See Nx’s Cypress component testing guide and executor reference.

Generate starter tests and run them

You can ask the generator to create starter tests for existing components with --generate-tests. Nx documents the generated test-file suffix as .cy.ts and places those files beside their components. Run the component-test target, commonly:

nx component-test my-angular-project

As with E2E, use the target name configured in your workspace if it differs from the default.

Check inferred Nx targets and CI behavior

Nx’s @nx/cypress/plugin recognizes Cypress config files named cypress.config.js, cypress.config.ts, cypress.config.mjs, or cypress.config.cjs when the directory also contains a package.json or project.json. It can infer tasks from those files. Documented default target names include e2e, component-test, and open-cypress; the CI target is commonly e2e-ci. Plugin options in nx.json can change names and behavior, so inspect what Nx inferred with nx show project your-app-name --web or Nx Console. Details are in the Nx Cypress introduction.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Best Value
Sale
Game Programming Patterns
  • Brand New in box. The product ships with all relevant accessories

Nx documents caching for E2E and component-test tasks and tracking of Cypress screenshot and video outputs. CI task inference can also split tests by file when configured; component-test CI splitting is documented as available since Nx 21.6.1. These behaviors depend on the installed Nx version and workspace configuration, so verify them before relying on them in CI. For advanced E2E splitting, Nx’s current guidance uses ciWebServerCommand in Cypress preset configuration; if customizing that preset, preserve its setupNodeEvents behavior.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Troubleshoot common setup problems

  • The Nx command cannot find the project: Check the exact project name in the workspace configuration or package metadata. Do not assume the folder name is the project name.
  • Cypress cannot connect to the app: For E2E, ensure the dev-server target starts the intended app, or set baseUrl to the URL where that app is running. Confirm the app is reachable before running Cypress.
  • The component generator cannot infer a build target: Supply --build-target=project:target, selecting an eligible Angular browser builder and the app or project whose build context provides the assets and styles needed by the component.
  • The component task tries to serve the application: Check its target configuration for skipServe: true. Cypress component testing uses Cypress’s component dev server; it is not the E2E app-serving workflow.
  • An Nx target is missing or named differently: Confirm that Nx can recognize the Cypress config file in a directory containing project.json or package.json, then inspect inferred targets with nx show project your-app-name --web. Check nx.json for plugin options that rename targets.
  • Installed package versions conflict: Keep Nx packages aligned and check Cypress against the supported range documented for the installed Nx version. Do not treat a rolling documentation range as a guarantee for an older workspace.

Or skip the browser setup

If your goal is to capture a website screenshot rather than add browser-driven tests to your Angular workspace, ScreenshotNeo is a separate screenshot API and MCP server for developers. One GET request returns an image or PDF; it is not a replacement for Cypress tests. For example, save a WebP shot with cURL:

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp

See the ScreenshotNeo API documentation for request options. ScreenshotNeo accepts cookie or consent banners and removes more than 60 known consent platforms, newsletter popups, and chat widgets before capture; each step can be turned off. Bot checks, blank pages, timeouts, failed loads, and cache hits are not billed, and responses identify the page verdict and billing status in headers. Its MCP server provides take_screenshot, get_page_info, and capture_pdf for Claude, Cursor, and other MCP clients. The free plan includes 1,000 screenshots a month with no card; paid plans start at $5 for 3,000 shots.

Sign up for ScreenshotNeo’s free plan to get 1,000 screenshots a month with no card.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Frequently Asked Questions

Can I use E2E and component tests in the same Nx Angular workspace?

Yes. Configure the projects and targets for each testing mode separately, then run the target that matches the behavior you want to verify.

Does ScreenshotNeo run Cypress tests?

No. ScreenshotNeo captures website screenshots or PDFs through an API or MCP server; Cypress is for browser-based application and component testing.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Shenzhen desk3 min
    HONOR Expands Beyond Smartphones With Humanoid Robot RevealHONOR said it unveiled its first humanoid robot at MWC 2026 and named shopping assistance, workplace inspections, and supportive companionship as intended uses. Later Robotics D1 claims and a reported…
Recommended PC Tool
Recommended PC Tool
Windows Errors? Fix Them Before They SpreadFree repair scan
Outdated Drivers Are Slowing You DownFree scan - exact matches

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.