Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 0 additions & 55 deletions apps/web/e2e/ai-review.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,61 +76,6 @@ test("an opted-in project's model auto-passes a noise-only shot and says why", a
await expect(page.locator('rect[data-ai-label="noise"]').first()).toBeAttached();
});

test("a build with 10 changed shots gets no summary, says why, and offers no Regenerate", async ({
page,
}) => {
const { token, projectId } = await provision(page, "Big Co", "bigbuild");
const form = page.getByTestId("model-settings");
await form.getByTestId("model-base-url").fill(`${STUB}/v1`);
await form.getByTestId("model-name").fill("deepseek-flash");
await form.getByTestId("model-key").fill("sk-e2e-model");
await form.getByTestId("model-save").click();
await expect(form.getByTestId("model-key-set")).toBeVisible();

const names = Array.from({ length: 10 }, (_, i) => `page-${i}`);
await uploadBuild(
token,
{ branch: "main", commitSha: SHA_MAIN },
names.map((name) => ({ name, png: WHITE })),
);
await page.waitForTimeout(1100);
const buildId = await uploadBuild(
token,
{ branch: "work", commitSha: SHA_WORK, mergeBaseSha: SHA_MAIN, ancestorShas: [SHA_MAIN] },
names.map((name) => ({ name, png: CHANGED })),
);
await open(page, `/projects/${projectId}/builds/${buildId}`);
await explained(page);
const summary = page.getByTestId("build-summary");
await expect(summary.getByTestId("summary-too-many")).toHaveText(
"No AI summary: 10 changed shots (summaries are made for builds with fewer than 10).",
);
await expect(summary.getByTestId("summary-skip")).toHaveCount(0);
await expect(summary.getByTestId("summary-sentence")).toHaveCount(0);
await expect(summary.getByTestId("summary-regenerate")).toHaveCount(0);
});

test("with no model a changed shot is reviewed as plain pixels", async ({ page }) => {
const { token, projectId } = await provision(page, "Plain Co", "plain");
await uploadBuild(token, { branch: "main", commitSha: SHA_MAIN }, [{ name: "hero", png: WHITE }]);
await page.waitForTimeout(1100);
const buildId = await uploadBuild(
token,
{ branch: "work", commitSha: SHA_WORK, mergeBaseSha: SHA_MAIN, ancestorShas: [SHA_MAIN] },
[{ name: "hero", png: CHANGED }],
);
await open(page, `/projects/${projectId}/builds/${buildId}`);
await expect(page.getByTestId("build-status")).toHaveText("changes");
await expect(page.getByTestId("group-ai-filtered")).toHaveCount(0);
// No model: the summary says so and offers nothing to regenerate; it never invents one.
await expect(page.getByTestId("summary-skip")).toHaveText("skip: no judge.");
await expect(page.getByTestId("summary-sentence")).toHaveCount(0);
await expect(page.getByTestId("summary-regenerate")).toHaveCount(0);
await page.getByTestId("snapshot-row").getByRole("link").click();
await showPanel(page);
await expect(page.getByTestId("ai-skip")).toHaveText("skip: no judge. Review the pixels.");
});

/**
* The org's model (ob 1789): set once in the org's settings, a project reports that it uses it, its
* builds are explained by it, and a project's own model overrides it until it is removed.
Expand Down
20 changes: 2 additions & 18 deletions apps/web/e2e/api-upload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,6 @@ export type Shot = {
name: string;
png: Buffer;
flaky?: "review" | "skip";
/** The shot's composition findings, sent as the CLI sends them (ob 1850). */
composition?: object;
/** Fields of the CLI's meta that replace the web defaults (a native shot's platform and device, a theme). */
meta?: Record<string, unknown>;
/** A layout metrics file (PS-296), sent as the CLI sends `--metrics`. */
metrics?: string;
};

/** The CLI's form for one shot; a flaky one carries its record and runs 2 and 3, run 2 differing. */
Expand All @@ -64,8 +58,6 @@ function shotForm(shot: Shot): FormData {
tags: ["web"],
fingerprint: { image: "version:e2e", browser: "chromium 1", fonts: "sha256:f" },
};
Object.assign(meta, shot.meta);
if (shot.composition) meta["composition"] = shot.composition;
if (shot.flaky) {
meta["flaky"] = shot.flaky;
meta["flake"] = {
Expand All @@ -80,19 +72,11 @@ function shotForm(shot: Shot): FormData {
}
form.set("meta", JSON.stringify(meta));
form.set("file", pngBlob(shot.png), "shot.png");
if (shot.metrics !== undefined)
form.set("metrics", new Blob([shot.metrics], { type: "application/json" }), "metrics.json");
return form;
}

/** Open a build, put each shot, finalise: the server diffs in the finalise request. */
export async function uploadBuild(
token: string,
build: object,
shots: Shot[],
/** More of the finalise body, such as the CLI's `timings`. */
finalise: object = {},
) {
export async function uploadBuild(token: string, build: object, shots: Shot[]) {
const headers = { authorization: `Bearer ${token}` };
const opened = await fetch(`${SERVER}/api/v1/builds`, {
method: "POST",
Expand All @@ -112,7 +96,7 @@ export async function uploadBuild(
const done = await fetch(`${SERVER}/api/v1/builds/${id}/finalize`, {
method: "POST",
headers: { ...headers, "content-type": "application/json" },
body: JSON.stringify({ snapshots: shots.length, ...finalise }),
body: JSON.stringify({ snapshots: shots.length }),
});
expect(done.status).toBe(200);
return id;
Expand Down
93 changes: 0 additions & 93 deletions apps/web/e2e/brief.spec.ts

This file was deleted.

64 changes: 0 additions & 64 deletions apps/web/e2e/carried-from-main.spec.ts

This file was deleted.

114 changes: 0 additions & 114 deletions apps/web/e2e/composition.spec.ts

This file was deleted.

Loading
Loading