From 968c6f77009dd8f1317c9fc5176dbe05174de509 Mon Sep 17 00:00:00 2001 From: Sem Bauke <46919888+Sembauke@users.noreply.github.com> Date: Thu, 29 Apr 2021 22:33:21 +0200 Subject: [PATCH] feat(Cypress): Add test for email change (#41946) * feat(Cypress): Add test for email change * fix should be possible to save new email --- cypress/integration/settings/email-change.js | 39 ++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 cypress/integration/settings/email-change.js diff --git a/cypress/integration/settings/email-change.js b/cypress/integration/settings/email-change.js new file mode 100644 index 0000000000..fae05c4725 --- /dev/null +++ b/cypress/integration/settings/email-change.js @@ -0,0 +1,39 @@ +/* global cy */ +describe('Email input field', () => { + before(() => { + cy.login(); + cy.visit('/settings'); + }); + + it('Should be possible to submit the new email', () => { + cy.get('[id=new-email]') + .type('bar@foo.com') + .should('have.attr', 'value', 'bar@foo.com'); + + cy.get('[id=confirm-email]') + .type('bar@foo.com') + .should('have.attr', 'value', 'bar@foo.com'); + + cy.get('[id=form-update-email]').within(() => { + cy.contains('Save').click(); + }); + }); + + it('Displays an error message when there are problems with the submitted emails', () => { + cy.get('[id=confirm-email]').clear().type('foo@bar.com'); + + cy.get('[class=help-block]').contains( + 'Both new email addresses must be the same' + ); + + cy.get('[id=new-email]').clear().type('foo@bar.com'); + + cy.get('[class=help-block]').contains( + 'This email is the same as your current email' + ); + }); + + it('Should be possible to get Quincys weekly email', () => { + cy.contains('Yes please').click(); + }); +});