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(@cypress/react): Support react-scripts v4 #15488

Merged
merged 3 commits into from
Mar 16, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion npm/react/examples/react-scripts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@
"@cypress/react": "file:../../dist",
"check-code-coverage": "1.9.2",
"cypress-circleci-reporter": "0.2.0",
"react-scripts": "3.4.3"
"react": "17.0.1",
"react-dom": "17.0.1",
"react-scripts": "4.0.2"
},
"browserslist": {
"production": [
Expand Down
5 changes: 3 additions & 2 deletions npm/react/examples/react-scripts/src/RemotePizza.cy-spec.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React from 'react'
import ReactDom from 'react-dom'
import RemotePizza from './RemotePizza'
import { mount } from '@cypress/react'

Expand All @@ -10,7 +11,7 @@ describe('RemotePizza', () => {
'pizza',
)

mount(<RemotePizza />)
mount(<RemotePizza />, { ReactDom })
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is the ReactDom instance different?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I described this in slack channel. It is because mount function is in the upper directory and linked using file:../

Copy link
Contributor

Choose a reason for hiding this comment

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

Can you document this in the test so it's clear?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

👍

cy.contains('button', /cook/i).click()
cy.wait('@pizza') // make sure the network stub was used

Expand All @@ -35,7 +36,7 @@ describe('RemotePizza', () => {
args: { ingredients },
})

mount(<RemotePizza />)
mount(<RemotePizza />, { ReactDom })
cy.contains('button', /cook/i).click()

for (const ingredient of ingredients) {
Expand Down
Loading