Skip to content

Commit ab51d61

Browse files
committed
fix(ci): 补齐插件夹具与 UI Smoke 前置条件
让 UI Smoke 在 CI 中检出并加载独立插件仓库,保持本地相邻仓库路径兼容。 修正代理设置用例对默认折叠面板的操作顺序。 验证:管理员默认门禁通过,.NET 337/337;Web 8/8;文档 5/5;语法与构建通过。
1 parent cebb97d commit ab51d61

4 files changed

Lines changed: 23 additions & 3 deletions

File tree

.github/workflows/ci.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,13 @@ jobs:
2121
- name: 检出代码
2222
uses: actions/checkout@v4
2323

24+
- name: 检出官方插件仓库(UI Smoke 夹具)
25+
uses: actions/checkout@v4
26+
with:
27+
repository: FlappiBakuse/NexusPipeline-Plugins
28+
ref: main
29+
path: NexusPipeline-Plugins
30+
2431
- name: 安装 .NET 8 SDK
2532
uses: actions/setup-dotnet@v4
2633
with:

tests/e2e/tests/helpers.mjs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,17 @@ export const baseUrl = "http://127.0.0.1:58731/";
1919
export const JSON_HDR = { "Content-Type": "application/json" };
2020
export const PING_GAME = "C:\\Windows\\System32\\PING.EXE";
2121

22+
/** 测试插件仓库:兼容 CI 工作区子目录、本地相邻仓库和显式路径。 */
23+
export function pluginRepositoryRoot() {
24+
const configured = process.env.NEXUS_PLUGIN_REPO_ROOT?.trim();
25+
const candidates = [
26+
configured ? (path.isAbsolute(configured) ? configured : path.resolve(projectRoot, configured)) : null,
27+
path.join(projectRoot, "NexusPipeline-Plugins"),
28+
path.resolve(projectRoot, "..", "NexusPipeline-Plugins"),
29+
].filter(Boolean);
30+
return candidates.find(candidate => fs.existsSync(path.join(candidate, "catalog.json"))) || candidates[0];
31+
}
32+
2233
let child = null;
2334

2435
export const sleep = ms => new Promise(resolve => setTimeout(resolve, ms));
@@ -45,6 +56,8 @@ export function setupRuntime() {
4556
fs.cpSync(path.join(releaseDir, "wwwroot"), path.join(runtimeDir, "wwwroot"), { recursive: true });
4657
const plugins = path.join(releaseDir, "plugins");
4758
if (fs.existsSync(plugins)) fs.cpSync(plugins, path.join(runtimeDir, "plugins"), { recursive: true });
59+
const repositoryPlugins = path.join(pluginRepositoryRoot(), "plugins");
60+
if (fs.existsSync(repositoryPlugins)) fs.cpSync(repositoryPlugins, path.join(runtimeDir, "plugins"), { recursive: true });
4861

4962
const fixtures = path.join(__dirname, "fixtures");
5063
const adbDir = path.join(runtimeDir, "adb-stub");

tests/e2e/tests/settings-platform.smoke.spec.mjs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ test("插件页面:健康状态以列表形式加载", async ({ page }) => {
3939

4040
test("设置页面:三档代理模式可切换并保存", async ({ page }) => {
4141
await page.goto(baseUrl + "#/settings", { waitUntil: "domcontentloaded" });
42+
await page.locator('[data-action="toggle-settings-panel"][data-panel="network"]').click();
4243
const mode = page.locator("#st-proxy-mode");
4344
await expect(mode).toBeVisible();
4445
await mode.selectOption("none");

tests/e2e/tests/update-stub.mjs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import fs from "node:fs";
44
import path from "node:path";
55
import { createHash } from "node:crypto";
66
import { deriveCandidateVersion, readProjectVersion } from "../../support/project-version.mjs";
7-
import { projectRoot, runtimeDir } from "./helpers.mjs";
7+
import { pluginRepositoryRoot, projectRoot, runtimeDir } from "./helpers.mjs";
88

99
/**
1010
* 更新源 stub(下一候选版本,e2e):以本地 HTTP 服务模拟 GitHub Releases API 兼容源。
@@ -13,7 +13,6 @@ import { projectRoot, runtimeDir } from "./helpers.mjs";
1313
export const UPDATE_PORT = 58931;
1414
export const UPDATE_VERSION = deriveCandidateVersion(readProjectVersion(projectRoot));
1515
export const UPDATE_BASE = `http://127.0.0.1:${UPDATE_PORT}/`;
16-
const pluginRepoRoot = path.resolve(projectRoot, "..", "NexusPipeline-Plugins");
1716

1817
let server = null;
1918
let zipBuffer = null;
@@ -141,7 +140,7 @@ function releasesJson() {
141140
}
142141

143142
function pluginCatalogJson() {
144-
const file = path.join(pluginRepoRoot, "catalog.json");
143+
const file = path.join(pluginRepositoryRoot(), "catalog.json");
145144
return fs.existsSync(file) ? fs.readFileSync(file, "utf8") : JSON.stringify({ schemaVersion: 1, repository: "FlappiBakuse/NexusPipeline-Plugins", generatedAt: new Date().toISOString(), plugins: [] });
146145
}
147146

0 commit comments

Comments
 (0)