Browse Source

E2E_PASS default password 11111

visuddhinanda 1 week ago
parent
commit
bd3894e8fa
1 changed files with 13 additions and 10 deletions
  1. 13 10
      dashboard-test/src/tests/auth.setup.ts

+ 13 - 10
dashboard-test/src/tests/auth.setup.ts

@@ -1,21 +1,24 @@
-import { test as setup, expect } from '@playwright/test';
-import path from 'node:path';
-import { fileURLToPath } from 'node:url';
+import { test as setup, expect } from "@playwright/test";
+import path from "node:path";
+import { fileURLToPath } from "node:url";
 
 const __dirname = path.dirname(fileURLToPath(import.meta.url));
-export const AUTH_FILE = path.join(__dirname, '../../playwright/.auth/user.json');
+export const AUTH_FILE = path.join(
+  __dirname,
+  "../../playwright/.auth/user.json",
+);
 
-const USER = process.env.E2E_USER ?? 'test161';
-const PASS = process.env.E2E_PASS ?? '12345';
+const USER = process.env.E2E_USER ?? "test161";
+const PASS = process.env.E2E_PASS ?? "11111";
 
-setup('登录并保存会话', async ({ page }) => {
-  await page.goto('anonymous/sign-in');
+setup("登录并保存会话", async ({ page }) => {
+  await page.goto("anonymous/sign-in");
 
   // ProForm 会渲染隐藏 input,必须用 :visible 过滤
-  const inputs = page.locator('form input:visible');
+  const inputs = page.locator("form input:visible");
   await inputs.nth(0).fill(USER);
   await inputs.nth(1).fill(PASS);
-  await page.getByRole('button', { name: /提 *交/ }).click();
+  await page.getByRole("button", { name: /提 *交/ }).click();
 
   // 登录成功会跳离 sign-in
   await expect(page).not.toHaveURL(/sign-in/, { timeout: 20_000 });