Skip to content

Commit 224a7ac

Browse files
committed
WIP
1 parent 9c633f9 commit 224a7ac

File tree

9 files changed

+3153
-21
lines changed

9 files changed

+3153
-21
lines changed

.github/workflows/gh-pages.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,54 @@ jobs:
2727
- name: ⚡ Run test
2828
run: npm test
2929

30+
cypress:
31+
runs-on: ubuntu-latest
32+
timeout-minutes: 10
33+
steps:
34+
- name: 🛑 Cancel Previous Runs
35+
uses: styfle/[email protected]
36+
37+
- name: ⬇️ Checkout repo
38+
uses: actions/checkout@v3
39+
40+
- name: ⎔ Setup node
41+
uses: actions/setup-node@v3
42+
with:
43+
node-version: 16
44+
45+
- name: 📥 Download deps
46+
uses: bahmutov/npm-install@v1
47+
48+
- name: 🍼 Create pages build
49+
run: npm run deploy:pages
50+
51+
- name: 🧪 Cypress run
52+
# Install NPM dependencies and run all Cypress tests
53+
uses: cypress-io/github-action@v4
54+
with:
55+
start: npm run serve
56+
wait-on: "http://localhost:8080"
57+
wait-on-timeout: 120
58+
working-directory: e2e
59+
config: pageLoadTimeout=100000,baseUrl=http://localhost:8080
60+
61+
- name: 🛗 Upload Artifacts
62+
uses: actions/upload-artifact@v2
63+
# after the test run completes
64+
# store videos and any screenshots
65+
# NOTE: screenshots will be generated only if an E2E test failed
66+
# thus we store screenshots only on failures
67+
if: failure()
68+
with:
69+
name: cypress-screenshots
70+
path: e2e/cypress/screenshots
71+
- uses: actions/upload-artifact@v2
72+
# Test run video was always captured, so this action uses "always()" condition
73+
if: always()
74+
with:
75+
name: cypress-videos
76+
path: e2e/cypress/videos
77+
3078
publish:
3179
name: Publish
3280
runs-on: ubuntu-latest

cypress.config.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
const { defineConfig } = require('cypress')
2+
3+
module.exports = defineConfig({
4+
e2e: {
5+
// We've imported your old cypress plugins here.
6+
// You may want to clean this up later by importing these.
7+
setupNodeEvents(on, config) {
8+
return require('./cypress/plugins/index.js')(on, config)
9+
},
10+
baseUrl: 'http://localhost:8080',
11+
},
12+
})

cypress/e2e/basic.cy.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
describe("Visit Home", () => {
2+
it("Visits the home page", () => {
3+
cy.visit("/");
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/plugins/index.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/// <reference types="cypress" />
2+
// ***********************************************************
3+
// This example plugins/index.js can be used to load plugins
4+
//
5+
// You can change the location of this file or turn off loading
6+
// the plugins file with the 'pluginsFile' configuration option.
7+
//
8+
// You can read more here:
9+
// https://on.cypress.io/plugins-guide
10+
// ***********************************************************
11+
12+
// This function is called when a project is opened or re-opened (e.g. due to
13+
// the project's config changing)
14+
15+
/**
16+
* @type {Cypress.PluginConfig}
17+
*/
18+
// eslint-disable-next-line no-unused-vars
19+
module.exports = (on, config) => {
20+
// `on` is used to hook into various events Cypress emits
21+
// `config` is the resolved Cypress config
22+
}

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: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// ***********************************************************
2+
// This example support/index.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'
18+
19+
// Alternatively you can use CommonJS syntax:
20+
// require('./commands')

0 commit comments

Comments
 (0)