|
| 1 | +describe('Test in frontend that the privacy consent view', () => { |
| 2 | + beforeEach(() => { |
| 3 | + cy.db_updateExtensionParameter('allowUserRegistration', '1', 'com_users'); |
| 4 | + cy.db_enableExtension('1', 'plg_system_privacyconsent'); |
| 5 | + }); |
| 6 | + |
| 7 | + afterEach(() => { |
| 8 | + cy.db_updateExtensionParameter('allowUserRegistration', '0', 'com_users'); |
| 9 | + cy.db_enableExtension('0', 'plg_system_privacyconsent'); |
| 10 | + cy.task('queryDB', 'DELETE FROM #__privacy_consents'); |
| 11 | + cy.task('queryDB', "DELETE FROM #__users WHERE username = 'test'"); |
| 12 | + }); |
| 13 | + |
| 14 | + it('can display privacy policy checkbox to users already with an account', () => { |
| 15 | + cy.doFrontendLogin(); |
| 16 | + cy.visit('/index.php'); |
| 17 | + cy.db_createPrivacyConsent(); |
| 18 | + cy.get('.alert').contains('By signing up to this website and agreeing to the Privacy Policy you agree to this website storing your information.'); |
| 19 | + }); |
| 20 | + |
| 21 | + it('can allow users already with an account to not agree to the privacy policy', () => { |
| 22 | + cy.doFrontendLogin(); |
| 23 | + cy.visit('/index.php'); |
| 24 | + cy.get('.controls > .btn-primary').click({ force: true }); |
| 25 | + cy.get('.alert-message').should('include.text', "Profile could not be saved: Agreement to the site's Privacy Policy is required."); |
| 26 | + }); |
| 27 | + |
| 28 | + it('can allow users already with an account to agree to the privacy policy', () => { |
| 29 | + cy.doFrontendLogin(); |
| 30 | + cy.visit('/index.php'); |
| 31 | + cy.get('#jform_privacyconsent_privacy0').click(); |
| 32 | + cy.get('.controls > .btn-primary').click({ force: true }); |
| 33 | + cy.get('.alert-message').should('include.text', 'Profile saved.'); |
| 34 | + }); |
| 35 | + |
| 36 | + it('can allow current users who declined privacy request to edit then agree to privacy consent', () => { |
| 37 | + cy.doFrontendLogin(); |
| 38 | + cy.visit('/index.php'); |
| 39 | + cy.get('#jform_privacyconsent_privacy1').click(); |
| 40 | + cy.get('.controls > .btn-primary').click({ force: true }); |
| 41 | + cy.get('.alert-message').should('include.text', "Profile could not be saved: Agreement to the site's Privacy Policy is required."); |
| 42 | + cy.get('#jform_privacyconsent_privacy0').click(); |
| 43 | + cy.get('.controls > .btn-primary').click({ force: true }); |
| 44 | + cy.get('.alert-message').should('include.text', 'Profile saved.'); |
| 45 | + }); |
| 46 | + |
| 47 | + it('can display privacy consent on new user registration form', () => { |
| 48 | + cy.visit('/index.php?option=com_users&view=registration'); |
| 49 | + cy.get('.alert').should('contain.text', 'By signing up to this website and agreeing to the Privacy Policy you agree to this website storing your information.'); |
| 50 | + }); |
| 51 | + |
| 52 | + it('can display privacy consent on new user registration form and have user decline privacy consent', () => { |
| 53 | + cy.visit('/index.php?option=com_users&view=registration'); |
| 54 | + cy.get('#jform_name').clear().type('test user'); |
| 55 | + cy.get('#jform_username').clear().type('test'); |
| 56 | + cy.get('#jform_email1').clear().type('[email protected]'); |
| 57 | + cy.get('#jform_password1').clear().type('testtesttest'); |
| 58 | + cy.get('#jform_password2').clear().type('testtesttest'); |
| 59 | + cy.get('.com-users-registration__register').click(); |
| 60 | + cy.get('.alert-message').should('contain.text', "Registration failed: Agreement to the site's Privacy Policy is required."); |
| 61 | + }); |
| 62 | + |
| 63 | + it('can display privacy consent on new user registration form and have user accept privacy consent', () => { |
| 64 | + cy.visit('/index.php?option=com_users&view=registration'); |
| 65 | + cy.get('#jform_name').clear().type('test user'); |
| 66 | + cy.get('#jform_username').clear().type('test'); |
| 67 | + cy.get('#jform_email1').clear().type('[email protected]'); |
| 68 | + cy.get('#jform_password1').clear().type('testtesttest'); |
| 69 | + cy.get('#jform_password2').clear().type('testtesttest'); |
| 70 | + cy.get('#jform_privacyconsent_privacy0').click(); |
| 71 | + cy.get('.com-users-registration__register').click(); |
| 72 | + cy.get('.alert-message').should('contain.text', 'Your account has been created and a verification link has been sent to the email address you entered. Note that you must verify the account by selecting the verification link when you get the email and then an administrator will activate your account before you can login.'); |
| 73 | + }); |
| 74 | +}); |
0 commit comments