Skip to content

armgit / fuobe

Public Imported from GitHub
0

The open creative studio on ComfyUI: images, video, 3D and audio on open weights, on your own GPU or the cloud. Camera motions, effects, apps, Cinema, Layers, Image to 3D and an AI agent.

Your keys: two older tests follow the new rules, and the end-to-end check's screenshots

Adarshb4db2139026b
diff --git a/tests/e2e/byo-keys.mjs b/tests/e2e/byo-keys.mjs
index 734d2f1f..8298dc3f 100644
--- a/tests/e2e/byo-keys.mjs
+++ b/tests/e2e/byo-keys.mjs
@@ -83,6 +83,11 @@ const api = async (route, { method = "GET", body, cookie } = {}) => {
};
const cookieOf = (res) => /fuobe_session=[^;]+/.exec(res.headers.get("set-cookie") ?? "")?.[0];
const readable = [];
+/** Settings → Your keys alone, scrolled into view. */
+const shootKeys = async (page, name) => {
+ await page.waitForTimeout(400);
+ await page.locator("#your-keys").screenshot({ path: path.join(shots, name) });
+};
try {
// The server is up (first compile can take a while).
@@ -138,19 +143,18 @@ try {
// Settings → Your keys: a bad key, then a good one.
await page.goto("/settings#your-keys", { waitUntil: "load", timeout: 180_000 });
await page.getByRole("heading", { name: "Your keys" }).waitFor({ timeout: 60_000 });
- await page.screenshot({ path: path.join(shots, "your-keys-empty-desktop.png"), fullPage: false });
+ await shootKeys(page, "your-keys-empty-desktop.png");
const falField = page.getByLabel("fal.ai API key");
await falField.fill(BAD_FAL);
await page.getByRole("button", { name: "Check and save" }).first().click();
await page.getByText("fal.ai didn't accept this key").waitFor({ timeout: 30_000 });
check(true, "a bad key is refused with plain words");
- await page.screenshot({ path: path.join(shots, "your-keys-refused-desktop.png") });
+ await shootKeys(page, "your-keys-refused-desktop.png");
await falField.fill(ACCT_FAL);
await page.getByRole("button", { name: "Check and save" }).first().click();
await page.getByText("Key ending in").waitFor({ timeout: 30_000 });
check((await page.content()).includes("9f3a"), "a good key is saved and shown by its last 4 characters");
- await page.waitForTimeout(800);
- await page.screenshot({ path: path.join(shots, "your-keys-saved-desktop.png") });
+ await shootKeys(page, "your-keys-saved-desktop.png");
readable.push(await page.content());
// The Image studio again: the switch opens, the picker dims Replicate-only models, the price says who pays.
@@ -173,6 +177,7 @@ try {
await page.getByText("Add your Replicate key").first().click();
await page.getByRole("dialog").getByText("Add your Replicate key").waitFor({ timeout: 10_000 });
check(true, "choosing a dimmed model opens Add your Replicate key");
+ await page.waitForTimeout(700);
await page.screenshot({ path: path.join(shots, "add-key-dialog-desktop.png") });
await page.keyboard.press("Escape");
readable.push(await page.content());
@@ -206,7 +211,7 @@ try {
await page.getByRole("button", { name: "Remove", exact: true }).first().click();
await page.getByRole("button", { name: "Remove key" }).click();
await page.getByText(/run is using this key now/).waitFor({ timeout: 20_000 });
- await page.screenshot({ path: path.join(shots, "your-keys-runs-going-desktop.png") });
+ await shootKeys(page, "your-keys-runs-going-desktop.png");
await page.getByRole("button", { name: "Stop runs and remove" }).click();
await page.getByText("Your fal.ai key is removed from this studio.").waitFor({ timeout: 20_000 });
const cancel = fal.log.find((r) => r.path.endsWith("/cancel"));
@@ -219,8 +224,7 @@ try {
const p2 = await phone.newPage();
await p2.goto("/settings#your-keys", { waitUntil: "load", timeout: 180_000 });
await p2.getByRole("heading", { name: "Your keys" }).waitFor({ timeout: 60_000 });
- await p2.waitForTimeout(800);
- await p2.screenshot({ path: path.join(shots, "your-keys-phone.png"), fullPage: true });
+ await shootKeys(p2, "your-keys-phone.png");
const sideways = await p2.evaluate(() => document.documentElement.scrollWidth - document.documentElement.clientWidth);
check(sideways <= 0, `no sideways scroll on a phone (${sideways}px)`);
diff --git a/tests/settings-links.test.ts b/tests/settings-links.test.ts
index f65e1f22..aa911f90 100644
--- a/tests/settings-links.test.ts
+++ b/tests/settings-links.test.ts
@@ -8,7 +8,7 @@ const root = path.join(__dirname, "../src");
const files = (d: string): string[] => fs.readdirSync(d, { withFileTypes: true }).flatMap((e) => (e.isDirectory() ? files(path.join(d, e.name)) : /\.tsx?$/.test(e.name) ? [path.join(d, e.name)] : []));
const form = fs.readFileSync(path.join(root, "components/settings-form.tsx"), "utf8");
/** The anchors Settings has: its sections' and fields' ids (id="…", or a Section's id prop on its own line), the form's and the sections around it. */
-const page = [form, ...["components/gpu/account-gpu-section.tsx", "components/owner-settings.tsx", "components/accounts-admin.tsx"].map((f) => fs.readFileSync(path.join(root, f), "utf8"))].join("\n");
+const page = [form, ...["components/gpu/account-gpu-section.tsx", "components/keys/your-keys.tsx", "components/owner-settings.tsx", "components/accounts-admin.tsx"].map((f) => fs.readFileSync(path.join(root, f), "utf8"))].join("\n");
const anchors = new Set([...page.matchAll(/\bid="([a-z0-9-]+)"/g)].map((m) => m[1]));
describe("Settings deep links", () => {
@@ -20,7 +20,8 @@ describe("Settings deep links", () => {
it("every \"Settings → …\" the app tells people names a section or field Settings has", () => {
// Section titles ("Prompt enhancement · Claude or Ollama": the whole, or either side of the "·") and field labels.
- const titles = [...page.matchAll(/\btitle="([^"]+)"/g)].map((m) => m[1]);
+ // (An account's own sections, Your GPU and Your keys, are titled by their heading.)
+ const titles = [...page.matchAll(/\btitle="([^"]+)"/g), ...page.matchAll(/<h2\b[^>]*>\s*([^<{]+?)\s*<\/h2>/g)].map((m) => m[1]);
const labels = [...page.matchAll(/\blabel="([^"]+)"/g)].map((m) => m[1]);
const norm = (x: string) => x.replace(/&amp;/g, "&").replace(/\s*·\s*/g, " ").toLowerCase();
const names = [...titles, ...titles.flatMap((t) => t.split("·").map((x) => x.trim())), ...labels].map(norm);
diff --git a/tests/training-runtime.test.ts b/tests/training-runtime.test.ts
index 58333619..520c8547 100644
--- a/tests/training-runtime.test.ts
+++ b/tests/training-runtime.test.ts
@@ -25,8 +25,11 @@ beforeAll(async () => {
base = `http://127.0.0.1:${(server.address() as { port: number }).port}`;
setSetting("falKey", "test-key");
setSetting("aiToolkitUrl", base);
+ // The stand-in answers as fal.ai: a fal.ai key is sent only to fal.ai's own hosts (provider-keys.ts standIn).
+ globalThis.__fuobeTestFalUrl = base;
});
afterAll(() => {
+ globalThis.__fuobeTestFalUrl = undefined;
server.close();
fs.rmSync(dir, { recursive: true, force: true });
});