Skip to content

Commit 3798a1d

Browse files
committed
Add Cypress run to GitHub Actions workflow
1 parent cbc85a9 commit 3798a1d

File tree

2 files changed

+37
-2
lines changed

2 files changed

+37
-2
lines changed

.github/workflows/node_mongo_ci.yml

+20-2
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@ jobs:
1414

1515
jest:
1616
runs-on: ubuntu-latest
17-
permissions:
18-
contents: read
1917

2018
steps:
2119
- name: Checkout the repo
@@ -62,3 +60,23 @@ jobs:
6260
fi
6361
working-directory: ${{ env.node_app_root }}
6462
if: always()
63+
64+
cypress:
65+
runs-on: ubuntu-latest
66+
67+
services:
68+
mongo:
69+
image: mongo
70+
71+
steps:
72+
- name: Checkout the repo
73+
uses: actions/checkout@v4
74+
75+
- name: Cypress run
76+
uses: cypress-io/github-action@v6
77+
with:
78+
config-file: cypress.config.ci.js
79+
working-directory: ${{ env.node_app_root }}
80+
env:
81+
MONGODB_URI: mongodb://mongo/node_mongo_book_reviews_test
82+
JWT_SECRET: thisIsANotSoSecretTestSecretinDocker

node_mongo/cypress.config.ci.js

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
const { defineConfig } = require('cypress')
2+
3+
module.exports = defineConfig({
4+
registerUrl: '/api/register',
5+
loginUrl: '/api/login',
6+
bookUrl: '/api/book',
7+
userUrl: '/api/user',
8+
reviewUrl: '/api/review',
9+
e2e: {
10+
// We've imported your old cypress plugins here.
11+
// You may want to clean this up later by importing these.
12+
setupNodeEvents(on, config) {
13+
return require('./cypress/plugins/index.js')(on, config)
14+
},
15+
baseUrl: 'http://localhost:3000',
16+
},
17+
})

0 commit comments

Comments
 (0)