Skip to content

Commit

Permalink
Nightly dev (#412)
Browse files Browse the repository at this point in the history
  • Loading branch information
hsjhita authored Dec 13, 2024
1 parent 8db8360 commit c8aa189
Show file tree
Hide file tree
Showing 18 changed files with 576 additions and 151 deletions.
9 changes: 6 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"test/**/*.{js,jsx,ts,tsx}": "eslint"
},
"dependencies": {
"@axe-core/playwright": "4.10.0",
"@faker-js/faker": "8.4.1",
"@noble/hashes": "^1.5.0",
"axios": "^1.7.4",
Expand Down Expand Up @@ -55,14 +56,16 @@
"webdriverio": "8.36.0"
},
"resolutions": {
"axios": "^1.7.4",
"braces": "^3.0.3",
"cross-spawn": "^7.0.5",
"express": "^4.19.2",
"got": "^11.8.5",
"log4js": "^6.4.0",
"micromatch": "^4.0.8",
"semver-regex": "^3.1.4",
"tough-cookie": "^4.1.3",
"braces": "^3.0.3",
"ws": "^8.17.1",
"axios": "^1.7.4"
"ws": "^8.17.1"
},
"packageManager": "[email protected]"
}
19 changes: 19 additions & 0 deletions playwrighte2e/helper/accessibilityHelper.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { expect, Page } from "@playwright/test";
import AxeBuilder from "";

async function axeTest(page: Page): Promise<void> {
// accessibility testing function
const accessibilityScanResults = await new AxeBuilder({ page })
.withTags([
"wcag2a",
"wcag2aa",
"wcag21a",
"wcag21aa",
"wcag22a",
"wcag22aa",
])
.analyze();
expect(accessibilityScanResults.violations).toEqual([]);
}

export default axeTest;
23 changes: 7 additions & 16 deletions playwrighte2e/pages/caseListPage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,24 +141,15 @@ export default class CaseListPage extends BasePage{
async selectNextEvent(option) {
await this.elements.submitEventButton.isDisabled();
await this.page.getByLabel('Next step').selectOption(option);
//await this.elements.nextEventDropdown.selectOption(option);
await this.page.waitForTimeout(2000);
await this.elements.submitEventButton.isVisible();
await this.elements.submitEventButton.click();

// try {
// // Check if the element is visible
// const isVisible = await this.elements.submitEventButton.isVisible();
//
// if (isVisible) {
// // click Go button if visible
// await this.elements.submitEventButton.click();
// }
// } catch (error) {
// console.error('Error performing an Event', error);
// }
}

if (await this.elements.submitEventButton.isVisible()) {
// click Go button if visible
await this.elements.submitEventButton.click();
}
} catch (error) {
console.error('Error performing an Event', error);
}
async verifyCaseDetailsPage(et1VettingFlag) {
if (et1VettingFlag) {
//TO DO fix this tab Ids are not consistent
Expand Down
2 changes: 1 addition & 1 deletion playwrighte2e/pages/citizenHubPage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export default class CitizenHubPage extends BasePage {
notificationLink: '[href="/tribunal-orders-and-requests"]',
seeNotificationDetailsLink: 'td:nth-of-type(2) > .govuk-link',
sendNotifButton: 'td:nth-of-type(2) > .govuk-link',
respondButton: '.govuk-template__body .govuk-grid-row .govuk-button',
// respondButton: '.govuk-template__body .govuk-grid-row .govuk-button',
tribunalResponseField: '#response-text',
noSupportingMaterialOption: '[for="supporting-material-yes-no-2"]',
responseSubmitButton: '#main-form-submit',
Expand Down
2 changes: 0 additions & 2 deletions playwrighte2e/pages/createCaseThroughApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ import dataLocation from "../data/et-ccd-basic-data.json";
import * as OTPAuth from "totp-generator";
import axios from "axios";
import { BasePage } from "./basePage";
import { ur } from "@faker-js/faker";


const env = params.TestEnv;
const idamBaseUrl = `https://idam-api.${env}.platform.hmcts.net/loginUser`;
Expand Down
16 changes: 0 additions & 16 deletions playwrighte2e/pages/et1CaseServingPage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,25 +15,9 @@ export default class Et1CaseServingPage extends BasePage {
await expect(this.page.locator('ccd-case-edit-page')).toContainText('Pre-Acceptance');
await this.page.getByLabel('Yes').check();
await this.elements.date_accepted_day.fill(String(today.getDate()));
await this.elements.date_accepted_month.isVisible();
await this.elements.date_accepted_month.fill(String(today.getMonth() +1));
await this.elements.date_accepted_year.isVisible();
await this.elements.date_accepted_year.fill(String(today.getFullYear()));
await this.page.waitForTimeout(2000);
await this.submitButton();

// try {
// // Check if the element is visible
// const isVisible = await this.page.locator('cut-alert').isVisible();
//
// if (!isVisible) {
// // Click the button if the element is not visible
// await this.submitButton();
// }
// } catch (error) {
// console.error('Error performing Accept/Reject case Event', error);
// }

}


Expand Down
74 changes: 74 additions & 0 deletions playwrighte2e/pages/et3LoginPage.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
import { BasePage } from "./basePage";
import { params } from "../utils/config";
import { expect, Page } from '@playwright/test';


export default class Et3LoginPage extends BasePage {

protected constructor(page: Page) {
super(page);
}

public static create(page: Page): Et3LoginPage {
return new Et3LoginPage(page);
}

elements={

returnToExistingResponse:this.page.locator('[href="/return-to-existing?lng=en"]'),
submit:this.page.locator('[type="submit"]'),
startNow:this.page.locator('[href="/case-number-check"]'),
replyToNewClaim:this.page.locator('[href="/self-assignment-form?lng=en"]'),
submissionRefNumber: '#caseReferenceId',
respName:'#respondentName',
claimantFirstName:'#claimantFirstName',
claimantLastName:'#claimantLastName',
caseRefNumber:this.page.locator('#ethosCaseReference')
}
async processRespondentLogin(username: string, password: string, caseNumber: string) {
await this.page.goto(params.TestUrlRespondentUi);
await this.elements.startNow.click();
await expect(this.page.locator('h1')).toContainText('Case Number');
await this.elements.caseRefNumber.fill(caseNumber.toString());
await this.clickContinue();
await this.loginRespondentUi(username, password);
}

async loginRespondentUi(username, password){
await this.page.locator('#username').fill(username);
await this.page.locator('#password').fill(password);
await this.elements.submit.click();
}


async replyToNewClaim(submissionRef, caseNumber){
await expect(this.page.locator('h1')).toContainText('Before you continue');
await this.clickContinue();
await expect(this.page.locator('#main-content')).toContainText('ET3 Responses');
await this.elements.replyToNewClaim.click();
await this.caseDetailsPage(submissionRef);
await this.checkAndSubmitPage(caseNumber);
}

async caseDetailsPage(submissionRef){
await expect(this.page.locator('h1')).toContainText('Case Details');
await this.page.locator(this.elements.submissionRefNumber).fill(submissionRef.toString());
//resp name is hard coded here as case is created from api which is using json
await this.page.locator(this.elements.respName).fill('Mrs Test Auto');
await this.page.locator(this.elements.claimantFirstName).fill('Grayson');
await this.page.locator(this.elements.claimantLastName).fill('Becker');
await this.clickContinue();
}

async checkAndSubmitPage(caseNumber){
await expect(this.page.locator('h1')).toContainText('Check and submit');
await this.page.locator('#confirmation').check();
await this.submitButton();

//validate claim is displayed in awaiting response
await expect(this.page.locator('#main-content')).toContainText('ET3 Responses');
await this.elements.replyToNewClaim.isVisible();
await this.page.getByLabel('view ' + caseNumber.toString() + ':').click();
}

}
100 changes: 100 additions & 0 deletions playwrighte2e/pages/respClaimantDetails.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
import {BasePage} from "./basePage";
import { expect, Page } from '@playwright/test';

class RespClaimantDetails extends BasePage {
protected constructor(page: Page) {
super(page);
}

public static create(page: Page): RespClaimantDetails {
return new RespClaimantDetails(page);
}

elements={
clickAcasEarlyConciliationLink:this.page.locator('[href="/acas-early-conciliation-certificate"]'),
};

async et3Section2() {
await this.earlyConciliationDetails();
await this.claimantJobDetails();

}

async earlyConciliationDetails(){
await expect(this.page.locator('h1')).toContainText('Your response form (ET3)');
await this.elements.clickAcasEarlyConciliationLink.click();
await this.acasEarlyConciliation();
}

async acasEarlyConciliation(){
await expect(this.page.locator('h1')).toContainText('Acas early conciliation certificate');
await this.page.getByLabel('No').check();
await this.page.getByLabel('Why do you disagree with the').fill('Test ACAS');
await this.saveAndContinueButton();
}

async claimantJobDetails(){
await this.claimantEmploymentDates();
await this.claimantEmploymentContinuing();
await this.claimantJobTitle();
await this.claimantAverageWeeklyHours();
await this.claimantDetailsCya();
await this.claimantPayDetails();
await this.claimantNoticeDetails();
await this.claimantBenefitsDetails();
await this.claimantDetailsCya();
}

async claimantEmploymentDates(){
await this.page.getByLabel('No', { exact: true }).check();
await this.saveAndContinueButton();
await this.page.getByRole('group', { name: 'Employment start date (' }).getByLabel('Day').fill('1');
await this.page.getByRole('group', { name: 'Employment start date (' }).getByLabel('Month').fill('1');
await this.page.getByRole('group', { name: 'Employment start date (' }).getByLabel('Year').fill('2024');
await this.saveAndContinueButton();
}

async claimantEmploymentContinuing(){
await this.page.getByLabel('Yes').check();
await this.saveAndContinueButton();
}

async claimantJobTitle(){
await this.page.getByLabel('No', { exact: true }).check();
await this.page.getByLabel('What is or was the claimant’s').fill('Tester');
await this.saveAndContinueButton();
}

async claimantAverageWeeklyHours(){
await this.page.getByLabel('No', { exact: true }).check();
await this.page.getByLabel('What are the claimant’s').fill('40');
await this.saveAndContinueButton();
}

async claimantDetailsCya(){
await this.page.getByLabel('Yes, I’ve completed this').check();
await this.saveAndContinueButton();
}

async claimantPayDetails(){
await this.page.getByLabel('No', { exact: true }).check();
await this.saveAndContinueButton();
await this.page.getByLabel('Monthly').check();
await this.page.getByLabel('Enter the claimant’s pay').fill('3500');
await this.page.getByLabel('Enter the claimant’s normal').fill('2700');
await this.saveAndContinueButton();
}

async claimantNoticeDetails(){
await this.page.getByLabel('Yes').check();
await this.saveAndContinueButton();
}

async claimantBenefitsDetails(){
await this.page.getByLabel('Not applicable').check();
await this.saveAndContinueButton();
}

}

export default RespClaimantDetails;
Loading

0 comments on commit c8aa189

Please sign in to comment.