Skip to content

Commit

Permalink
fix(tests): Migrate tests of email notifications from WebDriver to Cy…
Browse files Browse the repository at this point in the history
…press (#342)

Contributes to #199.
  • Loading branch information
Salayna authored Aug 27, 2020
1 parent 789d849 commit c640c4c
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 120 deletions.
32 changes: 31 additions & 1 deletion cypress/integration/email-notification.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ context('reduce frequency of email notifications', () => {
});
});

it('user activates daily email notifications', () => {
it('user activates daily email notifications then reduce it to weekly', () => {
cy.loginAsAdmin();
cy.visit('/settings');
cy.get('a')
Expand All @@ -23,5 +23,35 @@ context('reduce frequency of email notifications', () => {
.to.have.property('pref')
.to.have.property('emSub', '1');
});
cy.visit(
`/api/unsubscribe?uId=000000000000000000000001&type=emSub&action=reduce`
);
cy.get('body').contains('weekly');
cy.request('api/user').should(response => {
expect(response.body)
.to.have.property('pref')
.to.have.property('emSub', 7);
});
});
});
context('unsubscribe from email notifications', () => {
it('user has instant eamail notification', () => {
cy.loginAsAdmin();
cy.request('/api/user').should((response) => {
expect(response.body)
.to.have.property('pref')
.to.have.property('emSub', 0);
});
});
it('user unsubscribes from email notification', () => {
cy.loginAsAdmin();
cy.visit('/api/unsubscribe?uId=000000000000000000000001&type=emSub');
cy.get('body').contains('unsubscribed');
cy.request('api/user').should((response) => {
expect(response.body)
.to.have.property('pref')
.to.have.property('emSub', -1);
});
cy.logout();
});
});
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"docker:test:cypress:dev": ". ./.env-docker && npm run test:cypress:dev",
"docker:test:cypress": ". ./.env-docker && npm run test:cypress",
"docker:test": "npm run docker:run test-unit && npm run docker:run test-api && npm run docker:seed && wdio wdio.conf.js && npm run docker:test:cypress",
"lint:fix": "node_modules/.bin/prettier \"./**/*.js\" \"scripts/**/*.js\" \"./**/*.ts\" --write",
"lint:fix": "node_modules/.bin/prettier \"./**/*.{js,ts,tsx}\" \"scripts/**/*.{js,ts,tsx}\" --write",
"lint": "eslint app"
},
"engines": {
Expand Down
118 changes: 0 additions & 118 deletions test/specs/email-notifications.tests.js

This file was deleted.

0 comments on commit c640c4c

Please sign in to comment.