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

feat: adding Cypress Component Tests #832

Closed
wants to merge 4 commits into from

Conversation

JessicaSachs
Copy link
Contributor

@JessicaSachs JessicaSachs commented Mar 13, 2021

This branch is a draft. It attempts to setup Cypress Component Tests with the Real World App.

@dmtrKovalenko
Copy link

I fixed this example. Making a PR in component testing to include FAST_REFRESH=false inside react-scripts plugin.

looks like not the best component that should be covered using component tests, but it works

@@ -17,6 +17,8 @@
"dependencies": {
"@auth0/auth0-react": "1.3.0",
"@aws-amplify/ui-react": "0.2.38",
"@cypress/react": "^5.1.0-alpha.1",
"@cypress/webpack-dev-server": "^1.0.4",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JessicaSachs @dmtrKovalenko Should these be moved to devDependencies?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't really matter for apps right? Or you are using yarn install --production for server?

But I don't care we can move it :)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dmtrKovalenko It does for vite tooling, which we will be merging soon as an option during development (#741). Please move these to devDependencies.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For Vite tooling, we'll be swapping this to the @cypress/vite-dev-server package. Trying out the webpack version first 😻 . We have an esm build as well, but yes, these should be devDeps.

@JessicaSachs
Copy link
Contributor Author

@dmtrKovalenko I updated this PR with the new versions and tried to implement the first test (AlertBar.tsx) -- I run into the ReactDOM Issue (Jira: CT-378).

To get it to fail you can do yarn cypress:open:ct and try running the AlertBar.test.tsx spec

@dmtrKovalenko
Copy link

So I did implement one test in my commit for this example. Should I pick this up?

@JessicaSachs JessicaSachs force-pushed the feat/cypress-component-testing branch from ce39516 to 8d9e35d Compare March 19, 2021 05:34
@JessicaSachs
Copy link
Contributor Author

@dmtrKovalenko That would be awesome. 👍


describe("smoke", () => {
it("works", () => {
const [, , snackbarService] = useMachine(snackbarMachine);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BTW @JessicaSachs that is not the ReactDom issue. You can not just call the react hook inside the test

@kevinold
Copy link
Contributor

kevinold commented Apr 6, 2021

@JessicaSachs @dmtrKovalenko What's the status of this branch?

@kevinold kevinold closed this Nov 1, 2021
@mschile mschile deleted the feat/cypress-component-testing branch May 3, 2023 14:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants