fix(studio): recover uncertain imports with persistent request identities
This commit is contained in:
1 parent
afea80708c
commit
c977fe95ba
12 files changed
+365
-31
No files matched your search
@@ -143,3 +143,46 @@ test("history shows the current phase and validated recovery source", async ({
|
||||
),
|
||||
).toBe(false);
|
||||
});
|
||||
|
||||
test("uncertain import submissions keep their identity after a page reload", async ({
|
||||
page,
|
||||
}) => {
|
||||
const ids: string[] = [];
|
||||
await page.route("**/api/admin/csrf", (route) =>
|
||||
route.fulfill({ json: { token: "a".repeat(64) } }),
|
||||
);
|
||||
await page.route("**/api/admin/studio/import-jobs**", async (route) => {
|
||||
if (route.request().method() !== "POST") {
|
||||
await route.fulfill({ json: { ok: true, jobs: [], nextCursor: null } });
|
||||
return;
|
||||
}
|
||||
const body = route.request().postDataJSON();
|
||||
ids.push(body.id);
|
||||
if (ids.length === 1) await route.abort("failed");
|
||||
else
|
||||
await route.fulfill({
|
||||
json: { ok: true, job: { ...furnitureJobFixture, id: body.id } },
|
||||
});
|
||||
});
|
||||
await page.goto("/admin/jobs-harness");
|
||||
await page
|
||||
.getByRole("button", { name: "Submit import", exact: true })
|
||||
.click();
|
||||
await expect(page.getByLabel("Submitted", { exact: true })).toHaveText(
|
||||
"false",
|
||||
);
|
||||
await page.reload();
|
||||
await page
|
||||
.getByRole("button", { name: "Submit import", exact: true })
|
||||
.click();
|
||||
await expect(page.getByLabel("Submitted", { exact: true })).toHaveText(
|
||||
"true",
|
||||
);
|
||||
expect(ids).toHaveLength(2);
|
||||
expect(ids[1]).toBe(ids[0]);
|
||||
await page
|
||||
.getByRole("button", { name: "Submit import", exact: true })
|
||||
.click();
|
||||
await expect.poll(() => ids.length).toBe(3);
|
||||
expect(ids[2]).not.toBe(ids[0]);
|
||||
});
|
||||
Reference in new issue
Block a user