generated from hmcts/expressjs-template
-
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 #1571 from hmcts/ADOP-2404
ADOP-2402: add accessibility scan, samsung device and improve report to e2e test
- Loading branch information
Showing
5 changed files
with
132 additions
and
133 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,21 @@ | ||
import AxeBuilder from '@axe-core/playwright'; | ||
import { faker } from '@faker-js/faker'; | ||
import { test } from '@playwright/test'; | ||
import { test as base } from '@playwright/test'; | ||
import * as dotenv from 'dotenv'; | ||
|
||
import { runAccessibilityScan } from '../helpers/accessibilityHelper'; | ||
import { setupUser, teardownUser } from '../hooks/createDeleteUser.hook'; | ||
import App from '../pages/app.page'; | ||
|
||
dotenv.config(); | ||
|
||
test.describe('e2e submit journeys', { tag: '@submit' }, () => { | ||
const test = base.extend<{ makeAxeBuilder: () => AxeBuilder }>({ | ||
makeAxeBuilder: async ({ page }, use) => { | ||
await use(() => new AxeBuilder({ page })); | ||
}, | ||
}); | ||
|
||
test.describe('e2e submit journeys', () => { | ||
let userEmail: string; | ||
let userPassword: string; | ||
let userId: string; | ||
|
@@ -25,101 +33,107 @@ test.describe('e2e submit journeys', { tag: '@submit' }, () => { | |
await teardownUser(userId); | ||
}); | ||
|
||
test('submitting application with spouse or civil partner', async ({ page }) => { | ||
const app = new App(page); | ||
|
||
const appOneFirstName = faker.person.firstName(); | ||
const appOneLastName = faker.person.lastName(); | ||
const appTwoFirstName = faker.person.firstName(); | ||
const appTwoLastName = faker.person.lastName(); | ||
const appOneFullname = appOneFirstName + ' ' + appOneLastName; | ||
const appTwoFullname = appTwoFirstName + ' ' + appTwoLastName; | ||
const childFirstName = faker.person.firstName(); | ||
const childLastName = faker.person.lastName(); | ||
await app.signIn.signIn(userEmail, userPassword); | ||
await app.numberOfApplicants.applyWithSpouseOrCivil(); | ||
await app.basePage.clickSaveAndContinue(); | ||
|
||
// Date child moved in with you | ||
await app.tasklist.dateChildMovedIn.click(); | ||
await app.dateChildMoved.dateChildMovedInToday(); | ||
await app.basePage.clickSaveAndContinue(); | ||
|
||
// Child's details before adoption | ||
await app.tasklist.childsDetails.click(); | ||
await app.basePage.fillFirstLastName(appOneFirstName, appOneLastName); | ||
await app.basePage.clickSaveAndContinue(); | ||
|
||
// Child's details after adoption | ||
await app.basePage.fillFirstLastName(childFirstName, childLastName); | ||
await app.basePage.clickSaveAndContinue(); | ||
await app.childDetails.childsDob(); | ||
await app.basePage.clickSaveAndContinue(); | ||
|
||
await app.tasklist.adoptionAgency.click(); | ||
await app.adoptionAgency.childsChildSocialWorkerDetails('Sandwell Metropolitan Council'); | ||
await app.basePage.saveAndContinue.click(); | ||
await app.adoptionAgency.childsYourSocialWorkerDetails('Sandwell Metropolitan Council'); | ||
await app.basePage.saveAndContinue.click(); | ||
await app.adoptionAgency.anotherAdoptionAgencyNo(); | ||
await app.basePage.saveAndContinue.click(); | ||
|
||
// The family court details | ||
await app.tasklist.familyCourtDetails.click(); | ||
await app.basePage.selectLocation('Leicester County Court'); | ||
await app.basePage.clickSaveAndContinue(); | ||
await app.familyCourt.sameCourtYes(); | ||
await app.basePage.clickSaveAndContinue(); | ||
|
||
// First applicant Your personal details | ||
await app.tasklist.firstApplicantPersonalDetails.click(); | ||
await app.basePage.clickSaveAndContinue(); | ||
await app.addApplicants.otherNamesSelectNo(); | ||
await app.basePage.clickSaveAndContinue(); | ||
await app.addApplicants.dob(); | ||
await app.basePage.clickSaveAndContinue(); | ||
await app.addApplicants.addOccupationFirst(); | ||
await app.basePage.clickSaveAndContinue(); | ||
await app.extraSupport.noSupportNeeded(); | ||
await app.basePage.clickSaveAndContinue(); | ||
|
||
// First applicant Your contact details | ||
await app.tasklist.firstApplicantContactDetails.click(); | ||
await app.basePage.postcodeFindAddress('BN26 6AL', '0'); | ||
await app.basePage.clickSaveAndContinue(); | ||
await app.contactDetails.fillContactDetails('[email protected]', '0800800800'); | ||
await app.basePage.clickSaveAndContinue(); | ||
await app.contactDetails.englishLang.check(); | ||
await app.basePage.clickSaveAndContinue(); | ||
|
||
//Second applicant personal details | ||
await app.tasklist.secondApplicantPersonalDetails.click(); | ||
await app.basePage.fillFirstLastName(appTwoFirstName, appTwoLastName); | ||
await app.basePage.clickSaveAndContinue(); | ||
await app.addApplicants.otherNamesNo.check(); | ||
await app.basePage.clickSaveAndContinue(); | ||
await app.addApplicants.dob(); | ||
await app.basePage.clickSaveAndContinue(); | ||
await app.addApplicants.addOccupationSecond(); | ||
await app.basePage.clickSaveAndContinue(); | ||
await app.extraSupport.noSupportNeeded(); | ||
await app.basePage.clickSaveAndContinue(); | ||
|
||
//Second applicant contact details | ||
await app.tasklist.secondApplicantContactDetails.click(); | ||
await app.page.getByLabel('Yes').check(); //do you live at the same address? | ||
await app.basePage.clickSaveAndContinue(); | ||
await app.contactDetails.fillContactDetails('[email protected]', '0800800800'); | ||
await app.basePage.clickSaveAndContinue(); | ||
await app.contactDetails.englishLang.check(); | ||
await app.basePage.clickSaveAndContinue(); | ||
|
||
//submit | ||
await app.tasklist.reviewAndSubmit.click(); | ||
await app.pcq.noPcqAnswers(); | ||
await app.reviewSubmit.reviewAnswers(); | ||
await app.basePage.clickSaveAndContinue(); | ||
await app.reviewSubmit.statementOfTruth(appOneFullname, appTwoFullname); | ||
await app.reviewSubmit.fillCardDetails(appOneFullname, '[email protected]'); | ||
}); | ||
const e2eTestTags = { tag: ['@e2e', '@citizen', '@accessibility'] }; | ||
|
||
test( | ||
'submitting application with spouse or civil partner', | ||
e2eTestTags, | ||
async ({ page, makeAxeBuilder }, testInfo) => { | ||
const app = new App(page); | ||
const appOneFirstName = faker.person.firstName(); | ||
const appOneLastName = faker.person.lastName(); | ||
const appTwoFirstName = faker.person.firstName(); | ||
const appTwoLastName = faker.person.lastName(); | ||
const appOneFullname = appOneFirstName + ' ' + appOneLastName; | ||
const appTwoFullname = appTwoFirstName + ' ' + appTwoLastName; | ||
const childFirstName = faker.person.firstName(); | ||
const childLastName = faker.person.lastName(); | ||
await app.signIn.signIn(userEmail, userPassword); | ||
await app.numberOfApplicants.applyWithSpouseOrCivil(); | ||
await app.basePage.clickSaveAndContinue(); | ||
|
||
// Date child moved in with you | ||
await app.tasklist.dateChildMovedIn.click(); | ||
await app.dateChildMoved.dateChildMovedInToday(); | ||
await app.basePage.clickSaveAndContinue(); | ||
|
||
// Child's details before adoption | ||
await app.tasklist.childsDetails.click(); | ||
await app.basePage.fillFirstLastName(appOneFirstName, appOneLastName); | ||
await app.basePage.clickSaveAndContinue(); | ||
|
||
// Child's details after adoption | ||
await app.basePage.fillFirstLastName(childFirstName, childLastName); | ||
await app.basePage.clickSaveAndContinue(); | ||
await app.childDetails.childsDob(); | ||
await app.basePage.clickSaveAndContinue(); | ||
|
||
await app.tasklist.adoptionAgency.click(); | ||
await app.adoptionAgency.childsChildSocialWorkerDetails('Sandwell Metropolitan Council'); | ||
await app.basePage.saveAndContinue.click(); | ||
await app.adoptionAgency.childsYourSocialWorkerDetails('Sandwell Metropolitan Council'); | ||
await app.basePage.saveAndContinue.click(); | ||
await app.adoptionAgency.anotherAdoptionAgencyNo(); | ||
await app.basePage.saveAndContinue.click(); | ||
|
||
// The family court details | ||
await app.tasklist.familyCourtDetails.click(); | ||
await app.basePage.selectLocation('Leicester County Court'); | ||
await app.basePage.clickSaveAndContinue(); | ||
await app.familyCourt.sameCourtYes(); | ||
await app.basePage.clickSaveAndContinue(); | ||
|
||
// First applicant Your personal details | ||
await app.tasklist.firstApplicantPersonalDetails.click(); | ||
await app.basePage.clickSaveAndContinue(); | ||
await app.addApplicants.otherNamesSelectNo(); | ||
await app.basePage.clickSaveAndContinue(); | ||
await app.addApplicants.dob(); | ||
await app.basePage.clickSaveAndContinue(); | ||
await app.addApplicants.addOccupationFirst(); | ||
await app.basePage.clickSaveAndContinue(); | ||
await app.extraSupport.noSupportNeeded(); | ||
await app.basePage.clickSaveAndContinue(); | ||
|
||
// First applicant Your contact details | ||
await app.tasklist.firstApplicantContactDetails.click(); | ||
await app.basePage.postcodeFindAddress('BN26 6AL', '0'); | ||
await app.basePage.clickSaveAndContinue(); | ||
await app.contactDetails.fillContactDetails('[email protected]', '0800800800'); | ||
await app.basePage.clickSaveAndContinue(); | ||
await app.contactDetails.englishLang.check(); | ||
await app.basePage.clickSaveAndContinue(); | ||
|
||
//Second applicant personal details | ||
await app.tasklist.secondApplicantPersonalDetails.click(); | ||
await app.basePage.fillFirstLastName(appTwoFirstName, appTwoLastName); | ||
await app.basePage.clickSaveAndContinue(); | ||
await app.addApplicants.otherNamesNo.check(); | ||
await app.basePage.clickSaveAndContinue(); | ||
await app.addApplicants.dob(); | ||
await app.basePage.clickSaveAndContinue(); | ||
await app.addApplicants.addOccupationSecond(); | ||
await app.basePage.clickSaveAndContinue(); | ||
await app.extraSupport.noSupportNeeded(); | ||
await app.basePage.clickSaveAndContinue(); | ||
|
||
//Second applicant contact details | ||
await app.tasklist.secondApplicantContactDetails.click(); | ||
await app.page.getByLabel('Yes').check(); //do you live at the same address? | ||
await app.basePage.clickSaveAndContinue(); | ||
await app.contactDetails.fillContactDetails('[email protected]', '0800800800'); | ||
await app.basePage.clickSaveAndContinue(); | ||
await app.contactDetails.englishLang.check(); | ||
await app.basePage.clickSaveAndContinue(); | ||
|
||
//submit | ||
await app.tasklist.reviewAndSubmit.click(); | ||
await app.pcq.noPcqAnswers(); | ||
await app.reviewSubmit.reviewAnswers(); | ||
await app.basePage.clickSaveAndContinue(); | ||
await app.reviewSubmit.statementOfTruth(appOneFullname, appTwoFullname); | ||
await app.reviewSubmit.fillCardDetails(appOneFullname, '[email protected]'); | ||
await runAccessibilityScan(makeAxeBuilder, testInfo); | ||
} | ||
); | ||
}); |
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