From f90f36246ab21925eb80ba34bb7d4222b5279101 Mon Sep 17 00:00:00 2001 From: Butch Mayhew Date: Fri, 17 Jan 2025 23:18:20 -0600 Subject: [PATCH] updating test to work in default config mode (sequentually) --- .env | 2 +- tests/account/account.spec.ts | 45 +++++++++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+), 1 deletion(-) diff --git a/.env b/.env index e6753a5..d0f24d0 100644 --- a/.env +++ b/.env @@ -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= diff --git a/tests/account/account.spec.ts b/tests/account/account.spec.ts index d81c6cd..7161c0d 100644 --- a/tests/account/account.spec.ts +++ b/tests/account/account.spec.ts @@ -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"); @@ -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", () => {