fix(private-zone): hide incomplete albums and refresh Maya cover
Docker Image / Build and Push Docker Image (push) Successful in 2m12s

This commit is contained in:
Codex
2026-07-23 11:47:22 +08:00
parent 9ca56c2a04
commit d6f104ee3f
9 changed files with 74 additions and 16 deletions
+28 -7
View File
@@ -99,11 +99,16 @@ for (const character of characters) {
page.getByRole("heading", { name: "Private albums" }),
).toBeVisible();
await expect(page.getByText(character.displayName).last()).toBeVisible();
await expect(
page.getByRole("button", {
name: `View locked collection with 8 images from ${character.displayName}`,
}),
).toBeVisible();
const albumButton = page.getByRole("button", {
name: `View locked collection with 8 images from ${character.displayName}`,
});
if (character.id === "maya-tan") {
await expect(albumButton).toHaveCount(0);
await expect(page.getByRole("button", { name: "Refresh" })).toHaveCount(0);
await expect(page.getByText("No private albums yet.")).toHaveCount(0);
} else {
await expect(albumButton).toBeVisible();
}
});
test(`${character.displayName} receives a character-scoped Tip catalog`, async ({
@@ -133,6 +138,19 @@ for (const character of characters) {
});
}
test("a real Private Zone request failure still offers Retry", async ({
page,
}) => {
await page.route("**/api/private-zone/albums**", async (route) => {
await route.fulfill({ status: 503, json: { message: "Albums unavailable" } });
});
await page.goto("/characters/maya/private-zone");
await expect(page.getByRole("button", { name: "Retry" })).toBeVisible();
await expect(page.getByRole("button", { name: "Refresh" })).toHaveCount(0);
});
async function registerMultiRoleCommercialMocks(page: Page): Promise<void> {
await page.route("**/api/private-zone/albums**", async (route) => {
const url = new URL(route.request().url());
@@ -140,10 +158,13 @@ async function registerMultiRoleCommercialMocks(page: Page): Promise<void> {
const character =
characters.find((candidate) => candidate.id === characterId) ?? characters[0];
const hasCompleteAlbum = character.id !== "maya-tan";
await route.fulfill({
json: apiEnvelope({
creditBalance: 1000,
items: [
pendingImageCount: hasCompleteAlbum ? 0 : 7,
hasIncompleteContent: !hasCompleteAlbum,
items: hasCompleteAlbum ? [
{
albumId: `album-${character.id}`,
title: `${character.shortName} private photos`,
@@ -163,7 +184,7 @@ async function registerMultiRoleCommercialMocks(page: Page): Promise<void> {
publishedAt: "2026-07-22T10:00:00+08:00",
lockDetail: { locked: true },
},
],
] : [],
}),
});
});