Skip to content

Commit

Permalink
Nightly dev (#426)
Browse files Browse the repository at this point in the history
* 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

* Refactor & tests for casesubmissions

* add logs for date

* amend idam endpoint

---------

Co-authored-by: gokul-sol <[email protected]>
Co-authored-by: Nilamkanojiya <[email protected]>
  • Loading branch information
3 people authored Feb 7, 2025
1 parent f812669 commit b2d235f
Show file tree
Hide file tree
Showing 16 changed files with 520 additions and 341 deletions.
2 changes: 1 addition & 1 deletion Jenkinsfile_nightly
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ properties([
string(name: 'ENVIRONMENT', defaultValue: 'aat', description: 'Environment to test'),
string(name: 'ET_SYA_URL_TO_TEST', defaultValue: 'https://et-sya.aat.platform.hmcts.net/', description: 'The URL you want to run these tests against'),
string(name: 'ET_SYR_URL_TO_TEST', defaultValue: 'https://et-syr.aat.platform.hmcts.net/', description: 'The URL you want to run these tests against'),
string(name: 'IDAM_URL', defaultValue: 'https://idam-api.aat.platform.hmcts.net/loginUser', description: 'Idam url'),
string(name: 'IDAM_URL', defaultValue: 'https://idam-api.aat.platform.hmcts.net/testing-support/accounts', description: 'Idam url'),
string(name: 'CCD_CALLBACKS_URL', defaultValue: 'https://manage-case.aat.platform.hmcts.net/cases', description: 'ccd url'),
string(name: 'ET_CASE_API_URL', defaultValue: 'http://et-sya-api-aat.service.core-compute-aat.internal/cases/initiate-case/', description: 'The Url for creating draft cases'),
string(name: 'ET_SUBMIT_DRAFT_CASE_URL', defaultValue: 'http://et-sya-api-aat.service.core-compute-aat.internal/cases/submit-case/', description: 'The Endpoint for submitting a darft case'),
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
"typescript": "5.4.5"
},
"devDependencies": {
"@faker-js/faker": "7.2.0",
"@playwright/test": "^1.50.1",
"@types/chai-as-promised": "^7.1.5",
"@types/chance": "^1.1.6",
Expand Down
10 changes: 10 additions & 0 deletions playwrighte2e/data/ui-data/user-details.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"postcode": "LS9 9HE",
"addressOption": "3, Skelton Avenue, Leeds, LS9 9HE",
"workPostcode": "LS7 4QE",
"selectedWorkAddress": "7, Valley Gardens, Leeds, LS7 4QE",
"firstLineOfAddress": "7, Valley Gardens",
"scotWorkPostcode": "EH45 9BU",
"scotSelectedWorkAddress": "Unit 4, Cherry Court, Cavalry Park, Peebles, EH45 9BU",
"scotFirstLineOfAddress": "Unit 4, Cherry Court, Cavalry Park"
}
110 changes: 110 additions & 0 deletions playwrighte2e/pages/caseOverviewPage.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
import { Page } from '@playwright/test';
import { BasePage } from './basePage';

export class CaseOverviewPage extends BasePage{

applicationTab = '#mat-tab-label-0-9';
applicationDropdown = '#tseAdminSelectApplication';
decisionForm = '#caseEditForm';
notificationTitleDecisionPage = '#tseAdminEnterNotificationTitle';
decisionGranted = '#tseAdminDecision-Granted';
decisionGrantedInPart = '#tseAdminDecision-Granted in part';
decisionRefused = '#tseAdminDecision-Refused';
otherDecision = '#tseAdminDecision-Other';
judgementDecisionType = 'tseAdminTypeOfDecision-Judgment';
caseManagementDecisionType = '[id="tseAdminTypeOfDecision-Case management order"]';
additionalDecisionInformation = '#tseAdminAdditionalInformation';
madeByLegalOfficer = '[id="tseAdminDecisionMadeBy-Legal officer"]';
isResponseRequired_No = '#tseAdminIsResponseRequired-No';
madeByAJudge = '#tseAdminDecisionMadeBy-Judge';
bothParties = '[id="tseAdminSelectPartyNotify-Both parties"]';
claimantOnly = '[id="tseAdminSelectPartyNotify-Claimant only"]';
respondentOnly = '[id="tseAdminSelectPartyNotify-Respondent only"]';
fullNameDecisionMaker = '#tseAdminDecisionMadeByFullName';
confirmSubmission = '#confirmation-body';
returnToCaseOverview = '//button[@class="button"]';

async recordAdecisionOnAcase(submissionReference: string, appOption: string, decision: string, decisionType: string, decisionMaker: string, respondingParties: string) {
const recordDecisionLink = `/cases/case-details/${submissionReference}/trigger/tseAdmin/tseAdmin1`;
await this.page.click(this.applicationTab);
await this.page.click(`[href="${recordDecisionLink}"]`);
await this.page.selectOption(this.applicationDropdown, appOption);
await this.page.click('text=Continue');
await this.page.waitForSelector(this.decisionForm, { timeout: 15000 });
await this.page.fill(this.notificationTitleDecisionPage, 'adding a decision');

switch (decision) {
case 'granted':
await this.page.check(this.decisionGranted);
break;
case 'granted in part':
await this.page.check(this.decisionGrantedInPart);
break;
case 'refused':
await this.page.check(this.decisionRefused);
break;
case 'other decision':
await this.page.check(this.otherDecision);
break;
default:
throw new Error('... decision option is invalid');
}

switch (decisionType) {
case 'judgment':
await this.page.check(this.judgementDecisionType);
break;
case 'cmo-responding':
await this.page.waitForTimeout(2000);
await this.page.evaluate(() => window.scrollTo(0, document.body.scrollHeight));
await this.page.check(this.caseManagementDecisionType);
await this.page.check(this.isResponseRequired_No);
break;
case 'cmo-no-response':
await this.page.waitForTimeout(2000);
await this.page.evaluate(() => window.scrollTo(0, document.body.scrollHeight));
await this.page.check(this.caseManagementDecisionType);
await this.page.check(this.isResponseRequired_No);
break;
default:
throw new Error('... decision type is invalid');
}

await this.page.fill(this.additionalDecisionInformation, '...test');

switch (decisionMaker) {
case 'legal officer':
await this.page.check(this.madeByLegalOfficer);
break;
case 'judge':
await this.page.check(this.madeByAJudge);
break;
default:
throw new Error('... please select who made the decision');
}

await this.page.fill(this.fullNameDecisionMaker, 'ET Tester');

switch (respondingParties) {
case 'both':
await this.page.check(this.bothParties);
break;
case 'claimant only':
await this.page.check(this.claimantOnly);
break;
case 'respondent only':
await this.page.check(this.respondentOnly);
break;
default:
throw new Error('... please party to respond');
}

await this.page.click('text=Continue');
await this.page.waitForSelector('.form-table', { timeout: 15000 });
await this.page.waitForSelector('text=Check your answers');
await this.page.click('text=Submit');
await this.page.waitForSelector(this.confirmSubmission, { timeout: 15000 });
await this.page.waitForSelector('text=What happens next');
await this.page.click(this.returnToCaseOverview);
}
}
11 changes: 5 additions & 6 deletions playwrighte2e/pages/citizenUiPage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,16 @@ export default class CitizenUiPage extends BasePage{
acasMultiple:this.page.locator('#acas-multiple'),
discriminationCheckBox: this.page.locator('#discrimination'),
whistleBlowingCheckBox: this.page.locator('#whistleBlowing'),
header1: this.page.locator('h1'),
jurisdiction:this.page.locator('#claim-jurisdiction')
header1: this.page.locator('h1')
};

async processPreLoginPagesForTheDraftApplication(postcode) {
async processPreLoginPagesForTheDraftApplication(region) {
await this.startDraftApplication();
await this.processBeforeYourContinuePage();
//await this.processWhatsThePostCodeYouHaveWorkedForPage(postcode);
await this.processAreYouMakingTheClaimForYourselfPage();
await this.processAreYouMakingTheClaimOnYourOwnPage();
await this.processWhereYouCanMakeClaim();
await this.processWhereYouCanMakeClaim(region);
await this.processDoYouHaveAnACASEarlyConciliation();
await this.processWhatKindOfClaimAreYouMaking();
}
Expand All @@ -42,9 +41,9 @@ export default class CitizenUiPage extends BasePage{
await this.clickContinue();
}

async processWhereYouCanMakeClaim(){
async processWhereYouCanMakeClaim(region){
await expect(this.elements.header1).toContainText('Where you can make your claim');
await this.elements.jurisdiction.check('England and Wales');
await this.page.locator(`//input[@value='ET_${region}']`).check();
await this.clickContinue();
}

Expand Down
93 changes: 90 additions & 3 deletions playwrighte2e/pages/createAndAcceptCase.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,27 @@
import { params } from "../utils/config";
import LoginPage from "./loginPage";
import CreateCaseThroughApi from "./createCaseThroughApi";
import CaseListPage from "./caseListPage";
import Et1CaseServingPage from "./et1CaseServingPage";
import {params} from "../utils/config";
import CitizenUiPage from "../pages/citizenUiPage";
import TaskListPage from "../pages/taskListPage";
import PersonalDetailsPage from "../pages/personalDetailsPage";
import EmploymentAndRespDetailsPage from "../pages/employmentAndRespDetailsPage";
import ClaimDetailsPage from "../pages/claimDetailsPage";
import SubmitClaimPage from "../pages/submitClaimPage";
import Et1VettingPages from "../pages/et1VettingPages";
// import Et1VettingPage from '../pages/et1VettingPages';


let subRef: string;
let submissionRef: string;
let caseNumber;

const userDetailsData = require('../data/ui-data/user-details.json');

export default class createAndAcceptCase {
async setupCase(page, region: string, caseType: string) {

async setupCaseCreatedViaApi(page, region: string, caseType: string) {

let loginPage = new LoginPage(page);
let createCaseThroughApi = new CreateCaseThroughApi(page);
Expand All @@ -18,7 +30,7 @@ export default class createAndAcceptCase {

submissionRef = await createCaseThroughApi.processCaseToAcceptedState(region, caseType);
subRef = submissionRef.toString();

await page.goto(params.TestUrlForManageCaseAAT);
await loginPage.processLogin(params.TestEnvETCaseWorkerUser, params.TestEnvETPassword);
const searchReference = region === "England" ? 'Eng/Wales - Singles' : `${region} - Singles`;
Expand All @@ -31,4 +43,79 @@ export default class createAndAcceptCase {

return subRef;
}

async setupCUICaseCreatedViaApi(page) {

let loginPage = new LoginPage(page);
let createCaseThroughApi = new CreateCaseThroughApi(page);
let caseListPage = new CaseListPage(page);
let et1CaseServingPage = new Et1CaseServingPage(page);
// let listHearingPage = new ListHearingPage(page);
// let legalRepPage = new LegalRepPage(page);
let et1VettingPage = new Et1VettingPages(page);

submissionRef = await createCaseThroughApi.processCuiCaseToAcceptedState();
subRef = submissionRef.toString();

await page.goto(params.TestUrlForManageCaseAAT);
await loginPage.processLogin(params.TestEnvETCaseWorkerUser, params.TestEnvETPassword);
await caseListPage.searchCaseApplicationWithSubmissionReference('Eng/Wales - Singles', subRef);
caseNumber = await caseListPage.processCaseFromCaseList();

// Case vetting
await caseListPage.selectNextEvent('ET1 case vetting');
await et1VettingPage.processET1CaseVettingPages();

// Accept case
await caseListPage.selectNextEvent('Accept/Reject Case');
await et1CaseServingPage.processET1CaseServingPages();

return {subRef, caseNumber};
}

async createCaseViaCUI(page, region, loginMethod, employmentJourneyMethod) {

const citizenUiPage = new CitizenUiPage(page);
const loginPage = new LoginPage(page);
const taskListPage = new TaskListPage(page);
const personalDetailsPage = new PersonalDetailsPage(page);
const employmentAndRespondentDetailsPage = new EmploymentAndRespDetailsPage(page);
const claimDetailsPage = new ClaimDetailsPage(page);
const submitClaimPage = new SubmitClaimPage(page);

await page.goto(params.TestUrlCitizenUi);
await citizenUiPage.processPreLoginPagesForTheDraftApplication(region);
await loginMethod(loginPage);
await taskListPage.processPostLoginPagesForTheDraftApplication();
const location = region === 'EnglandWales' ? 'England' : region;
await personalDetailsPage.processPersonalDetails(userDetailsData.postcode, location, userDetailsData.addressOption);
await employmentJourneyMethod(employmentAndRespondentDetailsPage);
await claimDetailsPage.processClaimDetails();
const submissionReference = await submitClaimPage.submitClaim();
await submitClaimPage.signoutButton();

return submissionReference;
}

async setupCaseCreatedViaCUI(page, region, submissionReference, loginCredentials) {
const loginPage = new LoginPage(page);
const caseListPage = new CaseListPage(page);
const et1CaseVettingPage = new Et1VettingPages(page);
const et1CaseServingPage = new Et1CaseServingPage(page);

await page.goto(params.TestUrlForManageCaseAAT);
await loginPage.processLogin(loginCredentials.user, loginCredentials.password);
const searchReference = region === 'EnglandWales' ? 'Eng/Wales - Singles' : `${region} - Singles`;
await caseListPage.searchCaseApplicationWithSubmissionReference(searchReference, submissionReference);
const caseNumber = await caseListPage.processCaseFromCaseList();
await caseListPage.verifyCaseDetailsPage(true);

await caseListPage.selectNextEvent('ET1 case vetting');
await et1CaseVettingPage.processET1CaseVettingPages();
await caseListPage.verifyCaseDetailsPage(false);
await caseListPage.selectNextEvent('Accept/Reject Case');
await et1CaseServingPage.processET1CaseServingPages();

return caseNumber;
}
}
Loading

0 comments on commit b2d235f

Please sign in to comment.