Skip to content

Commit 94b80c3

Browse files
solution exercise 11.9 part 1
1 parent c2122c8 commit 94b80c3

File tree

10 files changed

+1819
-69
lines changed

10 files changed

+1819
-69
lines changed

.eslintrc.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,12 @@ module.exports = {
44
"es6": true,
55
"jest/globals": true,
66
"node": true,
7+
"cypress/globals": true
78
},
89
"extends": [
910
"eslint:recommended",
10-
"plugin:react/recommended"
11+
"plugin:react/recommended",
12+
"plugin:cypress/recommended"
1113
],
1214
"parserOptions": {
1315
"ecmaFeatures": {
@@ -17,7 +19,7 @@ module.exports = {
1719
"sourceType": "module"
1820
},
1921
"plugins": [
20-
"react", "jest"
22+
"react", "jest", "cypress"
2123
],
2224
"rules": {
2325
"indent": [

.github/workflows/pipeline.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,11 @@ jobs:
2121

2222
- run: npm run build
2323

24-
- run: npm run test
24+
- run: npm run test
25+
26+
- name: e2e tests
27+
uses: cypress-io/github-action@v5
28+
with:
29+
command: npm run test:e2e
30+
start: npm run start-prod
31+
wait-on: http://localhost:5001

cypress.config.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
const { defineConfig } = require("cypress");
2+
3+
module.exports = defineConfig({
4+
e2e: {
5+
setupNodeEvents(on, config) {
6+
// implement node event listeners here
7+
},
8+
},
9+
});

cypress/e2e/frontPage.cy.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
describe('Pokedex', function () {
2+
it('front page can be opened', function () {
3+
cy.visit('http://localhost:5001')
4+
cy.contains('ivysaur')
5+
cy.contains('Pokémon and Pokémon character names are trademarks of Nintendo.')})
6+
})

cypress/e2e/spec.cy.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
describe('template spec', () => {
2+
it('passes', () => {
3+
cy.visit('https://example.cypress.io')
4+
})
5+
})

cypress/fixtures/example.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"name": "Using fixtures to represent data",
3+
"email": "[email protected]",
4+
"body": "Fixtures are a great way to mock data for responses to routes"
5+
}

cypress/support/commands.js

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
// ***********************************************
2+
// This example commands.js shows you how to
3+
// create various custom commands and overwrite
4+
// existing commands.
5+
//
6+
// For more comprehensive examples of custom
7+
// commands please read more here:
8+
// https://on.cypress.io/custom-commands
9+
// ***********************************************
10+
//
11+
//
12+
// -- This is a parent command --
13+
// Cypress.Commands.add('login', (email, password) => { ... })
14+
//
15+
//
16+
// -- This is a child command --
17+
// Cypress.Commands.add('drag', { prevSubject: 'element'}, (subject, options) => { ... })
18+
//
19+
//
20+
// -- This is a dual command --
21+
// Cypress.Commands.add('dismiss', { prevSubject: 'optional'}, (subject, options) => { ... })
22+
//
23+
//
24+
// -- This will overwrite an existing command --
25+
// Cypress.Commands.overwrite('visit', (originalFn, url, options) => { ... })

cypress/support/e2e.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// ***********************************************************
2+
// This example support/e2e.js is processed and
3+
// loaded automatically before your test files.
4+
//
5+
// This is a great place to put global configuration and
6+
// behavior that modifies Cypress.
7+
//
8+
// You can change the location of this file or turn off
9+
// automatically serving support files with the
10+
// 'supportFile' configuration option.
11+
//
12+
// You can read more here:
13+
// https://on.cypress.io/configuration
14+
// ***********************************************************
15+
16+
// Import commands.js using ES2015 syntax:
17+
import './commands'

0 commit comments

Comments
 (0)