Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .env
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ ADMIN_USERNAME=admin@practicesoftwaretesting.com
ADMIN_PASSWORD=welcome01
PLAYWRIGHT_USERNAME=playwrightsolutions@practicesoftwaretesting.com
PLAYWRIGHT_PASSWORD=testyMctesterface!@5
OTP_KEY=NRLJ7DLEAXXACDN3
OTP_KEY=FEKSLHJMZIZ7UEGB

# Required for Currents.dev reporting
# CURRENTS_PROJECT_ID=
Expand Down
45 changes: 45 additions & 0 deletions tests/account/account.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,19 @@ import { test, expect } from "@playwright/test";

test.describe("Customer 01 my account specs", () => {
test.use({ storageState: ".auth/customer01.json" });
test.describe.configure({ mode: "default" });

test.afterEach(async ({ page }) => {
await page.goto("/account/profile");
await page.waitForLoadState("networkidle");
await page.getByTestId("first-name").fill("Jane");
await page.getByTestId("last-name").fill("Doe");
await page.getByTestId("address").fill("101 Testing Way");
await page.getByTestId("update-profile-submit").click();
await expect(
page.getByRole("alert").filter({ hasText: "successfully" })
).toBeVisible();
});

test("validate customer 01 my account page", async ({ page }) => {
await page.goto("/account");
Expand All @@ -16,6 +29,38 @@ test.describe("Customer 01 my account specs", () => {
"Favorites"
);
});

test("update customer 01 account", async ({ page }) => {
await page.goto("account/profile");

await page.waitForLoadState("networkidle");
await page.getByTestId("first-name").fill("Testy");
await page.getByTestId("last-name").fill("McTesterface");
await page.getByTestId("address").fill("101 Testing Way");

await page.getByTestId("update-profile-submit").click();
await expect(
page.getByRole("alert").filter({ hasText: "successfully" })
).toBeVisible();

// Assert the updated name is displayed in the nav menu
await page.reload();
expect(await page.getByTestId("nav-menu").innerText()).toContain(
"Testy McTesterface"
);

await expect(page.getByTestId("first-name")).toHaveValue("Testy");
await expect(page.getByTestId("last-name")).toHaveValue("McTesterface");
await expect(page.getByTestId("address")).toHaveValue("101 Testing Way");
});

test("validate customer 01 account other", async ({ page }) => {
await page.goto("/account");

expect(await page.getByTestId("nav-menu").innerText()).toContain(
"Jane Doe"
);
});
});

test.describe("Customer 02 my account specs", () => {
Expand Down