Skip to content

Commit

Permalink
Si 178 report creation (#1561)
Browse files Browse the repository at this point in the history
* configuring reports

* fix conflicts

* updates to test

* remove wip logger feature

---------

Co-authored-by: gokul-sol <gokul.sridharan@HMCTS.NET>
  • Loading branch information
gokul-sol and gokul-sol committed Apr 29, 2024
1 parent ba89b35 commit f38cb5c
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 16 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,4 @@ Change History.json
e2e-tests/node_modules
sscs-ccd-e2e-tests/
dist/
playwright-report/
2 changes: 1 addition & 1 deletion functional-test/config/playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ module.exports = defineConfig({

/* Opt out of parallel tests on CI. */
workers: process.env.FUNCTIONAL_TESTS_WORKERS ? 5 : undefined,
reporter: process.env.CI ? "html" : "list",
reporter: [[process.env.CI ? "html" : "list", { outputDir: '../playwright-report/', open: 'never' }]],
use: {
baseURL: urls.xuiUrl,
trace: "on-first-retry",
Expand Down
2 changes: 1 addition & 1 deletion functional-test/lib/webActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export class WebActions {
}

async clickButton(elementLocator: string): Promise<void> {
await this.page.click(elementLocator);
await this.page.getByRole('button', { name: elementLocator}).click();
}

async clickNextStepButton(elementId: string): Promise<void> {
Expand Down
5 changes: 2 additions & 3 deletions functional-test/pages/addNotePage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ let webActions: WebActions;
export class AddNotePage {

readonly page: Page;
readonly textDetailsField: Locator;
readonly textDetailsField: string;
readonly submitButton: Locator;


Expand All @@ -16,7 +16,6 @@ export class AddNotePage {
this.submitButton = page.getByRole('button', {name: 'Submit'});*/

webActions = new WebActions(this.page);

}

async verifyPageContent() {
Expand All @@ -31,7 +30,7 @@ x
}

async confirmSubmission(): Promise<void> {
await webActions.clickButton('[type=\'submit\']');
await webActions.clickButton('Submit');
}

}
20 changes: 11 additions & 9 deletions functional-test/pages/loginPage.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,23 @@
import { expect, Locator, Page } from '@playwright/test';
import {credentials} from '../config/config';
import { credentials } from '../config/config';
import { WebActions } from '../lib/webActions'

let webActions: WebActions;

export class LoginPage {

readonly page: Page;
readonly userName: Locator;
readonly passWord: Locator;
readonly userName: string;
readonly passWord: string;
readonly loginBtn: Locator;
readonly pageTitle: Locator;

constructor(page: Page) {
this.page = page;
this.userName = page.locator('#username');
this.passWord = page.locator('#password');
this.loginBtn = page.getByRole('button', {name: 'Sign in'});
this.pageTitle = page.locator('h1');

webActions = new WebActions(this.page);

}

async goToLoginPage(): Promise<void> {
Expand All @@ -27,9 +29,9 @@ export class LoginPage {
}

async verifySuccessfulLoginForCaseworker(expTitle: string): Promise<void> {
await this.userName.fill(credentials.caseWorker.email);
await this.passWord.fill(credentials.caseWorker.password);
await this.loginBtn.click();
await webActions.inputField('#username', credentials.caseWorker.email);
await webActions.inputField('#password', credentials.caseWorker.password);
await webActions.clickButton('Sign in');
await expect(this.pageTitle).toHaveText(expTitle);
}
}
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
"test:preview": "echo preview test infra is wip",
"test:aat": "cd sscs-ccd-e2e-tests && yarn install && yarn test:fullfunctional",
"test:functional": "ENVIRONMENT=${ENVIRONMENT} ./bin/run-functional-tests.sh",
"test:functional-headless": "yarn playwright install && npx playwright test --config functional-test/config/playwright.config.ts --project chromium",
"test:functional-head": "yarn playwright install && npx playwright test --config functional-test/config/playwright.config.ts --project chromium --headed",
"test:functional-headless": "yarn playwright install && npx playwright test --config functional-test/config/playwright.config.ts --project chromium --reporter=html",
"test:functional-head": "yarn playwright install && npx playwright test --config functional-test/config/playwright.config.ts --project chromium --headed --reporter=html",
"start": "node index.js",
"test:coverage": "echo test:coverage",
"test:a11y": "echo test:a11y",
Expand Down

0 comments on commit f38cb5c

Please sign in to comment.