Skip to content

Commit

Permalink
test: Replace react-scripts example by nextjs example (#867)
Browse files Browse the repository at this point in the history
* remove react-scripts

* exchange nextjs for react-scripts in update script

* exchange nextjs for react-scripts in example-wait-on

* test: add example nextjs

* update examples/nextjs to cypress 12.10.0
  • Loading branch information
MikeMcC399 authored Apr 18, 2023
1 parent 97e1d8b commit 350e074
Show file tree
Hide file tree
Showing 26 changed files with 2,613 additions and 30,442 deletions.
14 changes: 7 additions & 7 deletions .github/workflows/example-wait-on.yml
Original file line number Diff line number Diff line change
Expand Up @@ -307,17 +307,17 @@ jobs:
# wait for all services to respond
wait-on: 'http://localhost:3050, http://localhost:3060, http://localhost:3070'

wait-on-react-scripts:
wait-on-nextjs:
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Cypress tests
uses: ./
with:
working-directory: examples/react-scripts
start: npm start
wait-on: 'http://127.0.0.1:3000'
working-directory: examples/nextjs
start: npm run dev
wait-on: 'http://localhost:3000'

wait-using-custom-command:
runs-on: ubuntu-22.04
Expand All @@ -327,10 +327,10 @@ jobs:
- name: Cypress tests
uses: ./
with:
working-directory: examples/react-scripts
start: npm start
working-directory: examples/nextjs
start: npm run dev
# let's use wait-on NPM package to check the URL
wait-on: 'npx wait-on --timeout 60000 http://127.0.0.1:3000'
wait-on: 'npx wait-on --timeout 60000 http://localhost:3000'

ping-cli:
runs-on: ubuntu-22.04
Expand Down
30 changes: 30 additions & 0 deletions examples/nextjs/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js

# testing
/coverage

# next.js
/.next/
/out/

# production
/build

# misc
.DS_Store

# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# local env files
.env.local
.env.development.local
.env.test.local
.env.production.local
3 changes: 3 additions & 0 deletions examples/nextjs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# example: nextjs

This example is built based on the instructions from [Learn Next.js](https://nextjs.org/learn).
12 changes: 12 additions & 0 deletions examples/nextjs/cypress.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
const { defineConfig } = require("cypress");

module.exports = defineConfig({
fixturesFolder: false,
e2e: {
setupNodeEvents(on, config) {
// implement node event listeners here
},
supportFile: false,
baseUrl: 'http://localhost:3000',
},
});
6 changes: 6 additions & 0 deletions examples/nextjs/cypress/e2e/spec.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
describe('example: nextjs', () => {
it('loads correctly', () => {
cy.visit('/')
cy.contains('Welcome to Next.js!')
})
})
Loading

0 comments on commit 350e074

Please sign in to comment.