From 3f96c9c6502243b06efd4bb34a189e72e3a5557c Mon Sep 17 00:00:00 2001
From: yearning <10538594+wangweifeng1999@user.noreply.gitee.com>
Date: 星期一, 28 九月 2026 19:24:55 +0800
Subject: [PATCH] 复制项目
---
frontend/e2e/scores.spec.ts | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 58 insertions(+), 0 deletions(-)
diff --git a/frontend/e2e/scores.spec.ts b/frontend/e2e/scores.spec.ts
new file mode 100644
index 0000000..2d90481
--- /dev/null
+++ b/frontend/e2e/scores.spec.ts
@@ -0,0 +1,58 @@
+import { test, expect } from "@playwright/test";
+
+const BASE = process.env.E2E_BASE_URL || "https://grader.gps120.com";
+const USER = process.env.E2E_USER || "admin";
+const PASS = process.env.E2E_PASS || "admin123";
+
+async function login(page: import("@playwright/test").Page) {
+ await page.getByLabel("璐﹀彿").fill(USER);
+ await page.getByLabel("瀵嗙爜").fill(PASS);
+ await page.locator("button.ant-btn-primary").click();
+ await expect(page).toHaveURL(/\/scores/, { timeout: 15_000 });
+}
+
+test.describe("鑰冭瘯闃呭嵎绯荤粺 E2E", () => {
+ test("鐧诲綍椤靛彲姝e父鎵撳紑骞舵樉绀虹櫥褰曡〃鍗�", async ({ page }) => {
+ const errors: string[] = [];
+ page.on("pageerror", (e) => errors.push(e.message));
+
+ await page.goto(`${BASE}/login`, { waitUntil: "domcontentloaded" });
+ await expect(page.locator(".ant-card").filter({ hasText: "鐧诲綍" })).toBeVisible({ timeout: 30_000 });
+ await expect(page.getByLabel("璐﹀彿")).toBeVisible();
+ await expect(page.getByLabel("瀵嗙爜")).toBeVisible();
+ expect(errors).toEqual([]);
+ });
+
+ test("鏈櫥褰曡闂� /scores 浼氳繘鍏ョ櫥褰曞苟鎴愬姛鏌ヨ鎴愮哗涓庣瓟鍗疯鎯�", async ({ page }) => {
+ await page.goto(`${BASE}/scores`, { waitUntil: "domcontentloaded" });
+ await expect(page.locator(".ant-card").filter({ hasText: "鐧诲綍" })).toBeVisible({ timeout: 30_000 });
+ await login(page);
+
+ await expect(page.locator(".app-breadcrumb").getByText("鎴愮哗鏌ヨ")).toBeVisible();
+ const table = page.locator(".ant-table");
+ await expect(table).toBeVisible({ timeout: 15_000 });
+ const dataRow = page.locator("tr[data-row-key]").first();
+ await expect(dataRow).toBeVisible({ timeout: 15_000 });
+
+ await dataRow.getByRole("button", { name: /鏌s*鐪�/ }).click();
+ await expect(page).toHaveURL(/\/attempts\/\d+/, { timeout: 15_000 });
+ await expect(page.locator('aside[aria-label="棰樼洰绱㈠紩"]')).toBeVisible({ timeout: 30_000 });
+ });
+
+ test("绠$悊鍛樺彲璁块棶鏁版嵁瀵煎叆銆佽�冭瘎鍛樸�佺郴缁熻缃�", async ({ page }) => {
+ await page.goto(`${BASE}/login`, { waitUntil: "domcontentloaded" });
+ await login(page);
+
+ await page.getByRole("menuitem", { name: "鏁版嵁瀵煎叆" }).click();
+ await expect(page).toHaveURL(/\/admin\/import/);
+ await expect(page.locator(".ant-card").filter({ hasText: "瀵煎叆鏁版嵁" })).toBeVisible();
+
+ await page.getByRole("menuitem", { name: "鑰冭瘎鍛樼鐞�" }).click();
+ await expect(page).toHaveURL(/\/admin\/graders/);
+ await expect(page.locator(".ant-card").filter({ hasText: "鑰冭瘎鍛樼鐞�" })).toBeVisible();
+
+ await page.getByRole("menuitem", { name: "绯荤粺璁剧疆" }).click();
+ await expect(page).toHaveURL(/\/admin\/settings/);
+ await expect(page.locator(".ant-card").filter({ hasText: "绯荤粺璁剧疆" })).toBeVisible();
+ });
+});
--
Gitblit v1.8.0