Skip to content
This repository was archived by the owner on Mar 5, 2022. It is now read-only.

Commit 08bb786

Browse files
committed
add nextjs test screenshot
1 parent 14eb6aa commit 08bb786

File tree

4 files changed

+12
-1
lines changed

4 files changed

+12
-1
lines changed

examples/nextjs/README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
> A typical project using [next.js](https://nextjs.org/)
44
5+
![Page spec](images/page-spec.png)
6+
57
## Configuration
68

79
In order to reuse next's webpack configuration and all the custom configuration defined in `next.config.js` connect special plugin in [plugin file](./cypress/plugins/index.js)
@@ -52,3 +54,7 @@ cy.contains(
5254
```
5355

5456
Find more examples in [Page.spec.jsx](./cypress/components/Page.spec.jsx).
57+
58+
## Coverage
59+
60+
Code coverage is not working yet, see issue [431](https://github.com/bahmutov/cypress-react-unit-test/issues/431). It was disabled in [cypress.json](cypress.json)

examples/nextjs/cypress.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,8 @@
44
"viewportHeight": 800,
55
"experimentalComponentTesting": true,
66
"experimentalFetchPolyfill": true,
7-
"componentFolder": "cypress/components"
7+
"componentFolder": "cypress/components",
8+
"env": {
9+
"coverage": false
10+
}
811
}

examples/nextjs/cypress/components/Page.spec.jsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ describe('NextJS page', () => {
88
mount(<IndexPage />)
99

1010
cy.contains('Welcome to Next.js')
11+
cy.get('[aria-label=search]').type('Cypress')
12+
cy.contains('.search-text', 'You are searching for: Cypress')
1113
})
1214

1315
it("It doesn't run the `.getInitialProps()`", () => {
152 KB
Loading

0 commit comments

Comments
 (0)