feat: define SuperAPI binding-level skill forcing
This commit is contained in:
@@ -262,13 +262,34 @@ export default async function superApiManagementSmoke({ page, goto, wait, screen
|
||||
width: Math.round(rect.width),
|
||||
};
|
||||
});
|
||||
const bindingControls = await dialog.locator(".binding-row").evaluateAll((rows) =>
|
||||
rows.map((row) => {
|
||||
const inputs = Array.from(row.querySelectorAll("input[type='checkbox']"));
|
||||
const enabled = inputs.find((input) => input.getAttribute("aria-label")?.startsWith("启用 "));
|
||||
const force = inputs.find((input) => input.getAttribute("aria-label")?.startsWith("强制注入 "));
|
||||
return {
|
||||
enabledControl: enabled !== undefined,
|
||||
forceControl: force !== undefined,
|
||||
forceDisabled: force instanceof HTMLInputElement ? force.disabled : null,
|
||||
};
|
||||
}));
|
||||
const bindingControlsOk = bindingControls.every((row) =>
|
||||
row.enabledControl && row.forceControl);
|
||||
const ok = bindingEvidence.placeholder === "请选择要绑定的 Skill"
|
||||
&& bindingEvidence.visible
|
||||
&& bindingEvidence.width >= 240;
|
||||
&& bindingEvidence.width >= 240
|
||||
&& bindingControlsOk;
|
||||
if (!ok) addFailure("API Key Skill 下拉框占位符或布局不完整");
|
||||
const interactionShot = await screenshot("superapi-api-key-bindings.png");
|
||||
screenshots.push(interactionShot);
|
||||
interactions.push({ id: item.interaction, ok, ...bindingEvidence, screenshot: interactionShot });
|
||||
interactions.push({
|
||||
id: item.interaction,
|
||||
ok,
|
||||
...bindingEvidence,
|
||||
bindingControls,
|
||||
bindingControlsOk,
|
||||
screenshot: interactionShot,
|
||||
});
|
||||
await dialog.getByLabel("关闭", { exact: true }).click();
|
||||
if (config.actor === "admin") {
|
||||
await page.getByRole("button", { name: "注册 API Key", exact: true }).click();
|
||||
|
||||
Reference in New Issue
Block a user