Skip to content

Commit

Permalink
MLPAB-2228 Make back and return to task list consistent for your deta…
Browse files Browse the repository at this point in the history
…ils task (#1380)
  • Loading branch information
hawx authored Jul 30, 2024
1 parent e037fd5 commit cfbc489
Show file tree
Hide file tree
Showing 31 changed files with 369 additions and 358 deletions.
108 changes: 54 additions & 54 deletions cypress/e2e/certificate-provider/confirm-your-details.cy.js
Original file line number Diff line number Diff line change
@@ -1,82 +1,82 @@
describe('Confirm your details', () => {
describe('shows details for', () => {
it('lay certificate providers', () => {
cy.visit('/fixtures/certificate-provider?redirect=/enter-date-of-birth');
describe('shows details for', () => {
it('lay certificate providers', () => {
cy.visit('/fixtures/certificate-provider?redirect=/enter-date-of-birth');

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-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.contains('button', 'Save and continue').click();

cy.url().should('contain', '/your-preferred-language');
cy.checkA11yApp();
cy.url().should('contain', '/your-preferred-language');
cy.checkA11yApp();

cy.get('[name="language-preference"]').check('cy', { force: true })
cy.get('[name="language-preference"]').check('cy', { force: true })

cy.contains('button', 'Save and continue').click()
cy.contains('button', 'Save and continue').click()

cy.url().should('contain', '/confirm-your-details');
cy.checkA11yApp();
cy.url().should('contain', '/confirm-your-details');
cy.checkA11yApp();

cy.contains('1 February 1990');
cy.contains('Charlie Cooper');
cy.contains('dt', 'Address').parent().contains('5 RICHMOND PLACE')
cy.contains('07700 900 000');
cy.contains('1 February 1990');
cy.contains('Charlie Cooper');
cy.contains('dt', 'Address').parent().contains('5 RICHMOND PLACE')
cy.contains('07700 900 000');

cy.contains('button', 'Continue').click();
cy.url().should('contain', '/your-role');
});
cy.contains('button', 'Continue').click();
cy.url().should('contain', '/your-role');
});

it('professional certificate providers', () => {
cy.visit('/fixtures/certificate-provider?redirect=/enter-date-of-birth&relationship=professional');
it('professional certificate providers', () => {
cy.visit('/fixtures/certificate-provider?redirect=/enter-date-of-birth&relationship=professional');

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-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.contains('button', 'Save and continue').click();

cy.url().should('contain', '/what-is-your-home-address');
cy.checkA11yApp();
cy.url().should('contain', '/what-is-your-home-address');
cy.checkA11yApp();

cy.contains('a', 'Enter address manually').click()
cy.contains('a', 'Enter address manually').click()

cy.url().should('contain', '/what-is-your-home-address');
cy.checkA11yApp();
cy.url().should('contain', '/what-is-your-home-address');
cy.checkA11yApp();

cy.get('#f-address-line-1').type('6 RICHMOND PLACE');
cy.get('#f-address-town').type('Birmingham');
cy.get('#f-address-postcode').type('B14 7ED');
cy.get('#f-address-line-1').type('6 RICHMOND PLACE');
cy.get('#f-address-town').type('Birmingham');
cy.get('#f-address-postcode').type('B14 7ED');

cy.contains('button', 'Continue').click();
cy.contains('button', 'Save and continue').click();

cy.url().should('contain', '/your-preferred-language');
cy.url().should('contain', '/your-preferred-language');

cy.get('[name="language-preference"]').check('cy', { force: true })
cy.get('[name="language-preference"]').check('cy', { force: true })

cy.contains('button', 'Save and continue').click()
cy.contains('button', 'Save and continue').click()

cy.url().should('contain', '/confirm-your-details');
cy.checkA11yApp();
cy.url().should('contain', '/confirm-your-details');
cy.checkA11yApp();

cy.contains('1 February 1990');
cy.contains('dt', 'Home address').parent().contains('6 RICHMOND PLACE')
cy.contains('1 February 1990');
cy.contains('dt', 'Home address').parent().contains('6 RICHMOND PLACE')

cy.contains('dt', 'Work address').parent().contains('5 RICHMOND PLACE')
cy.contains('Charlie Cooper');
cy.contains('5 RICHMOND PLACE');
cy.contains('07700 900 000');
cy.contains('dt', 'Work address').parent().contains('5 RICHMOND PLACE')
cy.contains('Charlie Cooper');
cy.contains('5 RICHMOND PLACE');
cy.contains('07700 900 000');

cy.contains('button', 'Continue').click();
cy.url().should('contain', '/your-role');
});
cy.contains('button', 'Continue').click();
cy.url().should('contain', '/your-role');
});

it('shows contact number when donor acting on paper', () => {
cy.visit('/fixtures/certificate-provider?redirect=/confirm-your-details&donorChannel=paper');
it('shows contact number when donor acting on paper', () => {
cy.visit('/fixtures/certificate-provider?redirect=/confirm-your-details&donorChannel=paper');

cy.contains('Contact number').should('exist');
cy.contains('Mobile number').should('not.exist');
cy.contains('Contact number').should('exist');
cy.contains('Mobile number').should('not.exist');
})
})
})
});
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {AddressFormAssertions} from "../../support/e2e";
import { AddressFormAssertions } from "../../support/e2e";

describe('What is your home address', () => {
beforeEach(() => {
Expand Down
4 changes: 2 additions & 2 deletions cypress/e2e/donor/choose-attorneys-summary.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ describe('Choose attorneys summary', () => {
cy.url().should('match', /id=\w*/);

cy.get('#f-address-line-1').clear().type('1 RICHMOND PLACE');
cy.contains('button', 'Continue').click();
cy.contains('button', 'Save and continue').click();

cy.url().should('contain', '/choose-attorneys-summary');

Expand Down Expand Up @@ -94,7 +94,7 @@ describe('Choose attorneys summary', () => {

cy.url().should('contain', '/choose-attorneys-address');
cy.get('#f-address-line-1').should('have.value', '5 RICHMOND PLACE');
cy.contains('button', 'Continue').click();
cy.contains('button', 'Save and continue').click();

cy.url().should('contain', '/choose-attorneys-summary');

Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/donor/choose-attorneys-task.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ describe('Choose attorneys task', () => {
cy.contains('button', 'Find address').click();
cy.get('#f-select-address').select('2 RICHMOND PLACE, BIRMINGHAM, B14 7ED');
cy.contains('button', 'Continue').click();
cy.contains('button', 'Continue').click();
cy.contains('button', 'Save and continue').click();

cy.visitLpa('/task-list');
cy.contains('a', 'Choose your attorneys').parent().parent().contains('1 added');
Expand Down
4 changes: 2 additions & 2 deletions cypress/e2e/donor/choose-replacement-attorneys-summary.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ describe('Choose replacement attorneys summary', () => {
.click();

cy.get('#f-address-line-1').clear().type('4 RICHMOND PLACE');
cy.contains('button', 'Continue').click();
cy.contains('button', 'Save and continue').click();

cy.url().should('contain', '/choose-replacement-attorneys-summary');
cy.contains('dd', '4 RICHMOND PLACE');
Expand Down Expand Up @@ -80,7 +80,7 @@ describe('Choose replacement attorneys summary', () => {

cy.url().should('contain', '/choose-replacement-attorneys-address');
cy.get('#f-address-line-1').should('have.value', '5 RICHMOND PLACE');
cy.contains('button', 'Continue').click();
cy.contains('button', 'Save and continue').click();

cy.url().should('contain', '/choose-replacement-attorneys-summary');

Expand Down
4 changes: 2 additions & 2 deletions cypress/e2e/donor/lpa-type.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ describe('LPA type', () => {

cy.checkA11yApp();

cy.contains('button', 'Continue').click();
cy.contains('button', 'Save and continue').click();
cy.url().should('contain', '/task-list');

cy.url().then((url) => {
Expand All @@ -30,7 +30,7 @@ describe('LPA type', () => {
it('errors when unselected', () => {
cy.visit('/fixtures?redirect=/lpa-type');

cy.contains('button', 'Continue').click();
cy.contains('button', 'Save and continue').click();

cy.get('.govuk-error-summary').within(() => {
cy.contains('Select the type of LPA to make');
Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/donor/make-a-new-lpa.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ describe('Make a new LPA', () => {
cy.get('#f-address-line-3').should('have.value', 'WEST MIDLANDS').clear()
cy.get('#f-address-town').should('have.value', 'BIRMINGHAM');
cy.get('#f-address-postcode').should('have.value', 'B14 7ED');
cy.contains("button", "Continue").click();
cy.contains("button", "Save and continue").click();

cy.url().should('contain', '/we-have-updated-your-details');
cy.checkA11yApp();
Expand Down
4 changes: 2 additions & 2 deletions cypress/e2e/donor/people-to-notify.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ describe('People to notify', () => {
cy.get('#f-address-town').type("BIRMINGHAM");
cy.get('#f-address-postcode').type("B14 7ED");

cy.contains('button', 'Continue').click();
cy.contains('button', 'Save and continue').click();

cy.url().should('contain', '/choose-people-to-notify-summary');

Expand Down Expand Up @@ -91,7 +91,7 @@ describe('People to notify', () => {
cy.get('#f-address-town').clear().type('Newshire');
cy.get('#f-address-postcode').clear().type('A12 3BC');

cy.contains('button', 'Continue').click();
cy.contains('button', 'Save and continue').click();

cy.url().should('contain', '/choose-people-to-notify-summary');

Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/donor/provide-your-details.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ describe('Provide your details', () => {
cy.contains('a', 'Continue').click();

cy.get('#f-lpa-type').check('property-and-affairs', { force: true });
cy.contains('button', 'Continue').click();
cy.contains('button', 'Save and continue').click();

cy.url()
.then(url => {
Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/donor/your-date-of-birth.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ describe('Your date of birth', () => {
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');
cy.url().should('contain', '/your-address');
});
});
});
2 changes: 1 addition & 1 deletion cypress/e2e/donor/your-name.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ describe('Your name', () => {
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');
cy.url().should('contain', '/your-date-of-birth');
});

it('warns when name shared with other actor', () => {
Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/supporter/dashboard.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ describe('Dashboard', () => {

cy.contains('a', 'Continue').click()
cy.get('#f-lpa-type').check('property-and-affairs');
cy.contains('button', 'Continue').click();
cy.contains('button', 'Save and continue').click();
cy.contains('You are drafting John Doe’s property and affairs LPA').should('not.exist');

cy.contains('li', 'Provide your details').click();
Expand Down
14 changes: 7 additions & 7 deletions cypress/support/e2e.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export function randomShareCode() {
const characters = 'abcdefghijklmnpqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ123456789'
let result = [];

for(let i = 0; i < 12; i++) {
for (let i = 0; i < 12; i++) {
result.push(characters.charAt(Math.floor(Math.random() * characters.length)));
}

Expand Down Expand Up @@ -42,7 +42,7 @@ export const AddressFormAssertions = {
cy.get('#f-address-town').type('Someville');
cy.get('#f-address-postcode').type('NG1');

cy.contains('button', 'Continue').click();
cy.contains('button', 'Save and continue').click();
},

assertCanAddAddressFromSelect() {
Expand All @@ -63,7 +63,7 @@ export const AddressFormAssertions = {
cy.get('#f-address-line-3').should('have.value', '');
cy.get('#f-address-town').should('have.value', 'BIRMINGHAM');
cy.get('#f-address-postcode').should('have.value', 'B14 7ED');
cy.contains('button', 'Continue').click();
cy.contains('button', 'Save and continue').click();
},

assertErrorsWhenPostcodeEmpty() {
Expand Down Expand Up @@ -116,7 +116,7 @@ export const AddressFormAssertions = {
cy.get('#f-lookup-postcode').type('NG1');
cy.contains('button', 'Find address').click();
cy.contains('a', manualAddressLinkText).click();
cy.contains('button', 'Continue').click();
cy.contains('button', 'Save and continue').click();

cy.get('.govuk-error-summary').within(() => {
cy.contains('Enter address line 1');
Expand All @@ -131,7 +131,7 @@ export const AddressFormAssertions = {
cy.get('#f-address-line-1').invoke('val', 'a'.repeat(51));
cy.get('#f-address-line-2').invoke('val', 'b'.repeat(51));
cy.get('#f-address-line-3').invoke('val', 'c'.repeat(51));
cy.contains('button', 'Continue').click();
cy.contains('button', 'Save and continue').click();

cy.contains('[for=f-address-line-1] + .govuk-error-message', 'Address line 1 must be 50 characters or less');
cy.contains('[for=f-address-line-2] + .govuk-error-message', 'Address line 2 must be 50 characters or less');
Expand All @@ -142,7 +142,7 @@ export const AddressFormAssertions = {
cy.get('#f-lookup-postcode').type('NG1');
cy.contains('button', 'Find address').click();
cy.contains('a', manualAddressLinkText).click();
cy.contains('button', 'Continue').click();
cy.contains('button', 'Save and continue').click();

cy.get('.govuk-error-summary').within(() => {
cy.contains('Enter line 1 of your address');
Expand All @@ -157,7 +157,7 @@ export const AddressFormAssertions = {
cy.get('#f-address-line-1').invoke('val', 'a'.repeat(51));
cy.get('#f-address-line-2').invoke('val', 'b'.repeat(51));
cy.get('#f-address-line-3').invoke('val', 'c'.repeat(51));
cy.contains('button', 'Continue').click();
cy.contains('button', 'Save and continue').click();

cy.contains('[for=f-address-line-1] + .govuk-error-message', 'Line 1 of your address must be 50 characters or less');
cy.contains('[for=f-address-line-2] + .govuk-error-message', 'Line 2 of your address must be 50 characters or less');
Expand Down
4 changes: 2 additions & 2 deletions internal/donor/donorpage/can_you_sign_your_lpa.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ func CanYouSignYourLpa(tmpl template.Template, donorStore DonorStore) Handler {
}

if r.Method == http.MethodPost {
data.Form = readYourDetailsForm(r)
data.Form = readCanYouSignYourLpaForm(r)
data.Errors = data.Form.Validate()

if data.Errors.None() {
Expand Down Expand Up @@ -62,7 +62,7 @@ type canYouSignYourLpaForm struct {
CanSignError error
}

func readYourDetailsForm(r *http.Request) *canYouSignYourLpaForm {
func readCanYouSignYourLpaForm(r *http.Request) *canYouSignYourLpaForm {
canSign, canSignError := donordata.ParseYesNoMaybe(page.PostFormString(r, "can-sign"))

return &canYouSignYourLpaForm{
Expand Down
6 changes: 3 additions & 3 deletions internal/donor/donorpage/can_you_sign_your_lpa_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,21 +156,21 @@ func TestPostCanYouSignYourLpaWhenStoreErrors(t *testing.T) {
assert.Equal(t, expectedError, err)
}

func TestReadYourDetailsForm(t *testing.T) {
func TestReadCanYouSignYourLpaForm(t *testing.T) {
f := url.Values{
"can-sign": {actor.Yes.String()},
}

r, _ := http.NewRequest(http.MethodPost, "/", strings.NewReader(f.Encode()))
r.Header.Add("Content-Type", page.FormUrlEncoded)

result := readYourDetailsForm(r)
result := readCanYouSignYourLpaForm(r)

assert.Equal(t, actor.Yes, result.CanSign)
assert.Nil(t, result.CanSignError)
}

func TestYourDetailsFormValidate(t *testing.T) {
func TestCanYouSignYourLpaFormValidate(t *testing.T) {
testCases := map[string]struct {
form *canYouSignYourLpaForm
errors validation.List
Expand Down
1 change: 1 addition & 0 deletions internal/donor/donorpage/choose_address.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ type chooseAddressData struct {
Form *form.AddressForm
TitleKeys titleKeys
MakingAnotherLPA bool
CanTaskList bool
}

type titleKeys struct {
Expand Down
Loading

0 comments on commit cfbc489

Please sign in to comment.