Skip to content

Commit

Permalink
pipeline and e2e tests work nowgit add .github
Browse files Browse the repository at this point in the history
  • Loading branch information
Veeti Laine committed Jul 26, 2024
1 parent 4ccc433 commit 89b87c4
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
uses: cypress-io/github-action@v5
with:
command: npm run test:e2e
start: dotenvx run -- npm run start:test
start: dotenvx run -- npm run start:e2e
wait-on: "http://localhost:3003"
env:
DOTENV_PRIVATE_KEY_CI: ${{ secrets.DOTENV_PRIVATE_KEY_CI }}
Expand Down
7 changes: 7 additions & 0 deletions controllers/testing.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,11 @@ router.post('/reset', async (request, response) => {
response.status(204).end();
});

router.post('/empty', async (request, response) => {
await Blog.deleteMany({});
await User.deleteMany({});

response.status(204).end();
});

module.exports = router;
2 changes: 1 addition & 1 deletion frontend/cypress/e2e/bloglist.cy.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-disable no-undef */
describe('Bloglist app', function() {
beforeEach(function() {
cy.request('POST', `${Cypress.env('BACKEND')}/testing/reset`);
cy.request('POST', `${Cypress.env('BACKEND')}/testing/empty`);
const user = {
name: 'Testi Käyttäjä',
username: 'testuser',
Expand Down
Binary file modified frontend/cypress/videos/bloglist.cy.js.mp4
Binary file not shown.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"eslint": "eslint .",
"test": "NODE_ENV=testing jest --verbose --runInBand --forceExit",
"start:test": "NODE_ENV=testing node index.js",
"start:e2e": "npm run start:test & cd frontend && npm run start",
"test:e2e": "cd frontend && npm run cypress"
},
"author": "",
Expand Down

0 comments on commit 89b87c4

Please sign in to comment.