Add E2E tests to deployment pipeline

main
midudev 3 years ago
parent 9f1190ac9e
commit 9c4cfe420e

@ -23,3 +23,9 @@ jobs:
run: npm run build run: npm run build
- name: Test - name: Test
run: npm test run: npm test
- name: E2E tests
uses: cypress-io/github-action@v2
with:
command: npm run test:e2e
start: npm run start-test
wait-on: http://localhost:5000

@ -7,5 +7,5 @@ const PORT = process.env.PORT || 5000
app.use(express.static('dist')) app.use(express.static('dist'))
app.listen(PORT, () => { app.listen(PORT, () => {
console.log('server started on port 5000') console.log(`server started on port ${PORT}`)
}) })

@ -0,0 +1,9 @@
/* global cy */
describe('Pokedex', function() {
it('frontpage can be opened', function () {
cy.visit('http://localhost:5000')
cy.contains('pikachu')
cy.contains('Pokémon and Pokémon character names are trademarks of Nintendo')
})
})

@ -5,10 +5,12 @@
"main": "src/index.js", "main": "src/index.js",
"scripts": { "scripts": {
"start": "webpack-dev-server --open --mode development", "start": "webpack-dev-server --open --mode development",
"start-test": "NODE_ENV=test node app.js",
"start-prod": "node app.js", "start-prod": "node app.js",
"test": "jest", "test": "jest",
"eslint": "eslint './**/*.{js,jsx}'", "eslint": "eslint './**/*.{js,jsx}'",
"build": "webpack --mode production" "build": "webpack --mode production",
"test:e2e": "npx cypress run"
}, },
"repository": { "repository": {
"type": "git", "type": "git",

Loading…
Cancel
Save