mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-08-17 20:52:15 +03:00
feat(homolog): L4a Playwright homolog config + login storageState
This commit is contained in:
13
tests/homolog/ui/auth.setup.ts
Normal file
13
tests/homolog/ui/auth.setup.ts
Normal 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 });
|
||||
});
|
||||
34
tests/homolog/ui/playwright.config.ts
Normal file
34
tests/homolog/ui/playwright.config.ts
Normal 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 },
|
||||
},
|
||||
],
|
||||
});
|
||||
Reference in New Issue
Block a user