Skip to content

Commit 9456924

Browse files
DFPL-2381-CTSCAdminEventsUITest (#6114)
* fixthevariablenamemismatch * DFPL-2835-Fix flaky tests in firefox * temp * WelshLangTranslationExpertReportTest * temp * temp * RecordFinalDecisionUITest * Send Order remainder * temp * Clean up code * Clean up code
1 parent faa6302 commit 9456924

File tree

11 files changed

+443
-6
lines changed

11 files changed

+443
-6
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
"test:functional-galaxyS4": " yarn playwright install chromium && yarn playwright test --project=GalaxyS4 ",
5151
"test:functional-nightly-preview": "yarn playwright install msedge && yarn playwright test --project=preview ",
5252
"test:smoke": "yarn npm audit --recursive --environment production && MOCHAWESOME_REPORTFILENAME=smoke REPORT_DIR=test-results/smokeTest REPORT_FILE=test-results/smokeTest/results.xml codeceptjs run --grep '@smoke-tests' --reporter mocha-multi --verbose",
53-
"test:local": "yarn playwright test --project=preview --headed --repeat-each 5",
53+
"test:local": "yarn playwright test --project=chromium --headed --repeat-each 1",
5454
"test:api-test": "yarn playwright test --config=playwright.api.config.ts",
5555
"prepare": "husky install",
5656
"yarn-update": "yarn set version 3.x",

playwright-e2e/fixtures/create-fixture.ts

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,11 @@ import {ManageOrdersOrderSelection} from "../pages/manage-orders/manage-orders-o
5555
import {Applications} from "../pages/applications/upload-additional/applications";
5656
import {ApplicationFee} from "../pages/applications/upload-additional/application-fee";
5757
import {SuppliedDocuments} from "../pages/applications/upload-additional/supplied-documents";
58+
import {CaseNote} from "../pages/case-note";
59+
import {ExpertReport} from "../pages/expert-report";
60+
import {Extend26WeekTimeline} from "../pages/extend-26week-timeline";
61+
import { RecordFinalDecision} from "../pages/record-final-decision";
62+
import {SendOrderRemainder} from "../pages/send-order-remainder";
5863

5964

6065
type CreateFixtures = {
@@ -114,6 +119,11 @@ type CreateFixtures = {
114119
uploadAdditionalApplicationsApplicationFee: ApplicationFee;
115120
uploadAdditionalApplicationsSuppliedDocuments: SuppliedDocuments;
116121
submit: Submit;
122+
caseNote: CaseNote;
123+
expertReport: ExpertReport;
124+
extend26WeekTimeline: Extend26WeekTimeline;
125+
recordFinalDecision: RecordFinalDecision;
126+
sendOrderRemainder: SendOrderRemainder;
117127

118128

119129
};
@@ -339,5 +349,20 @@ othersToBeGivenNotice: async ({ page }, use) => {
339349

340350
submit: async ({ page }, use) => {
341351
await use(new Submit(page));
352+
},
353+
caseNote: async ({ page }, use) => {
354+
await use(new CaseNote(page));
355+
},
356+
expertReport: async ({ page }, use) => {
357+
await use(new ExpertReport(page));
358+
},
359+
extend26WeekTimeline: async ({ page }, use) => {
360+
await use(new Extend26WeekTimeline(page));
361+
},
362+
recordFinalDecision: async ({ page }, use) => {
363+
await use(new RecordFinalDecision(page));
364+
},
365+
sendOrderRemainder: async ({ page }, use) => {
366+
await use(new SendOrderRemainder(page));
342367
}
343368
});

playwright-e2e/pages/base-page.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { type Page, type Locator, expect } from "@playwright/test";
1+
import {expect, type Locator, type Page} from "@playwright/test";
22

33
export class BasePage {
44
readonly nextStep: Locator;
@@ -58,7 +58,8 @@ export class BasePage {
5858
}
5959

6060
async clickContinue() {
61-
await this.continueButton.click({});
61+
await this.continueButton.waitFor({ state: 'attached'});
62+
await this.continueButton.click({});
6263
}
6364

6465
async clickPreviousButton() {
@@ -104,7 +105,9 @@ export class BasePage {
104105
}
105106

106107
async clickSubmit() {
107-
await this.submit.click();
108+
109+
await this.submit.click();
110+
108111
}
109112
async clickSaveAndContinue() {
110113
await this.saveAndContinue.click();
@@ -120,8 +123,7 @@ export class BasePage {
120123
let year = new Intl.DateTimeFormat('en', {year: 'numeric'}).format(date);
121124
let month = new Intl.DateTimeFormat('en', {month: 'short'}).format(date);
122125
let day = new Intl.DateTimeFormat('en', {day: 'numeric'}).format(date);
123-
let todayDate = `${day} ${month} ${year}`;
124-
return todayDate;
126+
return `${day} ${month} ${year}`;
125127
}
126128

127129
async fillDateInputs(page: Page, date: Date) {

playwright-e2e/pages/case-note.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import { type Page, type Locator, expect } from "@playwright/test";
2+
import { BasePage } from "./base-page";
3+
4+
export class CaseNote extends BasePage {
5+
6+
7+
8+
get caseNote(): Locator {
9+
return this.page.getByRole('textbox', { name: 'Note' })
10+
}
11+
12+
13+
constructor(page: Page) {
14+
super(page);
15+
16+
}
17+
18+
async enterCaseNote(note: string) {
19+
20+
await this.caseNote.fill(note);
21+
};
22+
};
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
import {type Page, type Locator, expect} from "@playwright/test";
2+
import {BasePage} from "./base-page";
3+
4+
export class ExpertReport extends BasePage {
5+
6+
7+
get addNewButton(): Locator {
8+
return this.page.getByRole('button', {name: 'Add new'})
9+
}
10+
11+
get dateRequested(): Locator {
12+
return this.page.getByRole('group', {name: 'Date requested'});
13+
}
14+
15+
get dateApproved(): Locator {
16+
return this.page.getByRole('group', {name: 'Date approved'});
17+
}
18+
19+
get reportApprovedYes(): Locator {
20+
return this.page.getByRole('group', {name: 'Has it been approved? (Optional)'}).getByLabel('Yes')
21+
}
22+
23+
constructor(page: Page) {
24+
super(page);
25+
}
26+
27+
async selectExpertReportType(type: string, reportNumber: number = 0) {
28+
await this.page.getByText('What type of report have you requested?').nth(reportNumber).selectOption({label: type});
29+
}
30+
31+
32+
async addNewReport(reportNumber: number) {
33+
await this.addNewButton.nth(reportNumber).focus();
34+
await this.addNewButton.nth(reportNumber).click();
35+
await expect(this.addNewButton.nth(1)).toBeVisible();
36+
37+
}
38+
39+
async checkDateValidationPass() {
40+
await this.page.press('body', 'Tab');
41+
await expect(this.page.getByText(' The data entered is not valid for Date requested ')).toBeHidden()
42+
}
43+
44+
async enterRequestedDate(requestDate: Date, reportNumber: number = 0) {
45+
await this.dateRequested.getByLabel('Day').nth(reportNumber).fill(requestDate.getDate().toString());
46+
await this.dateRequested.getByLabel('Month').nth(reportNumber).fill(requestDate.getMonth().toString());
47+
await this.dateRequested.getByLabel('Year').nth(reportNumber).fill(requestDate.getFullYear().toString());
48+
}
49+
50+
async enterApprovedDate(approvedDate: Date, reportNumber: number = 0) {
51+
await this.dateApproved.nth(reportNumber).getByLabel('Day').fill(approvedDate.getDate().toString());
52+
await this.dateApproved.nth(reportNumber).getByLabel('Month').fill(approvedDate.getMonth().toString());
53+
await this.dateApproved.nth(reportNumber).getByLabel('Year').fill(approvedDate.getFullYear().toString());
54+
55+
}
56+
57+
async orderApprovedYes(reportNumber: number = 0) {
58+
await this.reportApprovedYes.nth(reportNumber).click();
59+
await this.reportApprovedYes.nth(reportNumber).click();
60+
61+
}
62+
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
import { type Page} from "@playwright/test";
2+
import {BasePage} from "./base-page";
3+
4+
export class Extend26WeekTimeline extends BasePage {
5+
6+
7+
public constructor(page: Page) {
8+
super(page);
9+
10+
}
11+
12+
async isExtensionApprovedAtHearing(YesNo = 'Yes') {
13+
await this.page.getByRole('group', {name: 'Was this timeline extension approved at a hearing?'}).getByLabel(`${YesNo}`).click();
14+
}
15+
16+
async selectHearing(hearingDetails: string) {
17+
await this.page.getByLabel('Which hearing was this extension approved at?').selectOption(hearingDetails);
18+
}
19+
20+
async isAboutAllChildren(YesNo = 'Yes') {
21+
await this.page.getByRole('group', {name: 'Is the timeline extending for all the children?'}).getByLabel(`${YesNo}`).click();
22+
}
23+
24+
async sameExtensionDateForAllChildren(YesNo = 'Yes') {
25+
await this.page.getByRole('group', {name: 'Are all the selected children’s timelines being extended by the same amount of time, and for the same reason?'}).getByLabel(`${YesNo}`).click();
26+
}
27+
28+
async enterExtendsionDetails() {
29+
await this.page.getByRole('radio', {name: 'Extend by 8 Weeks'}).check();
30+
await this.page.getByRole('radio', {name: 'Timetable for proceedings'}).check();
31+
}
32+
33+
34+
}
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
import {type Page, type Locator, expect} from "@playwright/test";
2+
import {BasePage} from "./base-page";
3+
4+
export class RecordFinalDecision extends BasePage {
5+
6+
7+
constructor(page: Page) {
8+
super(page);
9+
10+
}
11+
12+
13+
get isFinalDecionForAllChild(): Locator {
14+
return this.page.getByRole('group', {name: 'Do all children in the case have final decisions?'})
15+
}
16+
17+
get decicionDate(): Locator {
18+
return this.page.getByRole('group', {name: 'Date final decision was made'})
19+
}
20+
21+
get childOneFinalDecisionReason() {
22+
return this.page.locator('#childFinalDecisionDetails00_finalDecisionReason-FINAL_ORDER')
23+
}
24+
25+
get childTwoFinalDecisionReason() {
26+
return this.page.locator('#childFinalDecisionDetails01_finalDecisionReason-NO_ORDER')
27+
}
28+
29+
get childThreeFinalDecisionReason() {
30+
return this.page.locator('#childFinalDecisionDetails02_finalDecisionReason-HOUSEKEEPING')
31+
}
32+
33+
get childFourFinalDecisionReason() {
34+
return this.page.locator('#childFinalDecisionDetails03_finalDecisionReason-WITHDRAWN')
35+
}
36+
37+
38+
async selectFinalDecisionForAllChildren(YesNo = 'Yes') {
39+
40+
await this.page.getByRole('radio', {name: 'Yes'}).check();
41+
}
42+
43+
async dateValidationPass() {
44+
await expect(this.page.getByText('The data entered is not valid for Date final decision was made')).toBeHidden();
45+
}
46+
47+
async enterDecisionDate(decisionDate: Date) {
48+
await this.decicionDate.getByRole('textbox', {name: 'Day'}).fill(new Intl.DateTimeFormat('en', {day: 'numeric'}).format(decisionDate));
49+
await this.decicionDate.getByRole('textbox', {name: 'Month'}).fill(new Intl.DateTimeFormat('en', {month: 'numeric'}).format(decisionDate));
50+
await this.decicionDate.getByRole('textbox', {name: 'Year'}).fill(new Intl.DateTimeFormat('en', {year: 'numeric'}).format(decisionDate));
51+
await this.decicionDate.click();
52+
}
53+
54+
async enterFinalOutCome() {
55+
await this.childOneFinalDecisionReason.click();
56+
await this.childTwoFinalDecisionReason.click();
57+
await this.childFourFinalDecisionReason.click();
58+
await this.childThreeFinalDecisionReason.click();
59+
await this.childFourFinalDecisionReason.click();
60+
61+
}
62+
63+
}
64+
65+
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import {type Page, type Locator, expect} from "@playwright/test";
2+
import {BasePage} from "./base-page";
3+
4+
export class SendOrderRemainder extends BasePage {
5+
6+
7+
constructor(page: Page) {
8+
super(page);
9+
}
10+
11+
get remainderRadioButton(): Locator {
12+
return this.page.getByRole('group', {name: 'Would you like to remind the'});
13+
}
14+
15+
get historyTab(): Locator {
16+
return this.page.getByRole('tab', { name: 'History',exact:true });
17+
}
18+
19+
async sendOrderRemainder(yesNo = 'Yes') {
20+
await this.remainderRadioButton.getByRole('radio', {name: 'Yes'}).check();
21+
}
22+
23+
//This need to be removed after EXUI fix the accessiblity issue
24+
async gotoHistoryTab(){
25+
await this.historyTab.click();
26+
}
27+
28+
}
29+
30+

playwright-e2e/pages/welsh-lang-requirements.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ export class WelshLangRequirements extends BasePage {
1010
readonly englishLangRadio: Locator;
1111
readonly needToBeTranslatedQuestion: Locator;
1212
readonly needToBeInWelshYesRadio: Locator;
13+
private adminWelshTransalationRquired: any;
1314

1415
constructor(page: Page) {
1516
super(page);
@@ -20,6 +21,8 @@ export class WelshLangRequirements extends BasePage {
2021
this.englishLangRadio = page.getByLabel('English');
2122
this.needToBeTranslatedQuestion = page.getByText('Does this application need to be translated into Welsh?');
2223
this.needToBeInWelshYesRadio = page.getByRole('group', { name: 'Does this application need to be translated into Welsh?' }).getByLabel('Yes');
24+
this.adminWelshTransalationRquired = page.getByRole('group',{name:'Does any respondent, child or other person on this case need orders or court documents in Welsh?'});
25+
2326
}
2427
async welshLanguageSmokeTest() {
2528
await expect(this.welshLangHeading).toBeVisible();
@@ -33,6 +36,10 @@ export class WelshLangRequirements extends BasePage {
3336
await expect(this.checkYourAnswersHeader).toBeVisible();
3437
await this.checkYourAnsAndSubmit();
3538
}
39+
async CTSCRequestWelshTranslation(YesNo='Yes') {
40+
await this.adminWelshTransalationRquired.getByLabel(`${YesNo}`).click();
41+
42+
}
3643
}
3744

3845

0 commit comments

Comments
 (0)