generated from ministryofjustice/hmpps-template-typescript
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #104 from ministryofjustice/CBA-205-funding-cas2-a…
…ccommodation-page Update funding and ID pages
- Loading branch information
Showing
31 changed files
with
853 additions
and
381 deletions.
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) | ||
}) | ||
|
||
// 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.