Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DFPL-2578 #5712

Merged
merged 11 commits into from
Nov 19, 2024
Prev Previous commit
Next Next commit
DFPL-5712
  • Loading branch information
Braimah101 committed Nov 18, 2024
commit 5ede90b6a1a0b6aff3b4e08b97163c4fce54cef8
23 changes: 8 additions & 15 deletions playwright-e2e/pages/log-expert-report.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,12 @@ import config from "../settings/test-docs/config";

export class LogExpertReport extends BasePage {
readonly logExpertRerort: Locator;
readonly button: Locator;
readonly Day: Locator;
readonly Month: Locator;
readonly Year: Locator;
readonly dateApproved: Locator;
readonly submitButton: Locator;
readonly radio: Locator;
readonly radioButton: Locator;
readonly addNew: Locator;
readonly typeOfReport: Locator;
readonly saveAndContinue: Locator;

public constructor(page: Page) {
super(page);
Expand All @@ -23,20 +19,17 @@ export class LogExpertReport extends BasePage {
this.Day = page.getByRole('textbox', { name: 'Day' });
this.Month = page.getByRole('textbox', { name: 'Month' });
this.Year = page.getByRole('textbox', { name: 'Year' });
this.radio = page.getByRole('radio', { name: 'No' });
this.submitButton = page.getByRole('button', { name: 'Submit' });
this.saveAndContinue = page.getByRole('button', { name: 'Save and continue' });

this.radioButton = page.getByRole('radio', { name: 'No' });
}

public async logExpertReport() {
await this.addNew.click();
await this.typeOfReport.selectOption('Psychiatric - On child only');
await this.Day.fill('02');
await this.Month.fill('03');
await this.Year.fill('2025');
await this.radio.getByRole('radio', { name: 'No' }).Click();
await this.submitButton.click();
await this.Day.fill('14');
await this.Month.fill('3');
await this.Year.fill('2024');
await this.radioButton.click();
await this.radioButton.click();
await this.clickSubmit();
await this.saveAndContinue.click();
}
};
13 changes: 7 additions & 6 deletions playwright-e2e/pages/start-application.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ export class StartApplication {
readonly otherPeopleInCaseLink: Locator;
readonly returnApplicationLink: Locator;

// readonly logExpertReportLink: Locator;
public constructor(page: Page) {
this.page = page;
this.addApplicationDetailsHeading = page.getByRole("heading", { name: "Add application details", });
Expand All @@ -47,7 +48,7 @@ export class StartApplication {
this.allocationProposalLink = page.getByRole("link", { name: "Allocation proposal", });
this.uploadDocumentsLink = page.getByRole("link", { name: "Upload documents", });
this.addApplicationDocsHeading = page.getByRole("heading", { name: "Add application documents", });
this.upLoadDocsInProgress = page.locator('p').filter({ hasText: 'Upload documents' }).getByRole('img',{name:'Finished'})
this.upLoadDocsInProgress = page.locator('p').filter({ hasText: 'Upload documents' }).getByRole('img', { name: 'Finished' })
this.applicantDetailsLink = page.getByRole('link', { name: 'Applicant\'s details' });
this.respondentsDetailsLink = page.getByRole('link', { name: 'Respondents\' details' });
this.applicantDetailsUpdated = page.locator('p').filter({ hasText: 'Applicant\'s details' }).getByRole('img', { name: 'Information added' });
Expand All @@ -59,9 +60,9 @@ export class StartApplication {
this.internationalElementsHeading = page.getByRole('link', { name: 'International element' });
this.submitApplicationLink = page.getByRole('link', { name: 'Submit application' })
this.otherProceedingsLink = page.getByRole('link', { name: "Other Proceedings", });
this.courtServicesNeeded = page.getByRole('link', { name: 'Court services needed'});
this.otherPeopleInCaseLink = page.getByRole('link', { name: 'Other people in the case'});
this.returnApplicationLink = page.getByRole('link', { name: 'Return application'});
this.courtServicesNeeded = page.getByRole('link', { name: 'Court services needed' });
this.otherPeopleInCaseLink = page.getByRole('link', { name: 'Other people in the case' });
this.returnApplicationLink = page.getByRole('link', { name: 'Return application' });
}
async groundsForTheApplication() {
expect(await this.groundsForTheApplicationLink).toBeVisible();
Expand Down Expand Up @@ -141,12 +142,12 @@ export class StartApplication {
await this.courtServicesNeeded.click();
}

async addOtherPeopleInCase(){
async addOtherPeopleInCase() {
await expect(this.otherPeopleInCaseLink).toBeVisible();
await this.otherPeopleInCaseLink.click();
}

async returnApplication(){
async returnApplication() {
await expect(this.returnApplicationLink).toBeVisible();
await this.returnApplicationLink.click();
}
Expand Down
6 changes: 3 additions & 3 deletions playwright-e2e/settings/user-credentials.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import dotenv from "dotenv";
dotenv.config();

const e2ePw = process.env.E2E_TEST_PASSWORD || '';
const defaultPwd = process.env.SYSTEM_UPDATE_USER_PASSWORD || '';
const judgePwd = process.env.E2E_TEST_JUDGE_PASSWORD || '';
const e2ePw = process.env.E2E_TEST_PASSWORD || 'Password1234';
const defaultPwd = process.env.SYSTEM_UPDATE_USER_PASSWORD || 'Password12';
const judgePwd = process.env.E2E_TEST_JUDGE_PASSWORD || 'Password12';


export const newSwanseaLocalAuthorityUserOne = {
Expand Down
35 changes: 35 additions & 0 deletions playwright-e2e/test-2.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import { test, expect } from '@playwright/test';

test('test', async ({ page }) => {
await page.goto('https://idam-web-public.aat.platform.hmcts.net/login?client_id=xuiwebapp&redirect_uri=https://manage-case.aat.platform.hmcts.net/oauth2/callback&state=z8-W9IJcKWE5dN3Jb1rHm4AJTBqnwyK4LRgWyWWunV0&nonce=xSiwKsnKSXEynsn9g0DONzZ4hiv3iTeJ7dun4ZyMgkk&response_type=code&scope=profile%20openid%20roles%20manage-user%20create-user%20search-user&prompt=');
await page.getByLabel('Email address').click();
await page.getByLabel('Email address').fill('fpl-ctsc-admin@justice.gov.uk');
await page.getByLabel('Password').click();
await page.getByLabel('Password').press('CapsLock');
await page.getByLabel('Password').fill('Password12');
await page.locator('div').filter({ hasText: 'Forgotten password?' }).nth(3).click();
await page.getByRole('button', { name: 'Sign in' }).click();
await page.goto('https://manage-case.aat.platform.hmcts.net/cases');
await page.getByLabel('go to case with Case reference:1730-7334-2785-').click();
await page.getByText('Next step').click();
await expect(page.getByText('Next step')).toBeVisible();
await page.getByLabel('Next step').selectOption('20: Object');
await page.getByRole('button', { name: 'Go' }).click();
await page.getByRole('button', { name: 'Add new' }).click();
await page.getByRole('heading', { name: 'Log expert report' }).click();
await page.locator('h2').filter({ hasText: 'Report' }).click();
await page.locator('h3').click();
await page.getByText('What type of report have you requested? is required').click();
await page.getByLabel('What type of report have you').selectOption('7: psychiatricOnChild');
await page.getByRole('textbox', { name: 'Day' }).click();
await page.getByRole('textbox', { name: 'Day' }).fill('02');
await page.getByRole('textbox', { name: 'Month' }).click();
await page.getByRole('textbox', { name: 'Month' }).fill('03');
await page.getByRole('textbox', { name: 'Year' }).click();
await page.getByRole('textbox', { name: 'Year' }).fill('2025');
await page.getByRole('radio', { name: 'Yes' }).check();
await page.getByRole('group', { name: 'Date approved' }).getByLabel('Day').click();
await page.getByRole('radio', { name: 'No' }).check();
await page.getByRole('button', { name: 'Submit' }).click();
await page.getByRole('button', { name: 'Save and continue' }).click();
});
6 changes: 4 additions & 2 deletions playwright-e2e/tests/log-expert-report.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ test.describe('log expert report', () => {

await logExpertReport.gotoNextStep('Log expert report');
await logExpertReport.logExpertReport();
await expect(page.getByText('Log expert report')).toBeVisible();
})
await logExpertReport.tabNavigation('Expert Reports')
await expect(page.getByText('Report 1')).toBeVisible();
await expect(page.getByText('Psychiatric - On child only')).toBeVisible();
})
});
Loading