test(e2e): make the pin-tools spec idempotent across retries (#697)

The nightly E2E Full (4/4) intermittently failed pin-tools at its opening no-Pinned-section assertion: the spec mutates the shared pinnedTools preference, and with CI retries:1 an attempt that failed after pinning left a server-side pin the retry saw. Reset pinnedTools via the preferences API at the start so the test is idempotent. Confirmed intermittent (the same job passed on rerun of unchanged code) and PR CI green.
This commit is contained in:
SnapOtter
2026-07-31 08:19:47 +08:00
committed by GitHub
parent c0dc037860
commit 24868ac5b4
2 changed files with 20 additions and 1 deletions
+13
View File
@@ -211,6 +211,19 @@ export async function putSettings(
return { ok: res.ok(), status: res.status() };
}
/** Upsert the current user's preferences (e.g. reset shared state a spec mutates). */
export async function putPreferences(
page: Page,
data: Record<string, unknown>,
): Promise<{ ok: boolean; status: number }> {
const token = await getAuthToken(page);
const res = await page.request.put("/api/v1/preferences", {
headers: token ? { authorization: `Bearer ${token}` } : {},
data,
});
return { ok: res.ok(), status: res.status() };
}
/**
* changePasswordViaApi() — revert a password change without driving the UI.
* The current session token survives a password change (the API only revokes