Skip to content

Commit 748429e

Browse files
yangzheliWillemJiangCopilot
authored
fix(frontend): add missing mock routes for runs-list, models, and suggestions (#2578)
* fix(frontend): add missing mock routes for runs-list, models, and suggestions * Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --------- Co-authored-by: Willem Jiang <willem.jiang@gmail.com> Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
1 parent ed9ebfa commit 748429e

1 file changed

Lines changed: 41 additions & 0 deletions

File tree

frontend/tests/e2e/utils/mock-api.ts

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,10 +178,51 @@ export function mockLangGraphAPI(page: Page, options?: MockAPIOptions) {
178178
return route.fallback();
179179
});
180180

181+
// The URL carries a query string (e.g. `?limit=10&offset=0`), which Playwright
182+
// glob `*` does NOT cross, so we match with a regex anchored to `/runs`
183+
// followed by `?` or end-of-string. This must NOT match `/runs/stream`.
184+
void page.route(/\/api\/langgraph\/threads\/[^/]+\/runs(\?|$)/, (route) => {
185+
if (route.request().method() === "GET") {
186+
return route.fulfill({
187+
status: 200,
188+
contentType: "application/json",
189+
body: "[]",
190+
});
191+
}
192+
return route.fallback();
193+
});
194+
181195
// Run stream — returns a minimal SSE response with an AI message
182196
void page.route("**/api/langgraph/runs/stream", handleRunStream);
183197
void page.route("**/api/langgraph/threads/*/runs/stream", handleRunStream);
184198

199+
// Models list — model picker dropdown
200+
void page.route("**/api/models", (route) => {
201+
if (route.request().method() === "GET") {
202+
return route.fulfill({
203+
status: 200,
204+
contentType: "application/json",
205+
body: JSON.stringify({
206+
models: [],
207+
token_usage: { enabled: false },
208+
}),
209+
});
210+
}
211+
return route.fallback();
212+
});
213+
214+
// Follow-up suggestions — input box auto-suggest after AI response
215+
void page.route("**/api/threads/*/suggestions", (route) => {
216+
if (route.request().method() === "POST") {
217+
return route.fulfill({
218+
status: 200,
219+
contentType: "application/json",
220+
body: JSON.stringify({ suggestions: [] }),
221+
});
222+
}
223+
return route.fallback();
224+
});
225+
185226
// Agents list — sidebar & gallery page
186227
void page.route("**/api/agents", (route) => {
187228
if (route.request().method() === "GET") {

0 commit comments

Comments
 (0)