Skip to content

Commit

Permalink
Update integration and e2e tests
Browse files Browse the repository at this point in the history
  • Loading branch information
libuk committed Nov 13, 2023
1 parent 6b6441a commit 6e1f5c3
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 1 deletion.
7 changes: 6 additions & 1 deletion cypress_shared/helpers/apply.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ import {
NeedsPage,
OffendingSummaryPage,
OtherAccommodationOptionsPage,
PopPhoneNumberPage,
PractitionerPduPage,
PreviousStaysDetailsPage,
PreviousStaysPage,
Expand Down Expand Up @@ -377,7 +378,11 @@ export default class ApplyHelper {
practitionerPduPage.completeForm()
practitionerPduPage.clickSubmit()

this.pages.contactDetails = [probationPractitionerPage, backupContactPage, practitionerPduPage]
const popPhoneNumberPage = new PopPhoneNumberPage(this.application)
popPhoneNumberPage.completeForm()
popPhoneNumberPage.clickSubmit()

this.pages.contactDetails = [probationPractitionerPage, backupContactPage, practitionerPduPage, popPhoneNumberPage]

// Then I should be redirected to the task list
const tasklistPage = Page.verifyOnPage(TaskListPage, this.application)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { TemporaryAccommodationApplication as Application } from '@approved-premises/api'
import paths from '../../../../../server/paths/apply'

import ApplyPage from '../../applyPage'
import { personName } from '../../../../../server/utils/personUtils'

export default class PopPhoneNumber extends ApplyPage {
constructor(application: Application) {
super(
`What is ${personName(application.person)}'s phone number?`,
application,
'contact-details',
'pop-phone-number',
paths.applications.pages.show({ id: application.id, task: 'contact-details', page: 'practitioner-pdu' }),
)
}

completeForm() {
this.completeTextInputFromPageBody('phone')
}
}
2 changes: 2 additions & 0 deletions cypress_shared/pages/apply/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import ConsentGivenPage from './accommodation-need/consent/consentGiven'
import BackupContactPage from './accommodation-need/contact-details/backupContact'
import PopPhoneNumberPage from './accommodation-need/contact-details/popPhoneNumber'
import PractitionerPduPage from './accommodation-need/contact-details/practitionerPdu'
import ProbationPractitionerPage from './accommodation-need/contact-details/probationPractitioner'
import AccommodationRequiredFromDatePage from './accommodation-need/eligibility/accommodationRequiredFromDate'
Expand Down Expand Up @@ -73,6 +74,7 @@ export {
NeedsPage,
OffendingSummaryPage,
OtherAccommodationOptionsPage,
PopPhoneNumberPage,
PractitionerPduPage,
PreviousStaysDetailsPage,
PreviousStaysPage,
Expand Down

0 comments on commit 6e1f5c3

Please sign in to comment.