Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add System Tests for Nx #26045

Closed
jordanpowell88 opened this issue Mar 7, 2023 · 11 comments
Closed

Add System Tests for Nx #26045

jordanpowell88 opened this issue Mar 7, 2023 · 11 comments
Labels
stale no activity on this issue for a long period

Comments

@jordanpowell88
Copy link
Contributor

What would you like?

Add a new Nx workspace to system-tests/nx-monorepo and create angular, react-vite and react-webpack projects that use CT (we can add more in the future). This will also generate angular-e2e, react-vite-e2e and react-webpack-e2e applications as well for E2E testing. Then we need a way to configure system-tests to run the appropriate tests for each project:

  • Example script: nx run react-vite:component-test for CT app
  • Example script: nx e2e react-webpack-e2e for E2E apps

Why is this needed?

Nx is a 1st class adopter of both Cypress E2E & CT. Currently we do not have any system-tests setup to assure that changes to Cypress do not break Nx. The @nrwl/cypress package has ~900K weekly downloads on npm and represents a large number of users. Adding system-tests around Nx can help mitigate any breaking changes for Nx and our users.

Other

No response

@lmiller1990
Copy link
Contributor

@marktnoonan
Copy link
Contributor

Have we established that is feasible or do we need to do a spike and confirm? I recall some discussion about the way that NX wraps the Cypress binary not necessarily being easy to system test but I don't remember the details. @jordanpowell88 what do you think?

@jordanpowell88
Copy link
Contributor Author

Yeah Nx uses the @nrwl/cypress executor. I'm not quite sure if we can still use their executor but target our binary instead of the cypress npm package.

@lmiller1990
Copy link
Contributor

We've decided to spent max 1 day to see if there's any unknowns before doing the entire thing.

@lmiller1990 lmiller1990 self-assigned this Apr 11, 2023
@lmiller1990
Copy link
Contributor

@jordanpowell88
Copy link
Contributor Author

WIP - I started on it. https://github.com/cypress-io/cypress/pull/new/issue-26045

FYI, we can add all of our projects in one nx monorepo. Ie: Angular, React, Vue, etc

Also the difficult part is actually executing the tests. Let me know if you need any additional context

@lmiller1990
Copy link
Contributor

Ran into some issues, Nx expects a real binary, not a symlinked one, not sure why I can't just symlink like other tests.

I'll try write a binary-system test, but I'll be doing this later on - got a few other higher priority issues to do first.

@barbados-clemens
Copy link
Contributor

@lmiller1990 Nx just runs the node apis from cypress

https://github.com/nrwl/nx/blob/master/packages/cypress/src/executors/cypress/cypress.impl.ts#L20

https://github.com/nrwl/nx/blob/master/packages/cypress/src/executors/cypress/cypress.impl.ts#L297-L299

is there a way we could change the Cypress executor to make it easier to work with the simlinked packages?

@lmiller1990
Copy link
Contributor

There might be - the next thing I'm going to try is writing what we are calling "binary tests" that run against a real, built version of the Cypress binary. No symlinks or anything - it's the real deal. That should avoid this problem. The tests run quite a bit slower, but it's also more production like.

Those tests are in this directory, for reference: https://github.com/cypress-io/cypress/blob/develop/system-tests/test-binary/node_versions_spec.ts

If this doesn't work out, I'll look more into what we can do in Cypress and/or the Nx plugin to facilitate this.

@lmiller1990 lmiller1990 removed their assignment Apr 18, 2023
@cypress-app-bot
Copy link
Collaborator

This issue has not had any activity in 180 days. Cypress evolves quickly and the reported behavior should be tested on the latest version of Cypress to verify the behavior is still occurring. It will be closed in 14 days if no updates are provided.

@cypress-app-bot cypress-app-bot added the stale no activity on this issue for a long period label Oct 16, 2023
@cypress-app-bot
Copy link
Collaborator

This issue has been closed due to inactivity.

@cypress-app-bot cypress-app-bot closed this as not planned Won't fix, can't repro, duplicate, stale Oct 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stale no activity on this issue for a long period
Projects
None yet
Development

No branches or pull requests

5 participants