diff --git a/tests-e2e/cypress/integration/auth/forgot-password.test.ts b/tests-e2e/cypress/integration/auth/forgot-password.test.ts index 7df4fa9..fe164b4 100644 --- a/tests-e2e/cypress/integration/auth/forgot-password.test.ts +++ b/tests-e2e/cypress/integration/auth/forgot-password.test.ts @@ -218,4 +218,45 @@ describe('Forgot / reset password', () => { }).toString(), ); }); + + it('should read key from an url', () => { + const key = 'key'; + const newPassword = 'newPassword'; + + cy.server(); + cy.login({ + accounts: ['default'], + updateState: false, + rawApiResp: true, + }).then(({ accounts: [account] }) => { + cy.route({ + method: 'POST', + url: '/api/authentication/recover-password', + response: account, + }).as('recover'); + }); + + cy.visit('/'); + + cy.visit(`/recover-password/${key}`); + + cy.get('[name=key]').should('have.value', key); + cy.get('[name=key]').should('have.attr', 'readonly'); + cy.get('[name=newPassword]').type(newPassword); + cy.get('[name=newRePassword]').type(newPassword); + cy.get('[type=submit]') + .should('have.length', 1) + .click(); + + cy.wait('@recover') + .its('requestBody') + .should( + 'eq', + new URLSearchParams({ + key, + newPassword, + newRePassword: newPassword, + }).toString(), + ); + }); }); diff --git a/tests-e2e/cypress/integration/auth/register.test.ts b/tests-e2e/cypress/integration/auth/register.test.ts index 23800cd..2669cce 100644 --- a/tests-e2e/cypress/integration/auth/register.test.ts +++ b/tests-e2e/cypress/integration/auth/register.test.ts @@ -108,6 +108,34 @@ describe('Register', () => { cy.location('pathname').should('eq', '/'); }); + it('should read activation key from url', () => { + const activationKey = 'activationKey'; + + cy.server(); + cy.login({ + accounts: ['default'], + updateState: false, + rawApiResp: true, + }).then(({ accounts: [account] }) => { + cy.route({ + method: 'POST', + url: '/api/signup/confirm', + response: account, + }).as('activate'); + }); + cy.visit(`/activation/${activationKey}`); + + cy.get('[name=key]').should('have.value', activationKey); + cy.get('[name=key]').should('have.attr', 'readonly'); + cy.get('[type=submit]').click(); + + cy.wait('@activate') + .its('requestBody') + .should('eq', `key=${activationKey}`); + + cy.location('pathname').should('eq', '/'); + }); + it('should allow resend code', () => { const email = `${Date.now()}@gmail.com`; const captchaCode = 'captchaCode';