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
16 changes: 0 additions & 16 deletions web/e2e/fixtures/error-allowlist.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,22 +50,6 @@ export const GLOBAL_ALLOWLIST: RegExp[] = [
// covered by the "Failed to load resource" entry above.
// -------------------------------------------------------------------------

// TODO(real-bug): ApiMocker registers "**/api/reviews**" (plural) but the
// app fetches /api/review (singular) for the review list and timeline.
// Affects: review.spec.ts, navigation.spec.ts, live.spec.ts, auth.spec.ts.
// Fix: add route handlers for /api/review and /api/review/** in api-mocker.ts.
/500 Internal Server Error.*\/api\/review(\?|\/|$)/,

// TODO(real-bug): /api/stats/history is not mocked; the system page fetches
// it for the detector/process history charts.
// Fix: add route handler for /api/stats/history in api-mocker.ts.
/500 Internal Server Error.*\/api\/stats\/history/,

// TODO(real-bug): /api/event_ids is not mocked; the explore/search page
// fetches it to resolve event IDs for display.
// Fix: add route handler for /api/event_ids in api-mocker.ts.
/500 Internal Server Error.*\/api\/event_ids/,

// TODO(real-bug): /api/sub_labels?split_joined=1 returns 500; the mock
// registers "**/api/sub_labels" which may not match when a query string is
// present, or route registration order causes the catch-all to win first.
Expand Down
28 changes: 17 additions & 11 deletions web/e2e/helpers/api-mocker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,19 +81,22 @@ export class ApiMocker {
await this.page.route("**/api/stats", (route) =>
route.fulfill({ json: stats }),
);
await this.page.route("**/api/stats/history", (route) =>
route.fulfill({ json: [] }),
);

// Reviews. The real backend exposes /review (singular) for the main
// list and /review/summary for the summary — the previous plural glob
// (**/api/reviews**) never matched either endpoint, so review-dependent
// tests silently ran without data. The POST mutations at /reviews/viewed
// and /reviews/delete (plural) still fall through to the generic
// mutation catch-all further down the file.
await this.page.route(/\/api\/review\/summary/, (route) =>
route.fulfill({ json: reviewSummary }),
);
await this.page.route(/\/api\/review(\?|$)/, (route) =>
route.fulfill({ json: reviews }),
);
// list and /review/summary for the summary. The plural mutations
// (/reviews/viewed, /reviews/delete) fall through to the catch-all.
// The "**/api/review**" glob catches /api/review, /api/review/summary,
// and any future singular sub-routes.
await this.page.route("**/api/review**", (route) => {
const url = route.request().url();
if (url.includes("/summary")) {
return route.fulfill({ json: reviewSummary });
}
return route.fulfill({ json: reviews });
});

// Export jobs. The Exports page polls this every 2s while any export
// is in_progress; without a mock route it falls through to the preview
Expand Down Expand Up @@ -132,6 +135,9 @@ export class ApiMocker {
await this.page.route("**/api/events**", (route) =>
route.fulfill({ json: events }),
);
await this.page.route("**/api/event_ids**", (route) =>
route.fulfill({ json: [] }),
);

// Exports
await this.page.route("**/api/export**", (route) =>
Expand Down
Loading