feat(homolog): L4a Playwright homolog config + login storageState

This commit is contained in:
Diego Rodrigues de Sa e Souza
2026-07-14 01:04:46 -03:00
parent e566a82184
commit cd23966881
2 changed files with 47 additions and 0 deletions

View File

@@ -0,0 +1,13 @@
import { test as setup, expect } from "@playwright/test";
import { STORAGE_STATE } from "./playwright.config";
// Locators confirmados em src/app/login/page.tsx: <Input type="password"> dentro de um
// <form onSubmit={handleLogin}> com <Button type="submit">{t("continue")}</Button>.
setup("autentica e salva storageState", async ({ page }) => {
await page.goto("/login");
await page.locator('input[type="password"]').fill(process.env.HOMOLOG_ADMIN_PASSWORD!);
await page.locator('button[type="submit"]').click();
await page.waitForURL(/\/dashboard/);
await expect(page).toHaveURL(/dashboard/);
await page.context().storageState({ path: STORAGE_STATE });
});

View File

@@ -0,0 +1,34 @@
import { defineConfig } from "@playwright/test";
import path from "node:path";
import { fileURLToPath } from "node:url";
const HERE = path.dirname(fileURLToPath(import.meta.url));
export const STORAGE_STATE = path.join(HERE, ".auth", "admin.json");
export default defineConfig({
testDir: ".",
timeout: 60_000,
retries: 1,
workers: 4,
reporter: [
["list"],
[
"playwright-ctrf-json-reporter",
{ outputDir: "../../../homolog-report", outputFile: "ui-ctrf.json" },
],
],
use: {
baseURL: process.env.HOMOLOG_BASE_URL || "http://192.168.0.15:20128",
trace: "retain-on-failure",
screenshot: "only-on-failure",
},
projects: [
{ name: "setup", testMatch: /auth\.setup\.ts/ },
{
name: "homolog",
testMatch: /.*\.spec\.ts/,
dependencies: ["setup"],
use: { storageState: STORAGE_STATE },
},
],
});