From 012ff7c604c90c2b19e0fc0b0cd5aea1a4bae777 Mon Sep 17 00:00:00 2001 From: Christian Cueni Date: Tue, 19 May 2020 09:35:45 +0200 Subject: [PATCH 01/11] Add confirmation field --- .../cypress/integration/registration.spec.js | 12 +++++++++ client/cypress/support/commands.js | 6 ++++- client/src/components/Checkbox.vue | 4 ++- client/src/components/inputs/BaseInput.vue | 4 ++- client/src/pages/registration.vue | 27 ++++++++++++++++++- 5 files changed, 49 insertions(+), 4 deletions(-) diff --git a/client/cypress/integration/registration.spec.js b/client/cypress/integration/registration.spec.js index 1967b42d..465f2db9 100644 --- a/client/cypress/integration/registration.spec.js +++ b/client/cypress/integration/registration.spec.js @@ -144,6 +144,18 @@ describe('Registration', () => { cy.get('[data-cy="passwordConfirmation-local-errors"]').contains('Die Bestätigung von Passwort wiederholen stimmt nicht überein'); }); + it('displays error if terms are not accepted', () => { + cy.route('POST', isEmailAvailableUrl, "true"); + cy.route('POST', registerUrl, registrationResponse); + + cy.visit('/hello'); + cy.checkEmailAvailable(registrationResponse.email); + + cy.get('[data-cy="registration-title"]').contains('Damit Sie mySkillbox verwenden können, müssen Sie ein Konto erstellen.'); + cy.register(registrationResponse.gender, registrationResponse.firstname, registrationResponse.lastname, 'Weg 1', 'Bern', '3001', 'Abcd1234!', 'Abcd1234!', false); + cy.get('[data-cy="acceptedTerms-local-errors"]').contains('Die AGBs und die Datenschutzbestimmungen müssen akzeptiert werden'); + }); + it('redirects to hello if email is missing', () => { cy.visit('/register'); cy.get('[data-cy="hello-title"]').contains('Wollen sie mySkillbox jetzt im Unterricht verwenden?'); diff --git a/client/cypress/support/commands.js b/client/cypress/support/commands.js index 8eb91930..e16af203 100644 --- a/client/cypress/support/commands.js +++ b/client/cypress/support/commands.js @@ -121,7 +121,7 @@ Cypress.Commands.add('enterPassword', (password) => { cy.get('[data-cy="login-button"]').click(); }); -Cypress.Commands.add('register', (prefix, firstname, lastname, street, city, postcode, password, passwordConfirmation) => { +Cypress.Commands.add('register', (prefix, firstname, lastname, street, city, postcode, password, passwordConfirmation, acceptTerms=true) => { let selection = prefix === 1 ? 'Herr' : 'Frau'; @@ -150,6 +150,10 @@ Cypress.Commands.add('register', (prefix, firstname, lastname, street, city, pos cy.get('[data-cy="password-input"]').type(password); } + if (acceptTerms) { + cy.get('[data-cy="acceptedTerms-input"]').click(); + } + cy.get('[data-cy="passwordConfirmation-input"]').type(passwordConfirmation); cy.get('[data-cy="register-button"]').click(); }); diff --git a/client/src/components/Checkbox.vue b/client/src/components/Checkbox.vue index e177d87e..112af7d6 100644 --- a/client/src/components/Checkbox.vue +++ b/client/src/components/Checkbox.vue @@ -5,7 +5,9 @@ :item="item" :type="'checkbox'" @input="passOn" - /> + > + +