Skip to content

Commit f812669

Browse files
gokul-solgokul-solNilamkanojiya
authored
Migrate Case linking, case flag tests to playwright & fix ET3 journey tests (#423)
* Add bundle tests to playwright framework * migrate CFV tests to playwright * remove unused variables * remove commented code * refactored code * add claimant bundle test * case link tests * Increase workers * Increase worker count * comment unexisting step * revert citizen ui code * fix falky test * fix Nightly (#422) * fix dependency * RET-5556 * add case flag scripts * notification * send notification * fix ET3 tests * fix jurisdiction event --------- Co-authored-by: gokul-sol <[email protected]> Co-authored-by: Nilamkanojiya <[email protected]>
1 parent 9fcd1e1 commit f812669

21 files changed

+572
-190
lines changed

Diff for: .gitignore

+7-1
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,10 @@ yarn-error.log
3333
!.yarn/plugins
3434
!.yarn/releases
3535
!.yarn/sdks
36-
!.yarn/versions
36+
!.yarn/versions
37+
38+
# Playwright
39+
/test-results/
40+
/playwright-report/
41+
/blob-report/
42+
/playwright/.cache/

Diff for: package.json

+69-69
Original file line numberDiff line numberDiff line change
@@ -1,71 +1,71 @@
11
{
2-
"name": "et-xui-e2e-tests",
3-
"version": "1.0.0",
4-
"description": "Employment Tribunal E2E Test",
5-
"main": "index.js",
6-
"repository": "[email protected]:hmcts/et-xui-e2e-tests.git",
7-
"author": "[email protected]",
8-
"license": "hmcts",
9-
"private": true,
10-
"scripts": {
11-
"test:fullfunctional": "yarn playwright install chromium && yarn playwright test --project=chromium --grep @smoke",
12-
"test:functional-chromium": "yarn playwright install chromium && yarn playwright test --project=chromium",
13-
"test:functional-webkit": "yarn playwright install webkit && yarn playwright test --project=webkit --grep @cx",
14-
"test:functional-firefox": "yarn playwright install firefox && yarn playwright test --project=firefox --grep @cx",
15-
"lint-staged": "lint-staged",
16-
"lint": "eslint",
17-
"fortifyScan": "./src/test/java/gradlew -p src/test/java fortifyScan",
18-
"prepare": "husky install",
19-
"yarn-update": "yarn set version 3.x",
20-
"install-dependencies": "/usr/bin/yarn install --silent"
21-
},
22-
"lint-staged": {
23-
"test/**/*.{js,jsx,ts,tsx}": "eslint"
24-
},
25-
"dependencies": {
26-
"@axe-core/playwright": "4.10.0",
27-
"@faker-js/faker": "8.4.1",
28-
"@noble/hashes": "^1.5.0",
29-
"axios": "^1.7.4",
30-
"chance": "^1.1.11",
31-
"eslint": "9.9.1",
32-
"eslint-config-prettier": "9.1.0",
33-
"eslint-plugin-codeceptjs": "1.3.0",
34-
"eslint-plugin-import": "2.29.1",
35-
"eslint-plugin-mocha": "10.4.2",
36-
"eslint-plugin-prettier": "5.2.1",
37-
"groq-sdk": "^0.5.0",
38-
"lint-staged": "15.2.2",
39-
"mocha": "10.4.0",
40-
"mocha-junit-reporter": "^2.2.1",
41-
"mocha-multi": "1.1.7",
42-
"mochawesome": "7.1.3",
43-
"openai": "^4.47.1",
44-
"prettier": "3.2.5",
45-
"totp-generator": "1.0.0",
46-
"typescript": "5.4.5"
47-
},
48-
"devDependencies": {
49-
"@playwright/test": "^1.45.3",
50-
"@types/chai-as-promised": "^7.1.5",
51-
"@types/chance": "^1.1.6",
52-
"@types/node": "^20.14.11",
53-
"config": "^3.3.9",
54-
"husky": "9.0.11",
55-
"nyc": "^15.1.0",
56-
"webdriverio": "8.36.0"
57-
},
58-
"resolutions": {
59-
"axios": "^1.7.4",
60-
"braces": "^3.0.3",
61-
"cross-spawn": "^7.0.5",
62-
"express": "^4.19.2",
63-
"got": "^11.8.5",
64-
"log4js": "^6.4.0",
65-
"micromatch": "^4.0.8",
66-
"semver-regex": "^3.1.4",
67-
"tough-cookie": "^4.1.3",
68-
"ws": "^8.17.1"
69-
},
70-
"packageManager": "[email protected]"
2+
"name": "et-xui-e2e-tests",
3+
"version": "1.0.0",
4+
"description": "Employment Tribunal E2E Test",
5+
"main": "index.js",
6+
"repository": "[email protected]:hmcts/et-xui-e2e-tests.git",
7+
"author": "[email protected]",
8+
"license": "hmcts",
9+
"private": true,
10+
"scripts": {
11+
"test:fullfunctional": "yarn playwright install chromium && yarn playwright test --project=chromium --grep @smoke",
12+
"test:functional-chromium": "yarn playwright install chromium && yarn playwright test --project=chromium",
13+
"test:functional-webkit": "yarn playwright install webkit && yarn playwright test --project=webkit --grep @cx",
14+
"test:functional-firefox": "yarn playwright install firefox && yarn playwright test --project=firefox --grep @cx",
15+
"lint-staged": "lint-staged",
16+
"lint": "eslint",
17+
"fortifyScan": "./src/test/java/gradlew -p src/test/java fortifyScan",
18+
"prepare": "husky install",
19+
"yarn-update": "yarn set version 3.x",
20+
"install-dependencies": "/usr/bin/yarn install --silent"
21+
},
22+
"lint-staged": {
23+
"test/**/*.{js,jsx,ts,tsx}": "eslint"
24+
},
25+
"dependencies": {
26+
"@axe-core/playwright": "4.10.0",
27+
"@faker-js/faker": "8.4.1",
28+
"@noble/hashes": "^1.5.0",
29+
"axios": "^1.7.4",
30+
"chance": "^1.1.11",
31+
"eslint": "9.9.1",
32+
"eslint-config-prettier": "9.1.0",
33+
"eslint-plugin-codeceptjs": "1.3.0",
34+
"eslint-plugin-import": "2.29.1",
35+
"eslint-plugin-mocha": "10.4.2",
36+
"eslint-plugin-prettier": "5.2.1",
37+
"groq-sdk": "^0.5.0",
38+
"lint-staged": "15.2.2",
39+
"mocha": "10.4.0",
40+
"mocha-junit-reporter": "^2.2.1",
41+
"mocha-multi": "1.1.7",
42+
"mochawesome": "7.1.3",
43+
"openai": "^4.47.1",
44+
"prettier": "3.2.5",
45+
"totp-generator": "1.0.0",
46+
"typescript": "5.4.5"
47+
},
48+
"devDependencies": {
49+
"@playwright/test": "^1.50.1",
50+
"@types/chai-as-promised": "^7.1.5",
51+
"@types/chance": "^1.1.6",
52+
"@types/node": "^20.14.11",
53+
"config": "^3.3.9",
54+
"husky": "9.0.11",
55+
"nyc": "^15.1.0",
56+
"webdriverio": "8.36.0"
57+
},
58+
"resolutions": {
59+
"axios": "^1.7.4",
60+
"braces": "^3.0.3",
61+
"cross-spawn": "^7.0.5",
62+
"express": "^4.19.2",
63+
"got": "^11.8.5",
64+
"log4js": "^6.4.0",
65+
"micromatch": "^4.0.8",
66+
"semver-regex": "^3.1.4",
67+
"tough-cookie": "^4.1.3",
68+
"ws": "^8.17.1"
69+
},
70+
"packageManager": "[email protected]"
7171
}

Diff for: playwright.config.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ export default defineConfig({
1818
/* Fail the build on CI if you accidentally left test.only in the source code. */
1919
forbidOnly: !!process.env.CI,
2020
/* Retry on CI only */
21-
retries: process.env.CI ? 3 : 0,
21+
retries: process.env.CI ? 2 : 0,
2222
/* Opt out of parallel tests on CI. */
23-
workers: process.env.CI ? 1 : undefined,
23+
workers: process.env.CI ? 6 : undefined,
2424
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
2525
reporter: 'html',
2626
timeout: 4 * 60 * 1000,

Diff for: playwrighte2e/pages/basePage.ts

+15-5
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ export abstract class BasePage {
1212
readonly signout:Locator;
1313
readonly startNow:Locator;
1414
readonly saveAndContinue:Locator;
15+
readonly nextButton:Locator;
1516

1617

1718
constructor(page: Page) {
@@ -25,6 +26,7 @@ export abstract class BasePage {
2526
this.signout = page.getByText('Sign out');
2627
this.startNow = page.getByRole('button', { name: 'Start now' });
2728
this.saveAndContinue = page.getByRole('button', { name: 'Save and continue' });
29+
this.nextButton = page.getByRole('button', { name: 'Next' });
2830
}
2931

3032
async wait(time: number) {
@@ -47,6 +49,14 @@ export abstract class BasePage {
4749
await this.submit.click();
4850
}
4951

52+
async delay(ms: number) {
53+
return new Promise( resolve => setTimeout(resolve, ms) );
54+
}
55+
56+
async clickNextButton(){
57+
await this.nextButton.click();
58+
}
59+
5060
async enterPostCode(postcode){
5161
await this.postcode.fill(postcode);
5262
await this.wait(3000);
@@ -75,17 +85,17 @@ export abstract class BasePage {
7585
await this.processAreYouMakingTheClaimOnYourOwnPage();
7686
await this.processDoYouHaveAnACASEarlyConciliation();
7787
await this.processWhatKindOfClaimAreYouMaking();
78-
}
88+
}
7989

80-
async startDraftApplication() {
90+
async startDraftApplication() {
8191
await this.page.waitForSelector('text=Make a claim to an employment tribunal', { timeout: 30000 });
8292
await this.page.click('text=Start now');
83-
}
93+
}
8494

85-
async processBeforeYourContinuePage() {
95+
async processBeforeYourContinuePage() {
8696
await this.page.waitForSelector('#main-content', { timeout: 5000 });
8797
await this.page.click('text=Continue');
88-
}
98+
}
8999

90100
async processWhatsThePostCodeYouHaveWorkedForPage(postcode: string) {
91101
await this.page.waitForSelector('#main-content', { timeout: 5000 });

Diff for: playwrighte2e/pages/caseLinkPage.ts

+99
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
import { Page } from '@playwright/test';
2+
import { BasePage } from './basePage';
3+
4+
export class CaseLinkPage extends BasePage{
5+
6+
readonly nextButton = '#next-button';
7+
readonly caseLinkProposeButton = '#propose';
8+
readonly beforeYouStartCaseLinking = '.govuk-heading-xl';
9+
readonly caseReferenceField = '[name="width-20"]';
10+
readonly bailOption = '#CLRC010';
11+
readonly samePartyOption = '#CLRC003';
12+
readonly sharedEvidenceOption = '#CLRC008';
13+
readonly guardianOption = '#CLRC006';
14+
readonly linkedForHearingOption = '#CLRC017';
15+
readonly progressedAsPartofLeadCase = '#CLRC016';
16+
readonly removeLinkedCase = '//a[.="Remove"]';
17+
readonly submitButtonLink = '//button[@class="button"]';
18+
readonly checkedLinkedCases = '[name="linkedCases"]';
19+
readonly cyaBody = '#fieldset-case-data';
20+
readonly unlinkCasesSuccessMessageAlert = '//div[@class="alert-message"]';
21+
22+
23+
async checksCaseLinkStartingPage() {
24+
25+
await Promise.all([
26+
await this.page.waitForSelector(this.nextButton, { timeout: 20000 }),
27+
await this.page.waitForSelector(this.beforeYouStartCaseLinking, { timeout: 10000 }),
28+
await this.page.waitForSelector('text=Before you start'),
29+
await this.page.waitForSelector('text=If a group of linked cases has a lead case, you must start from the lead case.'),
30+
await this.page.waitForSelector('text=If the cases to be linked has no lead, you can start the linking journey from any of those cases.'),
31+
await this.delay(3000),
32+
await this.page.click(this.nextButton)
33+
]);
34+
}
35+
36+
async enterCaseLinkReferenceWithHearing(submissionReference: string) {
37+
38+
await Promise.all([
39+
await this.page.waitForSelector(this.caseLinkProposeButton, { timeout: 10000 }),
40+
await this.page.waitForSelector('text=Enter case reference'),
41+
await this.page.waitForSelector('text=Why should these cases be linked?'),
42+
await this.page.fill(this.caseReferenceField, submissionReference),
43+
await this.page.check(this.bailOption),
44+
await this.page.check(this.samePartyOption),
45+
await this.page.check(this.sharedEvidenceOption),
46+
await this.page.check(this.guardianOption),
47+
await this.page.check(this.linkedForHearingOption),
48+
await this.page.check(this.progressedAsPartofLeadCase),
49+
await this.delay(3000),
50+
await this.page.click(this.caseLinkProposeButton),
51+
await this.page.click(this.nextButton),
52+
await this.page.waitForSelector(this.submitButtonLink),
53+
await this.page.waitForSelector('text=Check your answers'),
54+
await this.page.click(this.submitButtonLink)
55+
]);
56+
}
57+
58+
async enterCaseLinkReferenceWithoutHearing(submissionReference: string) {
59+
await this.page.waitForSelector(this.caseLinkProposeButton, { timeout: 20000 });
60+
await this.page.waitForSelector('text=Enter case reference');
61+
await this.page.waitForSelector('text=Why should these cases be linked?');
62+
await this.page.fill(this.caseReferenceField, submissionReference);
63+
await this.page.check(this.bailOption);
64+
await this.page.check(this.samePartyOption);
65+
await this.page.check(this.sharedEvidenceOption);
66+
await this.page.check(this.guardianOption);
67+
await this.page.check(this.progressedAsPartofLeadCase);
68+
await this.page.click(this.caseLinkProposeButton);
69+
await this.page.waitForSelector(this.removeLinkedCase, { timeout: 10000 });
70+
await this.page.fill(this.caseReferenceField, submissionReference);
71+
await this.page.check(this.bailOption);
72+
await this.page.check(this.samePartyOption);
73+
await this.page.check(this.sharedEvidenceOption);
74+
await this.page.check(this.guardianOption);
75+
await this.page.check(this.linkedForHearingOption);
76+
await this.page.check(this.progressedAsPartofLeadCase);
77+
await this.page.click(this.caseLinkProposeButton);
78+
await this.page.waitForTimeout(2000);
79+
await this.page.click(this.nextButton);
80+
await this.page.waitForSelector(this.submitButtonLink);
81+
await this.page.waitForSelector('text=Check your answers');
82+
await this.page.click(this.submitButtonLink);
83+
}
84+
85+
async unlinkedCase() {
86+
await this.page.waitForSelector(this.nextButton);
87+
await this.page.click(this.nextButton);
88+
await this.page.waitForSelector(this.checkedLinkedCases);
89+
await this.page.check(this.checkedLinkedCases);
90+
await this.page.click(this.nextButton);
91+
await this.page.waitForSelector(this.cyaBody, { timeout: 15000 });
92+
await this.page.waitForSelector('text=Check your answers');
93+
await this.page.waitForSelector('text=Cases to unlink');
94+
await this.page.click(this.submitButtonLink);
95+
await this.page.waitForTimeout(2000);
96+
await this.page.click(this.submitButtonLink);
97+
await this.page.waitForSelector(this.unlinkCasesSuccessMessageAlert, { timeout: 15000 });
98+
}
99+
}

Diff for: playwrighte2e/pages/caseListPage.ts

+7-17
Original file line numberDiff line numberDiff line change
@@ -139,26 +139,16 @@ export default class CaseListPage extends BasePage{
139139
}
140140

141141
async selectNextEvent(option) {
142-
// await this.elements.submitEventButton.isDisabled();
143-
// await this.page.getByLabel('Next step').selectOption(option);
144-
// await this.elements.submitEventButton.click();
145-
146-
// await expect(this.elements.submitEventButton).toBeEnabled();
147142

148143
await Promise.all([
149-
this.page.locator(this.elements.submitEventButton).waitFor({ state: 'visible' }),
150-
this.page.getByLabel('Next step').selectOption(option),
151-
expect(this.page.getByRole('button', { name: 'Go', exact: true })).toBeEnabled(),
152-
this.page.locator(this.elements.submitEventButton).click()
144+
await this.page.locator(this.elements.submitEventButton).waitFor({ state: 'visible' }),
145+
await this.page.getByLabel('Next step').selectOption(option),
146+
// expect(this.page.getByRole('button', { name: 'Go', exact: true })).toBeEnabled(),
147+
await this.delay(3000),
148+
await this.page.locator(this.elements.submitEventButton).click()
153149
]);
154-
155-
if (await this.page.locator(this.elements.submitEventButton).isVisible()) {
156-
// click Go button if visible
157-
await this.page.locator(this.elements.submitEventButton).click();
158-
}
159-
} catch (error) {
160-
console.error('Error performing an Event', error);
161-
}
150+
}
151+
162152
async verifyCaseDetailsPage(et1VettingFlag) {
163153
if (et1VettingFlag) {
164154
//TO DO fix this tab Ids are not consistent

Diff for: playwrighte2e/pages/citizenUiPage.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ export default class CitizenUiPage extends BasePage{
1515
header1: this.page.locator('h1'),
1616
jurisdiction:this.page.locator('#claim-jurisdiction')
1717
};
18+
1819
async processPreLoginPagesForTheDraftApplication(postcode) {
1920
await this.startDraftApplication();
2021
await this.processBeforeYourContinuePage();
@@ -35,7 +36,6 @@ export default class CitizenUiPage extends BasePage{
3536
await expect(this.elements.header1).toContainText('Before you continue');
3637
await this.clickContinue();
3738
}
38-
3939
async processWhatsThePostCodeYouHaveWorkedForPage(postcode) {
4040
await expect(this.elements.header1).toContainText('What’s the postcode where you worked or work?');
4141
await this.elements.workPostcode.fill(postcode);

0 commit comments

Comments
 (0)