diff --git a/.github/workflows/pipeline.yml b/.github/workflows/pipeline.yml index cc27877..a314707 100644 --- a/.github/workflows/pipeline.yml +++ b/.github/workflows/pipeline.yml @@ -22,4 +22,10 @@ jobs: - name: Build run: npm run build - name: Test - run: npm test \ No newline at end of file + 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 diff --git a/app.js b/app.js index 6dc30f0..ba924d9 100644 --- a/app.js +++ b/app.js @@ -7,5 +7,5 @@ const PORT = process.env.PORT || 5000 app.use(express.static('dist')) app.listen(PORT, () => { - console.log('server started on port 5000') + console.log(`server started on port ${PORT}`) }) diff --git a/cypress.json b/cypress.json new file mode 100644 index 0000000..9e26dfe --- /dev/null +++ b/cypress.json @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/cypress/integration/app.js b/cypress/integration/app.js new file mode 100644 index 0000000..d06b554 --- /dev/null +++ b/cypress/integration/app.js @@ -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') + }) +}) \ No newline at end of file diff --git a/package.json b/package.json index ecc57cf..98d3366 100644 --- a/package.json +++ b/package.json @@ -5,10 +5,12 @@ "main": "src/index.js", "scripts": { "start": "webpack-dev-server --open --mode development", + "start-test": "NODE_ENV=test node app.js", "start-prod": "node app.js", "test": "jest", "eslint": "eslint './**/*.{js,jsx}'", - "build": "webpack --mode production" + "build": "webpack --mode production", + "test:e2e": "npx cypress run" }, "repository": { "type": "git",