diff --git a/frontend/e2e/bookmark.spec.ts b/frontend/e2e/bookmark.spec.ts index 730ae30a..a72aa2dd 100644 --- a/frontend/e2e/bookmark.spec.ts +++ b/frontend/e2e/bookmark.spec.ts @@ -147,8 +147,8 @@ test.describe("a bookmark reopens the view it was taken of", () => { await fresh.context().close(); }); - // A file of the test's own, uploaded for it and deleted after: the account's library is left as - // it was found. + // A file of the test's own, uploaded for it and deleted after, and the account's sort put back: + // the account is left as it was found. test( "the Files sort, and the file open in the viewer", { tag: "@files" }, @@ -168,8 +168,14 @@ test.describe("a bookmark reopens the view it was taken of", () => { }); expect(up.ok(), await up.text()).toBeTruthy(); const { id } = (await up.json()) as { id: number }; + // The account's own sort, put back after: a header press cycles it (asc, desc, none), so the + // case starts from none, as the address names it, whatever an earlier run left. + const me = (await (await page.request.get("/api/me")).json()) as { + preferences?: Record; + }; + const ownSort = me.preferences?.filesSort ?? null; try { - await gotoPage(page, "files"); + await openApp(page, "/?page=files&fsort=none"); await column(page, "Name").getByRole("button").first().click(); await expect(page).toHaveURL(/[?&]fsort=name/); const sorted = await column(page, "Name").getAttribute("aria-sort"); @@ -182,6 +188,7 @@ test.describe("a bookmark reopens the view it was taken of", () => { await fresh.context().close(); } finally { await page.request.delete(`/api/files/${id}`); + await page.request.put("/api/me/preferences", { data: { filesSort: ownSort } }); } }, );