nrwl / nx

Smart Monorepos · Fast CI
https://nx.dev
MIT License
23.61k stars 2.36k forks source link

Cypress component testing with snapshots #17134

Closed abf7d closed 1 year ago

abf7d commented 1 year ago

Current Behavior

I tried to install the cypress-image-snapshot package so I can take and compare snapshots in my component tests: npm install --save-dev cypress-image-snapshot @types/cypress-image-snapshot. There were conflicts with the dependencies. The cypress-image-snapshot package isn't compatible with v11. I have searched for resources for visual/snapshot testing and haven't found anything compatible. Are there any packages or ways to conduct visual tests with cypress in component tests?

Expected Behavior

I expect to be able to run snapshot tests in cypress.

GitHub Repo

No response

Steps to Reproduce

  1. Install a new NX angular monorepo
  2. Run npm install --save-dev cypress-image-snapshot @types/cypress-image-snapshot
  3. The installation will fail

Nx Report

Node : 16.13.2
   OS   : win32 x64
   npm  : 8.1.2

   nx                      : 15.9.2
   @nrwl/js                : 15.9.2
   @nrwl/jest              : 15.9.2
   @nrwl/linter            : 15.9.2
   @nrwl/workspace         : 15.9.2
   @nrwl/angular           : 15.9.2
   @nrwl/cli               : 15.9.2
   @nrwl/cypress           : 15.9.2
   @nrwl/devkit            : 15.9.2
   @nrwl/eslint-plugin-nx  : 15.9.2
   @nrwl/tao               : 15.9.2
   @nrwl/webpack           : 15.9.2
   @nrwl/nx-cloud          : 16.0.5
   typescript              : 4.9.5

Failure Logs

No response

Operating System

Additional Information

No response

barbados-clemens commented 1 year ago

Hi @abf7d, it looks like that plugin hasn't been updated in a long time, last commit was early 2021. it does look like someone made a fork that potentially should work for cypress 11. https://github.com/jaredpalmer/cypress-image-snapshot/issues/252 https://github.com/simonsmith/cypress-image-snapshot

I'm unaware of any snapshotting plugins for cypress, but this isn't an Nx Bug as @nx/cypress allows using pretty much any cypress version. I wouldn't recommend using anything pre v10. As far as I'm aware of the cypress team doesn't maintain older versions of cypress either so ideally be on latest (at the time of writing that's v12) is the best in terms of cypress usability.

As mentioned, this isn't a bug with Nx + Cypress so I'm going to close this issue. If you have issues with the linked plugins not working, then I'd recommend opening an issue on the plugins repo with a minimal reproducible so they can help you. If the plugin works without Nx with the same cypress versions then feel free to open an issue on the Nx repo with a minimal reproducible.

github-actions[bot] commented 1 year ago

This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context.