feat(search): tag-based page search surface + per-page tags & collections
Add the /search surface (Pages / Chapters / Mangas tabs) backed by per-user page tags and per-page collections: schema (migration 0023), backend endpoints for page tags/collections and tagged-page aggregations (with the OCR text-search param reserved at 501), plus the frontend API clients, library Page-tags tab, collection page sections, page context menu / AddTagsSheet, and reader long-press wiring. Includes the continuous-reader navigation fixes (?page=N handling, chapter-reset timing, back-button pops history) and tag-normalization hardening accumulated on the branch. Bump version 0.60.2 -> 0.62.0. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -53,7 +53,13 @@ async function mockApis(page: Page) {
|
||||
);
|
||||
// Catalog returns a single card whose href points at MID so the
|
||||
// SPA-click walk lands on the manga we've mocked downstream.
|
||||
await page.route('**/api/v1/mangas', (r) =>
|
||||
// `**/api/v1/mangas` alone doesn't intercept query strings
|
||||
// (`?limit=&sort=`), so the catalog request would fall through
|
||||
// to a real backend if one is running on :8080 and seed the
|
||||
// page with real-manga IDs that don't match the mock body.
|
||||
// `**/api/v1/mangas?**` (and the same suffix on the catch-all
|
||||
// below) makes the intercept query-tolerant.
|
||||
await page.route('**/api/v1/mangas?**', (r) =>
|
||||
r.fulfill({
|
||||
status: 200,
|
||||
contentType: 'application/json',
|
||||
@@ -163,4 +169,56 @@ test('phone viewport: reader back pops history (does not push), then detail back
|
||||
await page.waitForURL((url) => url.pathname === '/');
|
||||
});
|
||||
|
||||
test('reader cover+title pushes detail when arrived from a non-detail page', async ({
|
||||
page
|
||||
}) => {
|
||||
// The smart-cover-title fix: if the user got to the reader from
|
||||
// a page OTHER than this manga's detail (search, library,
|
||||
// direct link, etc.), the cover+title should push the detail
|
||||
// page so browser-back returns to the reader. The arrow stays
|
||||
// a pure "go back".
|
||||
//
|
||||
// We simulate "non-detail arrival" with a deep-link load
|
||||
// straight to the reader. That covers cold-tab + shared-link +
|
||||
// search-result cases — afterNavigate fires with from=null and
|
||||
// lastInternalPath stays null, so the cover+title click sees
|
||||
// a mismatch and pushes the detail page.
|
||||
await mockApis(page);
|
||||
await page.setViewportSize({ width: 390, height: 844 });
|
||||
|
||||
await page.goto(`/manga/${MID}/chapter/${CID}`);
|
||||
await page.waitForSelector('[data-testid="back-to-manga"]');
|
||||
const lenAtReader = await page.evaluate(() => window.history.length);
|
||||
|
||||
await page.getByTestId('back-to-manga').click();
|
||||
await page.waitForURL(/\/manga\/[^/]+$/);
|
||||
const lenAfter = await page.evaluate(() => window.history.length);
|
||||
// PUSH (not pop) — lenAtReader + 1.
|
||||
expect(lenAfter).toBe(lenAtReader + 1);
|
||||
|
||||
// Browser-back from detail returns to reader (proves it was a
|
||||
// push, not a replace).
|
||||
await page.goBack();
|
||||
await page.waitForURL(/\/chapter\//);
|
||||
});
|
||||
|
||||
test('reader arrow always pops history', async ({ page }) => {
|
||||
await mockApis(page);
|
||||
await page.setViewportSize({ width: 390, height: 844 });
|
||||
|
||||
await page.goto('/');
|
||||
await page.locator('[data-testid="manga-list"] a').first().click();
|
||||
await page.waitForURL(/\/manga\/[^/]+$/);
|
||||
await page.locator('[data-testid="chapter-list"] a').first().click();
|
||||
await page.waitForURL(/\/chapter\//);
|
||||
|
||||
const lenAtReader = await page.evaluate(() => window.history.length);
|
||||
|
||||
// Click the arrow — always pops, regardless of previous page.
|
||||
await page.getByTestId('reader-back-arrow').click();
|
||||
await page.waitForURL(/\/manga\/[^/]+$/);
|
||||
const lenAfter = await page.evaluate(() => window.history.length);
|
||||
expect(lenAfter).toBe(lenAtReader);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user