Skip to content

Commit

Permalink
Adds stuff to run cypress tests (#53)
Browse files Browse the repository at this point in the history
* Removes example tests.

* Adds support for running cypress through npm.

* Setup Cypress to not take screenshots and videos on test failure.

* Refactor tests to take in testing credentials using dotenv.

* Update Circleci config to run Cypress tests.
  • Loading branch information
godwinpang committed Mar 13, 2021
1 parent 4fbad9b commit 042387d
Show file tree
Hide file tree
Showing 25 changed files with 21 additions and 2,162 deletions.
9 changes: 7 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
version: 2.1
orbs:
node: circleci/[email protected]
cypress: cypress-io/[email protected]
jobs:
lint:
docker:
- image: circleci/node:12.13.0
- image: circleci/node:12.14.0
steps:
- checkout
- restore_cache:
Expand All @@ -17,7 +18,7 @@ jobs:
- run: npm run lint
test:
docker:
- image: circleci/node:12.13.0
- image: circleci/node:12.14.0
steps:
- checkout
- restore_cache:
Expand All @@ -32,4 +33,8 @@ workflows:
lint_and_test:
jobs:
- lint
- cypress/run:
executor: cypress/base-12-14-0
start: npm run start
wait-on: 'http://localhost:3000'
- test
4 changes: 3 additions & 1 deletion cypress.json
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
{}
{
"video": false
}
7 changes: 4 additions & 3 deletions cypress/integration/critical_path.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
describe('Inductee Sign In', function() {
it('Logs in and views points.', function() {
cy.visit('http://localhost:3000', {
// Rememver to clear session storage before every run to clear firebase auth's cache!
onBeforeLoad: win => {
win.sessionStorage.clear();
},
Expand All @@ -13,10 +14,10 @@ describe('Inductee Sign In', function() {

// Get an input, type into it and verify that the value has been updated
cy.get('#email')
.type('[email protected]')
.should('have.value', '[email protected]');
.type(Cypress.env('EMAIL'))
.should('have.value', Cypress.env('EMAIL'));

cy.get('#password').type('hkn-password');
cy.get('#password').type(Cypress.env('PASSWORD'));

cy.contains('Sign in').click();

Expand Down
325 changes: 0 additions & 325 deletions cypress/integration/examples/actions.spec.js

This file was deleted.

Loading

0 comments on commit 042387d

Please sign in to comment.