Skip to content

Commit

Permalink
Merge c6dbdd0 into 142c731
Browse files Browse the repository at this point in the history
  • Loading branch information
hawx authored May 14, 2024
2 parents 142c731 + c6dbdd0 commit 08ef70f
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 55 deletions.
23 changes: 2 additions & 21 deletions cypress/e2e/donor/choose-attorneys-task.cy.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { AddressFormAssertions, TestEmail } from "../../support/e2e";

describe.skip('Choose attorneys task', () => {
describe('Choose attorneys task', () => {
it('is not started when no attorneys are set', () => {
cy.visit('/fixtures?redirect=/task-list');

Expand All @@ -12,25 +12,6 @@ describe.skip('Choose attorneys task', () => {
cy.contains('a', 'Choose your attorneys').click();
cy.contains('a', 'Continue').click();

cy.get('#f-first-names').type('John');
cy.get('#f-last-name').type('Doe');
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.visitLpa('/task-list');
cy.contains('a', 'Choose your attorneys').parent().parent().within(() => {
cy.contains('In progress');
cy.contains('1 added');
});
});

it('is completed if enter an attorneys details', () => {
cy.visit('/fixtures?redirect=/task-list');
cy.contains('a', 'Choose your attorneys').click();
cy.contains('a', 'Continue').click();

cy.get('#f-first-names').type('John');
cy.get('#f-last-name').type('Doe');
cy.get('#f-email').type(TestEmail);
Expand All @@ -41,7 +22,7 @@ describe.skip('Choose attorneys task', () => {

cy.visitLpa('/task-list');
cy.contains('a', 'Choose your attorneys').parent().parent().within(() => {
cy.contains('Completed');
cy.contains('In progress');
cy.contains('1 added');
});
});
Expand Down
36 changes: 6 additions & 30 deletions cypress/e2e/donor/choose-replacement-attorneys-task.cy.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { AddressFormAssertions, TestEmail } from "../../support/e2e";

describe.skip('Choose replacement attorneys task', () => {
describe('Choose replacement attorneys task', () => {
it('is not started when no replacement attorneys are set', () => {
cy.visit('/fixtures?redirect=/task-list&progress=chooseYourAttorneys');

Expand Down Expand Up @@ -44,6 +44,10 @@ describe.skip('Choose replacement attorneys task', () => {
cy.get('#f-date-of-birth-year').type('1990');
cy.contains('button', 'Save and continue').click();

cy.contains('label', 'Enter a new address').click();
cy.contains('button', 'Continue').click();
AddressFormAssertions.assertCanAddAddressManually('Enter address manually', true)

cy.visitLpa('/task-list');
cy.contains('a', 'Choose your replacement attorneys').parent().parent().within(() => {
cy.contains('Completed');
Expand Down Expand Up @@ -471,7 +475,7 @@ describe.skip('Choose replacement attorneys task', () => {
});

describe('having jointly for some attorneys and multiple replacement attorneys', () => {
beforeEach(() => {
it('is completed', () => {
cy.visit('/fixtures?redirect=/task-list&progress=chooseYourReplacementAttorneys&attorneys=jointly-for-some-severally-for-others&replacementAttorneys=single');
cy.contains('a', 'Choose your replacement attorneys').click();

Expand All @@ -492,35 +496,7 @@ describe.skip('Choose replacement attorneys task', () => {

cy.contains('label', 'No').click();
cy.contains('button', 'Continue').click();
});

it('is completed if replacements act jointly and severally', () => {
cy.get('input[value=jointly-and-severally]').click();
cy.contains('button', 'Save and continue').click();

cy.contains('a', 'Choose your replacement attorneys').parent().parent().within(() => {
cy.contains('Completed');
cy.contains('2 added');
});
});

it('is completed if replacements act jointly', () => {
cy.get('input[value=jointly]').click();
cy.contains('button', 'Save and continue').click();

cy.visitLpa('/task-list');
cy.contains('a', 'Choose your replacement attorneys').parent().parent().within(() => {
cy.contains('Completed');
cy.contains('2 added');
});
});

it('is completed if replacements act mixed', () => {
cy.get('input[value=jointly-for-some-severally-for-others]').click();
cy.get('textarea').type('Some details');
cy.contains('button', 'Save and continue').click();

cy.visitLpa('/task-list');
cy.contains('a', 'Choose your replacement attorneys').parent().parent().within(() => {
cy.contains('Completed');
cy.contains('2 added');
Expand Down
2 changes: 1 addition & 1 deletion internal/page/data.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ func ChooseReplacementAttorneysState(donor *actor.DonorProvidedDetails) actor.Ta
}

if donor.ReplacementAttorneys.Len() > 1 &&
(donor.Attorneys.Len() == 1 || donor.AttorneyDecisions.How.IsJointly() || donor.AttorneyDecisions.How.IsJointlyForSomeSeverallyForOthers()) &&
(donor.Attorneys.Len() == 1 || donor.AttorneyDecisions.How.IsJointly()) &&
!donor.ReplacementAttorneyDecisions.IsComplete() {
return actor.TaskInProgress
}
Expand Down
13 changes: 12 additions & 1 deletion internal/page/data_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,18 @@ func TestChooseReplacementAttorneysState(t *testing.T) {
attorneyDecisions: actor.AttorneyDecisions{How: actor.JointlyForSomeSeverallyForOthers},
taskState: actor.TaskCompleted,
},

"jointly for some severally for others attorneys multiple": {
want: form.Yes,
replacementAttorneys: actor.Attorneys{Attorneys: []actor.Attorney{{
FirstNames: "a",
Address: testAddress,
}, {
FirstNames: "b",
Address: testAddress,
}}},
attorneyDecisions: actor.AttorneyDecisions{How: actor.JointlyForSomeSeverallyForOthers},
taskState: actor.TaskCompleted,
},
"jointly and severally attorneys multiple": {
want: form.Yes,
replacementAttorneys: actor.Attorneys{Attorneys: []actor.Attorney{{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ func ChooseReplacementAttorneysSummary(tmpl template.Template) Handler {
if data.Errors.None() {
if data.Form.YesNo == form.Yes {
return page.Paths.ChooseReplacementAttorneys.RedirectQuery(w, r, appData, donor, url.Values{"addAnother": {"1"}})
} else if donor.ReplacementAttorneys.Len() > 1 && (donor.Attorneys.Len() == 1 || donor.AttorneyDecisions.How.IsJointlyForSomeSeverallyForOthers() || donor.AttorneyDecisions.How.IsJointly()) {
} else if donor.ReplacementAttorneys.Len() > 1 && (donor.Attorneys.Len() == 1 || donor.AttorneyDecisions.How.IsJointly()) {
return page.Paths.HowShouldReplacementAttorneysMakeDecisions.Redirect(w, r, appData, donor)
} else if donor.AttorneyDecisions.How.IsJointlyAndSeverally() {
return page.Paths.HowShouldReplacementAttorneysStepIn.Redirect(w, r, appData, donor)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ func TestPostChooseReplacementAttorneysSummaryDoNotAddAttorney(t *testing.T) {
decisionDetails: "some words",
},
"with multiple attorneys acting jointly for some decisions, and jointly and severally for other decisions and multiple replacement attorneys": {
redirectUrl: page.Paths.HowShouldReplacementAttorneysMakeDecisions,
redirectUrl: page.Paths.TaskList,
attorneys: actor.Attorneys{Attorneys: []actor.Attorney{attorney1, attorney2}},
replacementAttorneys: actor.Attorneys{Attorneys: []actor.Attorney{attorney1, attorney2}},
howAttorneysAct: actor.JointlyForSomeSeverallyForOthers,
Expand Down

0 comments on commit 08ef70f

Please sign in to comment.