generated from ministryofjustice/hmpps-template-typescript
-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update funding and ID pages #104
Merged
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
c583019
Rename FundingInformation page to FundingCas2Accommodation
2eebeb6
Rename and update funding source page
50a7084
Remove national insurance form page
58e0d24
Update identification form page
207e9c2
Update Alternative ID form page
186fe70
Rename Identification page to ApplicantId
ee045c8
Rename AlternativeID page to AlternativeApplicantID
4ce680b
Add integration tests for funding cas2 accommodation page
bdf2eca
Ensure applicant ID and alternative ID orphaned data is removed
f80cca4
Update e2e tests for funding CAS-2 accommodation page
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,3 +35,4 @@ $govuk-page-width: $moj-page-width; | |
margin-bottom: govuk-spacing(3); | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
...tion_tests/pages/apply/area-and-funding/funding-information/alternativeApplicantIdPage.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { Cas2v2Application as Application } from '../../../../../server/@types/shared/models/Cas2v2Application' | ||
import ApplyPage from '../../applyPage' | ||
import paths from '../../../../../server/paths/apply' | ||
|
||
export default class AlternativeApplicantIdPage extends ApplyPage { | ||
constructor(private readonly application: Application) { | ||
super( | ||
'What other identification document (ID) does the applicant have?', | ||
application, | ||
'funding-information', | ||
'alternative-applicant-id', | ||
) | ||
} | ||
|
||
static visit(application: Application): void { | ||
cy.visit( | ||
paths.applications.pages.show({ | ||
id: application.id, | ||
task: 'funding-information', | ||
page: 'alternative-applicant-id', | ||
}), | ||
) | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
integration_tests/pages/apply/area-and-funding/funding-information/applicantIdPage.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { Cas2v2Application as Application } from '../../../../../server/@types/shared/models/Cas2v2Application' | ||
import ApplyPage from '../../applyPage' | ||
import paths from '../../../../../server/paths/apply' | ||
|
||
export default class ApplicantIdPage extends ApplyPage { | ||
constructor(private readonly application: Application) { | ||
super(`What identity document (ID) does the applicant have?`, application, 'funding-information', 'applicant-id') | ||
} | ||
|
||
static visit(application: Application): void { | ||
cy.visit( | ||
paths.applications.pages.show({ | ||
id: application.id, | ||
task: 'funding-information', | ||
page: 'applicant-id', | ||
}), | ||
) | ||
} | ||
} |
46 changes: 46 additions & 0 deletions
46
...on_tests/pages/apply/area-and-funding/funding-information/fundingCas2AccommodationPage.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import { Cas2v2Application as Application } from '@approved-premises/api' | ||
import ApplyPage from '../../applyPage' | ||
import { FundingSources } from '../../../../../server/form-pages/apply/area-and-funding/funding-information/fundingCas2Accommodation' | ||
|
||
export default class FundingCas2AccommodationPage extends ApplyPage { | ||
constructor(private readonly application: Application) { | ||
super('Funding CAS-2 accommodation', application, 'funding-information', 'funding-cas2-accommodation') | ||
} | ||
|
||
completeWithPersonalSavings(): void { | ||
this.selectFundingSource('personalSavings') | ||
this.enterFundingSourceDetails() | ||
this.enterNationalInsuranceNumber() | ||
this.enterBenefitsDetails() | ||
this.selectInEducationOrTraining() | ||
} | ||
|
||
completeWithHousingBenefits(): void { | ||
this.selectFundingSource('benefits') | ||
this.enterNationalInsuranceNumber() | ||
this.enterBenefitsDetails() | ||
this.selectInEducationOrTraining() | ||
} | ||
|
||
private selectFundingSource(fundingSource: FundingSources): void { | ||
this.checkRadioByNameAndValue('fundingSource', fundingSource) | ||
} | ||
|
||
private enterFundingSourceDetails(): void { | ||
this.getTextInputByIdAndEnterDetails('fundingSourceDetail', 'Funding source details') | ||
} | ||
|
||
private enterNationalInsuranceNumber(): void { | ||
this.checkRadioByNameAndValue('hasNationalInsuranceNumber', 'yes') | ||
this.getTextInputByIdAndEnterDetails('nationalInsuranceNumber', 'SF123456X') | ||
} | ||
|
||
private enterBenefitsDetails(): void { | ||
this.checkRadioByNameAndValue('receivingBenefits', 'yes') | ||
this.checkRadioByNameAndValue('receivedBenefitSanctions', 'no') | ||
} | ||
|
||
private selectInEducationOrTraining(): void { | ||
this.checkRadioByNameAndValue('inEducationOrTraining', 'no') | ||
} | ||
} |
68 changes: 68 additions & 0 deletions
68
...s/apply/area-and-funding/funding-information/complete_alternative_applicant_id_page.cy.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
// Feature: Referrer completes 'alternative applicant ID' page | ||
// So that I can complete the "Funding information" task | ||
// As a referrer | ||
// I want to complete the 'alternative applicant ID' page | ||
// | ||
// Background: | ||
// Given an application exists | ||
// And I am logged in | ||
// And I visit the 'alternative applicant ID' page | ||
// | ||
// Scenario: navigate to task list page | ||
// When I select a form of ID | ||
// And I continue to the next task / page | ||
// Then I am redirected to the task list page | ||
|
||
import Page from '../../../../pages/page' | ||
import { personFactory, applicationFactory } from '../../../../../server/testutils/factories/index' | ||
import AlternativeApplicantIdPage from '../../../../pages/apply/area-and-funding/funding-information/alternativeApplicantIdPage' | ||
import TaskListPage from '../../../../pages/apply/taskListPage' | ||
|
||
context('Visit alternative applicant ID page', () => { | ||
const person = personFactory.build({ name: 'Roger Smith' }) | ||
|
||
beforeEach(function test() { | ||
cy.task('reset') | ||
cy.task('stubSignIn') | ||
cy.task('stubAuthUser') | ||
|
||
cy.fixture('applicationData.json').then(applicationData => { | ||
applicationData['funding-information'] = {} | ||
const application = applicationFactory.build({ | ||
id: 'abc123', | ||
person, | ||
data: applicationData, | ||
}) | ||
cy.wrap(application).as('application') | ||
}) | ||
}) | ||
|
||
beforeEach(function test() { | ||
// And an application exists | ||
// ------------------------- | ||
cy.task('stubApplicationGet', { application: this.application }) | ||
cy.task('stubApplicationUpdate', { application: this.application }) | ||
|
||
// Given I am logged in | ||
//--------------------- | ||
cy.signIn() | ||
|
||
// And I am on the alternative applicant ID page | ||
// -------------------------------- | ||
AlternativeApplicantIdPage.visit(this.application) | ||
}) | ||
|
||
// Scenario: navigate to task list page | ||
// ---------------------------------------- | ||
it('redirects to the task list page', function test() { | ||
// When I select a form of ID | ||
const page = Page.verifyOnPage(AlternativeApplicantIdPage, this.application) | ||
page.checkCheckboxByValue('contract') | ||
|
||
// And I continue to the next task / page | ||
page.clickSubmit() | ||
|
||
// Then I am redirected to the task list page | ||
Page.verifyOnPage(TaskListPage, this.application) | ||
}) | ||
}) |
88 changes: 88 additions & 0 deletions
88
...n_tests/tests/apply/area-and-funding/funding-information/complete_applicant_id_page.cy.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
// Feature: Referrer completes 'applicant ID' page | ||
// So that I can complete the "Funding information" task | ||
// As a referrer | ||
// I want to complete the 'applicant ID' page | ||
// | ||
// Background: | ||
// Given an application exists | ||
// And I am logged in | ||
// And I visit the 'applicant ID' page | ||
// | ||
// Scenario: navigate to alternative applicant ID page | ||
// When I select 'none' | ||
// And I continue to the next task / page | ||
// Then I am redirected to the alternative applicant ID page | ||
// | ||
// Scenario: navigate to task list page | ||
// When I select a form of ID | ||
// And I continue to the next task / page | ||
// Then I am redirected to the task list page | ||
|
||
import Page from '../../../../pages/page' | ||
import ApplicantIdPage from '../../../../pages/apply/area-and-funding/funding-information/applicantIdPage' | ||
import TaskListPage from '../../../../pages/apply/taskListPage' | ||
import { personFactory, applicationFactory } from '../../../../../server/testutils/factories/index' | ||
import AlternativeApplicantIdPage from '../../../../pages/apply/area-and-funding/funding-information/alternativeApplicantIdPage' | ||
|
||
context('Visit applicant ID page', () => { | ||
const person = personFactory.build({ name: 'Roger Smith' }) | ||
|
||
beforeEach(function test() { | ||
cy.task('reset') | ||
cy.task('stubSignIn') | ||
cy.task('stubAuthUser') | ||
|
||
cy.fixture('applicationData.json').then(applicationData => { | ||
applicationData['funding-information'] = {} | ||
const application = applicationFactory.build({ | ||
id: 'abc123', | ||
person, | ||
data: applicationData, | ||
}) | ||
cy.wrap(application).as('application') | ||
}) | ||
}) | ||
|
||
beforeEach(function test() { | ||
// And an application exists | ||
// ------------------------- | ||
cy.task('stubApplicationGet', { application: this.application }) | ||
cy.task('stubApplicationUpdate', { application: this.application }) | ||
|
||
// Given I am logged in | ||
//--------------------- | ||
cy.signIn() | ||
|
||
// And I am on the applicant ID page | ||
// -------------------------------- | ||
ApplicantIdPage.visit(this.application) | ||
}) | ||
Comment on lines
+56
to
+59
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. as above |
||
|
||
// Scenario: navigate to alternative applicant ID page | ||
// ---------------------------------------- | ||
it('redirects to the alternative applicant ID page', function test() { | ||
// When I select 'none' | ||
const page = Page.verifyOnPage(ApplicantIdPage, this.application) | ||
page.checkCheckboxByValue('none') | ||
|
||
// And I continue to the next task / page | ||
page.clickSubmit() | ||
|
||
// Then I am redirected to the alternative applicant ID page | ||
Page.verifyOnPage(AlternativeApplicantIdPage, this.application) | ||
}) | ||
|
||
// Scenario: navigate to the task list page | ||
// ---------------------------------------- | ||
it('redirects to the task list page', function test() { | ||
// When I select a form of ID | ||
const page = Page.verifyOnPage(ApplicantIdPage, this.application) | ||
page.checkCheckboxByValue('passport') | ||
|
||
// And I continue to the next task / page | ||
page.clickSubmit() | ||
|
||
// Then I am redirected to the task list page | ||
Page.verifyOnPage(TaskListPage, this.application) | ||
}) | ||
}) |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we want a
Page.verifyOnPage()
hereThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@patrickjfl Hmm, is this required if we call
verifyOnPage
in the tests that follow? Maybe the comment should read something like "And I visit the alternative applicant ID page".