feat(hk): explain background updates with protected content links and retry details
This commit is contained in:
1 parent
dd7613850e
commit
c5c9941768
42 files changed
+1542
-145
No files matched your search
@@ -205,3 +205,102 @@ test("Studio opens and dismisses detail, Nitro editor and import review", async
|
||||
expect(mutations).toEqual([]);
|
||||
expect(errors).toEqual([]);
|
||||
});
|
||||
|
||||
test("Studio loads organize imports on demand and preserves the dialog on reopen", async ({
|
||||
page,
|
||||
}, testInfo) => {
|
||||
const errors: string[] = [];
|
||||
const mutations: string[] = [];
|
||||
let organizeRequests = 0;
|
||||
page.on("pageerror", (error) => errors.push(error.message));
|
||||
await page.route("**/fixture/actions/**", async (route) => {
|
||||
mutations.push(route.request().url());
|
||||
await route.fulfill({
|
||||
status: 405,
|
||||
json: { error: "No mutations expected" },
|
||||
});
|
||||
});
|
||||
await page.route("**/api/**", async (route) => {
|
||||
const request = route.request();
|
||||
const url = new URL(request.url());
|
||||
if (request.method() !== "GET") {
|
||||
mutations.push(`${request.method()} ${url.pathname}`);
|
||||
return route.fulfill({
|
||||
status: 405,
|
||||
json: { error: "No mutations expected" },
|
||||
});
|
||||
}
|
||||
if (url.pathname === "/api/admin/import/organize") {
|
||||
organizeRequests++;
|
||||
return route.fulfill({
|
||||
json: {
|
||||
groups: [
|
||||
{
|
||||
name: "Fixture imports",
|
||||
icon: 1,
|
||||
layout: "default_3x3",
|
||||
total: 1,
|
||||
moved: 0,
|
||||
added: 1,
|
||||
thumbs: [],
|
||||
items: [{ itemId: 1, catalogItemId: null, alreadyPlaced: false }],
|
||||
},
|
||||
],
|
||||
importRootPageId: null,
|
||||
importRootCaption: null,
|
||||
},
|
||||
});
|
||||
}
|
||||
if (url.pathname === "/api/admin/catalog/tree")
|
||||
return route.fulfill({ json: { pages: [] } });
|
||||
if (url.pathname === "/api/admin/import/furni")
|
||||
return route.fulfill({
|
||||
json:
|
||||
url.searchParams.get("action") === "stats"
|
||||
? { totalInDb: 0, inCatalog: 0, notInCatalog: 0, missingNitro: 0 }
|
||||
: {
|
||||
items: [],
|
||||
meta: { currentPage: 1, lastPage: 1, total: 0, perPage: 20 },
|
||||
},
|
||||
});
|
||||
if (url.pathname === "/api/admin/import/clone")
|
||||
return route.fulfill({ json: { sources: [] } });
|
||||
if (url.pathname === "/api/admin/studio/import-jobs")
|
||||
return route.fulfill({ json: { ok: true, jobs: [], nextCursor: null } });
|
||||
return route.fulfill({
|
||||
status: 404,
|
||||
json: { error: "Unknown fixture endpoint" },
|
||||
});
|
||||
});
|
||||
await page.goto("/admin/studio-harness");
|
||||
const trigger = page.getByRole("button", {
|
||||
name: "Organize imports",
|
||||
exact: true,
|
||||
});
|
||||
await expect(trigger).toBeVisible();
|
||||
expect(organizeRequests).toBe(0);
|
||||
await trigger.click();
|
||||
const dialog = page.getByRole("dialog", { name: /^Organize imports/ });
|
||||
await expect(dialog).toBeVisible();
|
||||
const filter = dialog.getByPlaceholder("Filter import groups...");
|
||||
await expect(filter).toBeVisible();
|
||||
await expect(dialog.locator('input[value="Fixture imports"]')).toBeVisible();
|
||||
await filter.fill("Fixture");
|
||||
expect(organizeRequests).toBe(1);
|
||||
await testInfo.attach("organize-imports", {
|
||||
body: await page.screenshot(),
|
||||
contentType: "image/png",
|
||||
});
|
||||
await dialog.getByRole("button", { name: "Cancel", exact: true }).click();
|
||||
await expect(dialog).toHaveCount(0);
|
||||
await expect(trigger).toBeFocused();
|
||||
await trigger.click();
|
||||
await expect(dialog).toBeVisible();
|
||||
await expect(filter).toHaveValue("Fixture");
|
||||
await expect.poll(() => organizeRequests).toBe(2);
|
||||
await page.keyboard.press("Escape");
|
||||
await expect(dialog).toHaveCount(0);
|
||||
await expect(trigger).toBeFocused();
|
||||
expect(mutations).toEqual([]);
|
||||
expect(errors).toEqual([]);
|
||||
});
|
||||
Reference in new issue
Block a user