R7E 无人工操作自动化证据回填
这个提交包含在:
@@ -1,6 +1,6 @@
|
||||
import { expect, type Page } from "@playwright/test";
|
||||
|
||||
import { createAuthenticatedApiClient, logout, type AuthenticatedApiClient, type E2EUser } from "./auth";
|
||||
import { createAuthenticatedApiClient, createAuthenticatedBrowserStorageState, logout, type AuthenticatedApiClient, type E2EUser } from "./auth";
|
||||
|
||||
export type LiveSmokeRole = "admin" | "employee" | "manager" | "finance" | "financeMgr";
|
||||
|
||||
@@ -19,6 +19,11 @@ function requireEnv(key: string) {
|
||||
return value;
|
||||
}
|
||||
|
||||
function liveUrl(pathname: string) {
|
||||
const baseURL = process.env.LIVE_SMOKE_BASE_URL?.trim();
|
||||
return baseURL ? new URL(pathname, baseURL).toString() : pathname;
|
||||
}
|
||||
|
||||
export function getExpectedWecomStatus() {
|
||||
return process.env.LIVE_EXPECT_WECOM_STATUS?.trim() || "disabled";
|
||||
}
|
||||
@@ -68,7 +73,7 @@ async function readCurrentUserName(page: Page): Promise<string> {
|
||||
export async function loginLiveUser(page: Page, role: LiveSmokeRole): Promise<LiveSmokeUser> {
|
||||
const credentials = getLiveSmokeUser(role);
|
||||
|
||||
await page.goto("/login");
|
||||
await page.goto(liveUrl("/login"));
|
||||
await expect(page.getByTestId("login-identifier")).toBeVisible();
|
||||
await page.getByTestId("login-identifier").fill(credentials.identifier);
|
||||
await page.getByTestId("login-password").fill(credentials.password);
|
||||
@@ -112,3 +117,8 @@ export async function createLiveApiClient(role: LiveSmokeRole): Promise<Authenti
|
||||
const baseURL = process.env.LIVE_SMOKE_BASE_URL?.trim() || "https://oa.hyinda.com";
|
||||
return createAuthenticatedApiClient(getRequiredLiveUser(role), baseURL);
|
||||
}
|
||||
|
||||
export async function createLiveBrowserStorageState(role: LiveSmokeRole) {
|
||||
const baseURL = process.env.LIVE_SMOKE_BASE_URL?.trim() || "https://oa.hyinda.com";
|
||||
return createAuthenticatedBrowserStorageState(getRequiredLiveUser(role), baseURL);
|
||||
}
|
||||
|
||||
在新工单中引用
屏蔽一个用户