From 3f2c7c1d4aefda343573d1ebda63efc9575d5bd3 Mon Sep 17 00:00:00 2001 From: Daniel Heras Quesada Date: Tue, 16 Sep 2025 20:07:11 +0200 Subject: [PATCH] feat: login e2e spec improved by testing login --- e2e-testing-playwright/playwright.config.ts | 4 ++-- e2e-testing-playwright/tests/login.spec.ts | 11 +++++++++++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/e2e-testing-playwright/playwright.config.ts b/e2e-testing-playwright/playwright.config.ts index 41f021c..f1478d7 100644 --- a/e2e-testing-playwright/playwright.config.ts +++ b/e2e-testing-playwright/playwright.config.ts @@ -72,8 +72,8 @@ export default defineConfig({ /* Run your local dev server before starting the tests */ webServer: { - command: 'cd .. && docker-compose up -d', - // command: 'cd ../front && npm run dev', + // command: 'cd .. && docker-compose up -d', + command: 'cd ../front && npm run dev', url: 'http://localhost:3016', reuseExistingServer: !process.env.CI, }, diff --git a/e2e-testing-playwright/tests/login.spec.ts b/e2e-testing-playwright/tests/login.spec.ts index 1c46f95..0f1e7da 100644 --- a/e2e-testing-playwright/tests/login.spec.ts +++ b/e2e-testing-playwright/tests/login.spec.ts @@ -28,4 +28,15 @@ describe("Login form", () => { await expect(page.getByText(/^Wrong credentials.*$/)).toBeVisible(); }) + + test("log in redirects to another page if credentials are correct", async ({ page }) => { + await page.goto('http://localhost:3016/'); + await page.getByRole("textbox", { name: "username" }).fill("dqnid"); + await page.getByRole("textbox", { name: "password" }).fill("1234"); + + const button_element = page.getByRole("button", { name: /Log-in/ }) + button_element.click(); + + await expect(page.getByAltText("Main logo")).toBeVisible(); + }) });