mirror of
https://github.com/elyby/accounts-frontend.git
synced 2025-05-31 14:11:58 +05:30
E2e tests for activation and password reset pages with keys in url
This commit is contained in:
@@ -218,4 +218,45 @@ describe('Forgot / reset password', () => {
|
|||||||
}).toString(),
|
}).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(),
|
||||||
|
);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
@@ -108,6 +108,34 @@ describe('Register', () => {
|
|||||||
cy.location('pathname').should('eq', '/');
|
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', () => {
|
it('should allow resend code', () => {
|
||||||
const email = `${Date.now()}@gmail.com`;
|
const email = `${Date.now()}@gmail.com`;
|
||||||
const captchaCode = 'captchaCode';
|
const captchaCode = 'captchaCode';
|
||||||
|
Reference in New Issue
Block a user