Skip to content

Commit

Permalink
MLPAB-2228 Split your details page and prevent editing after identity…
Browse files Browse the repository at this point in the history
… check (#1378)
  • Loading branch information
hawx authored Jul 26, 2024
1 parent 2bc832c commit 04a6bfd
Show file tree
Hide file tree
Showing 46 changed files with 1,405 additions and 1,527 deletions.
37 changes: 37 additions & 0 deletions cypress/e2e/donor/can-you-sign-your-lpa.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
describe('Can you sign your LPA', () => {
describe('first time', () => {
beforeEach(() => {
cy.visit('/fixtures?redirect=/can-you-sign-your-lpa');
});

it('can be submitted', () => {
cy.checkA11yApp();
cy.contains('a', 'Return to task list').should('not.exist');

cy.get('#f-can-sign').check({ force: true });

cy.contains('button', 'Save and continue').click();
cy.url().should('contain', '/your-preferred-language');
});

it('errors when empty', () => {
cy.contains('button', 'Save and continue').click();

cy.get('.govuk-error-summary').within(() => {
cy.contains('Select yes if you can sign yourself online');
});

cy.contains('fieldset .govuk-error-message', 'Select yes if you can sign yourself online');
});
});

describe('after completing', () => {
beforeEach(() => {
cy.visit('/fixtures?redirect=/can-you-sign-your-lpa&progress=chooseYourAttorneys');
});

it('shows task list button', () => {
cy.contains('a', 'Return to task list');
});
});
});
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
describe('Confirm your certificate provider is not related', () => {
beforeEach(() => {
cy.visit('/fixtures?redirect=/your-details&progress=addCorrespondent');
cy.get('#f-last-name').clear().type('Cooper');
cy.contains('button', 'Continue').click();
cy.visitLpa('/task-list');
cy.contains('li', "Check and send to your certificate provider")
.should('contain', 'Not started')
.find('a')
.click();
});
beforeEach(() => {
cy.visit('/fixtures?redirect=/your-name&progress=addCorrespondent');
cy.get('#f-last-name').clear().type('Cooper');
cy.contains('button', 'Save and continue').click();
cy.visitLpa('/task-list');
cy.contains('li', "Check and send to your certificate provider")
.should('contain', 'Not started')
.find('a')
.click();
});

it('continues when selected', () => {
cy.checkA11yApp();

it('continues when selected', () => {
cy.checkA11yApp();
cy.get('#f-yes-no').click({ force: true });
cy.contains('button', 'Continue').click();
cy.url().should('contain', '/check-your-lpa');
});

cy.get('#f-yes-no').click({ force: true });
cy.contains('button', 'Continue').click();
cy.url().should('contain', '/check-your-lpa');
});
it('errors when not selected', () => {
cy.contains('button', 'Continue').click();

it('errors when not selected', () => {
cy.contains('button', 'Continue').click();
cy.get('.govuk-error-summary').within(() => {
cy.contains('Select the box to confirm your certificate provider is not related to you or your attorneys, or choose another certificate provider');
});

cy.get('.govuk-error-summary').within(() => {
cy.contains('Select the box to confirm your certificate provider is not related to you or your attorneys, or choose another certificate provider');
cy.contains('.govuk-error-message', 'Select the box to confirm your certificate provider is not related to you or your attorneys, or choose another certificate provider');
});

cy.contains('.govuk-error-message', 'Select the box to confirm your certificate provider is not related to you or your attorneys, or choose another certificate provider');
});
});
6 changes: 1 addition & 5 deletions cypress/e2e/donor/make-a-new-lpa.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,6 @@ describe('Make a new LPA', () => {
cy.get('main').should('not.contain', 'WEST MIDLANDS');
cy.contains("a", "Continue").click();

// TODO for now, so the donor can answer can you sign online. When we revisit donor flow we will fix the
// ordering and use single question pages for initial LPA creation (and move error/warning e2e to own files).
cy.url().should('contain', '/your-details');
cy.get('#f-first-names').should('have.value', 'a');
cy.get('#f-last-name').should('have.value', 'b');
cy.url().should('contain', '/can-you-sign-your-lpa');
});
})
8 changes: 6 additions & 2 deletions cypress/e2e/donor/provide-your-details.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,18 @@ describe('Provide your details', () => {

cy.get('#f-first-names').type('John' + rnd);
cy.get('#f-last-name').type('Doe' + rnd);
cy.contains('button', 'Save and continue').click();

cy.get('#f-date-of-birth').type('1');
cy.get('#f-date-of-birth-month').type('2');
cy.get('#f-date-of-birth-year').type('1990');
cy.get('#f-can-sign').check({ force: true });
cy.contains('button', 'Continue').click();
cy.contains('button', 'Save and continue').click();

AddressFormAssertions.assertCanAddAddressFromSelect();

cy.get('#f-can-sign').check({ force: true });
cy.contains('button', 'Save and continue').click();

cy.get('[name="contact-language"]').check('en', { force: true });
cy.get('[name="lpa-language"]').check('en', { force: true });
cy.contains('button', 'Save and continue').click();
Expand Down
6 changes: 3 additions & 3 deletions cypress/e2e/donor/your-address.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,17 @@ describe('Donor address', () => {

it('address can be looked up', () => {
AddressFormAssertions.assertCanAddAddressFromSelect()
cy.url().should('contain', '/your-preferred-language');
cy.url().should('contain', '/can-you-sign-your-lpa');
});

it('address can be entered manually if not found', () => {
AddressFormAssertions.assertCanAddAddressManually('I can’t find my address in the list')
cy.url().should('contain', '/your-preferred-language');
cy.url().should('contain', '/can-you-sign-your-lpa');
});

it('address can be entered manually on invalid postcode', () => {
AddressFormAssertions.assertCanAddAddressManually('Enter address manually', true)
cy.url().should('contain', '/your-preferred-language');
cy.url().should('contain', '/can-you-sign-your-lpa');
});

it('errors when empty postcode', () => {
Expand Down
88 changes: 88 additions & 0 deletions cypress/e2e/donor/your-date-of-birth.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
describe('Your date of birth', () => {
describe('first time', () => {
beforeEach(() => {
cy.visit('/fixtures?redirect=/your-date-of-birth');
});

it('can be submitted', () => {
cy.checkA11yApp();
cy.contains('a', 'Return to task list').should('not.exist');

cy.get('#f-date-of-birth').type('1');
cy.get('#f-date-of-birth-month').type('2');
cy.get('#f-date-of-birth-year').type('1990');

cy.contains('button', 'Save and continue').click();
cy.url().should('contain', '/your-address');
});

it('errors when empty', () => {
cy.contains('button', 'Save and continue').click();

cy.get('.govuk-error-summary').within(() => {
cy.contains('Enter date of birth');
});

cy.contains('#date-of-birth-hint + .govuk-error-message', 'Enter date of birth');
});

it('errors when invalid dates of birth', () => {
cy.get('#f-date-of-birth').type('1');
cy.contains('button', 'Save and continue').click();
cy.contains('#date-of-birth-hint + .govuk-error-message', 'Date of birth must include a month and year');

cy.get('#f-date-of-birth-month').type('2');
cy.get('#f-date-of-birth-year').type('2222');
cy.contains('button', 'Save and continue').click();
cy.contains('#date-of-birth-hint + .govuk-error-message', 'Date of birth must be in the past');

cy.get('#f-date-of-birth-month').type('2');
cy.get('#f-date-of-birth-year').clear().type('1990');
cy.contains('button', 'Save and continue').click();
cy.contains('#date-of-birth-hint + .govuk-error-message', 'Date of birth must be a real date');
});

it('permanently warns when date of birth is under 18', () => {
cy.get('#f-date-of-birth').type('1');
cy.get('#f-date-of-birth-month').type('2');
cy.get('#f-date-of-birth-year').type(new Date().getFullYear() - 1);
cy.contains('button', 'Save and continue').click();
cy.url().should('contain', '/your-date-of-birth');

cy.contains('You are under 18. By continuing, you understand that you must be at least 18 years old on the date you sign the LPA, or it will be rejected.');

cy.contains('button', 'Save and continue').click();
cy.url().should('contain', '/your-address');

cy.visitLpa("/your-date-of-birth")
cy.url().should('contain', '/your-date-of-birth');

cy.contains('You are under 18. By continuing, you understand that you must be at least 18 years old on the date you sign the LPA, or it will be rejected.');
});

it('warns when date of birth is over 100', () => {
cy.get('#f-date-of-birth').type('1');
cy.get('#f-date-of-birth-month').type('2');
cy.get('#f-date-of-birth-year').type('1900');
cy.contains('button', 'Save and continue').click();
cy.url().should('contain', '/your-date-of-birth');

cy.contains('By continuing, you confirm that this person is more than 100 years old. If not, please change their date of birth.');

cy.contains('button', 'Save and continue').click();
cy.url().should('contain', '/your-address');
});
});

describe('after completing', () => {
beforeEach(() => {
cy.visit('/fixtures?redirect=/your-date-of-birth&progress=chooseYourAttorneys');
});

it('shows task list button', () => {
cy.contains('a', 'Return to task list');
cy.contains('button', 'Save and continue').click();
cy.url().should('contain', '/your-details');
});
});
});
114 changes: 0 additions & 114 deletions cypress/e2e/donor/your-details.cy.js

This file was deleted.

Loading

0 comments on commit 04a6bfd

Please sign in to comment.