test(e2e): the Files sort round trip starts from a known sort and puts the account's back
A header press cycles the sort (asc, desc, none), so the case depended on what an earlier run left in the account: the third run in a row pressed it to none.
This commit is contained in:
@@ -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<string, unknown>;
|
||||
};
|
||||
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 } });
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user