fix: use response.json() to prevent disposal race condition in E2E test

Replace response.body() with response.json() in open-existing-project.spec.ts
to fix the "Response has been disposed" error. This matches the pattern used
in other test files.
This commit is contained in:
Stefan de Vogelaere
2026-01-18 15:51:36 +01:00
parent c42b786268
commit 36bdf8c24a

View File

@@ -85,17 +85,7 @@ test.describe('Open Project', () => {
// AND inject our test project into the projects list // AND inject our test project into the projects list
await page.route('**/api/settings/global', async (route) => { await page.route('**/api/settings/global', async (route) => {
const response = await route.fetch(); const response = await route.fetch();
// Immediately consume the body to prevent disposal issues const json = await response.json();
const bodyPromise = response.body();
const status = response.status();
const headers = response.headers();
const body = await bodyPromise;
let json;
try {
json = JSON.parse(body.toString());
} catch {
json = {};
}
if (json.settings) { if (json.settings) {
// Remove currentProjectId to prevent restoring a project // Remove currentProjectId to prevent restoring a project
json.settings.currentProjectId = null; json.settings.currentProjectId = null;
@@ -115,11 +105,7 @@ test.describe('Open Project', () => {
json.settings.projects = [testProject, ...existingProjects]; json.settings.projects = [testProject, ...existingProjects];
} }
} }
await route.fulfill({ await route.fulfill({ response, json });
status: status,
headers: headers,
json,
});
}); });
// Now navigate to the app // Now navigate to the app