Skip to content

Commit

Permalink
Task/dr 1118 testcase for mylocations (#163)
Browse files Browse the repository at this point in the history
* DR-1118 Test mylocations page

* DR-1118 Test mylocations pageformats

* DR-1118 Review comments updated

* DR-1118 Review comments updated0.1

* DR-1118 Location page updated

* DR-1118 Location page cleared

* DR-1118 Location page updated

* DR-1118 Location page lineremoved

* DR-1118 New branch created

---------

Co-authored-by: Vikram Boinapalli <v.boinapalli@kainos.com>
Co-authored-by: -NHSE <+VIB05-NHSE@users.noreply.github.com>
  • Loading branch information
3 people authored Oct 1, 2024
1 parent 4069f8e commit 4175ea8
Show file tree
Hide file tree
Showing 4 changed files with 80 additions and 1 deletion.
2 changes: 1 addition & 1 deletion tests/ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"test:debug": "npx cross-env test_env=dev npx playwright test --debug",
"test:test_env": "npx cross-env test_env=dev playwright test",
"test:tagged": "npx cross-env test_env=dev playwright test --grep @Test ",
"test_pipeline": "npx playwright test",
"test_pipeline": "npx playwright test --grep-invert @prototype",
"allure": "allure generate --single-file -c -o allure-reports",
"filecount": "npx ts-node ./utilities/fileCount.ts",
"axe_report": "cat ./accessibility-reports/artifacts/*.html >> ./accessibility-reports/artifacts/FinalAccessibilityReport.html"
Expand Down
17 changes: 17 additions & 0 deletions tests/ui/src/pages/base-page.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { Locator, Page } from "@playwright/test";
export default class BasePage {
constructor(readonly page: Page) {
this.page = page;
}

static readonly userId_txt = "User ID";
static readonly password_txt = "password";
static readonly continue_btn = "Continue";

//methods
async login() {
await this.page.getByLabel(BasePage.userId_txt).fill("username");
await this.page.getByLabel(BasePage.password_txt).fill("password");
await this.page.getByRole("button", { name: "Continue" }).click();
}
}
23 changes: 23 additions & 0 deletions tests/ui/src/pages/view-locations-page.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { Locator, Page } from "@playwright/test";
export default class ViewLocationsPage {
constructor(readonly page: Page) {
this.page = page;
}

static readonly myLocations_lbl = "My locations";
static readonly reports_lbl = "Reports";
static readonly downloadReport_btn = "Continue";

// Getters
getMyLocationsLabel(): Locator {
return this.page.getByRole("heading", { name: "My locations" });
}

getReportsLabel(): Locator {
return this.page.getByRole("heading", { name: "Reports" });
}

getDownloadReportButton(): Locator {
return this.page.getByRole("button", { name: "Download Report" });
}
}
39 changes: 39 additions & 0 deletions tests/ui/test/specs/view-locations.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import { test, expect } from "@playwright/test";
import { allure } from "allure-playwright";
import ViewLocationsPage from "../../src/pages/view-locations-page";
import BasePage from "../../src/pages/base-page";

let viewLcPage: ViewLocationsPage;
let basePage: BasePage;
let pageTitle: string = "UEC Capacity Management";

test.describe("As a user I want to be able to view the locations", () => {
test.beforeEach(async ({ page }, testInfo) => {
await allure.parentSuite(testInfo.project.name);
await allure.suite("Tests for view locations journeys");
await allure.subSuite("Tests for locations landing page");
viewLcPage = new ViewLocationsPage(page);
basePage = new BasePage(page);
await test.step("Navigate to landing page", async () => {
await page.goto("/prototype");
await test.step("Enter user name and password", async () => {
await basePage.login();
});
await test.step("Verify Title of the page", async () => {
await expect(page).toHaveTitle(pageTitle);
});
});
});
//test my location page
test("My locations page is presented correctly", { tag: ["@prototype"] }, async () => {
await test.step(" My locations label is visible", async () => {
await expect.soft(viewLcPage.getMyLocationsLabel()).toHaveText("My locations");
});
await test.step(" The Reports section is visible", async () => {
await expect(viewLcPage.getReportsLabel()).toBeVisible();
});
await test.step(" The Download Report button is visible", async () => {
await expect(viewLcPage.getDownloadReportButton()).toBeVisible();
});
});
});

0 comments on commit 4175ea8

Please sign in to comment.