2026-08-06 15:43:57 +00:00
|
|
|
import {expect, roomPath, test, users} from "../harness"
|
|
|
|
|
|
2026-09-08 17:23:22 +00:00
|
|
|
test("opens the space menu in a drawer on a phone", async ({seed, as}) => {
|
|
|
|
|
const scenario = await seed(({relay, user}) => {
|
|
|
|
|
const space = relay("space")
|
|
|
|
|
|
|
|
|
|
space.room("general", {name: "General"})
|
|
|
|
|
space.join(user.alice, "general")
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
const {url} = scenario.space("space")
|
|
|
|
|
const page = await as(users.alice, roomPath(url, "general"), {
|
|
|
|
|
context: {viewport: {width: 390, height: 844}, hasTouch: true},
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
const drawer = page.locator(".drawer")
|
|
|
|
|
|
|
|
|
|
await page.getByRole("button", {name: "Open space menu"}).click()
|
|
|
|
|
|
|
|
|
|
await expect(drawer.getByRole("link", {name: "General"})).toBeVisible()
|
|
|
|
|
|
2026-09-24 18:23:21 +00:00
|
|
|
// The drawer stops short of the bottom bar, and playwright's hit-target check is what proves it.
|
2026-09-25 21:16:50 +00:00
|
|
|
await page.getByRole("button", {name: "Close space menu"}).click()
|
2026-09-08 17:23:22 +00:00
|
|
|
|
|
|
|
|
await expect(drawer).toHaveCount(0)
|
|
|
|
|
|
|
|
|
|
await page.getByRole("button", {name: "Open space menu"}).click()
|
|
|
|
|
|
|
|
|
|
await expect(drawer.getByRole("link", {name: "General"})).toBeVisible()
|
|
|
|
|
|
|
|
|
|
// The modal stack lives in the url hash, so the drawer is a history entry and back closes it.
|
|
|
|
|
await page.goBack()
|
|
|
|
|
|
|
|
|
|
await expect(drawer).toHaveCount(0)
|
|
|
|
|
|
2026-09-24 18:23:21 +00:00
|
|
|
// The button is the bottom bar's rather than the page's, so it opens on the last space visited.
|
2026-09-09 01:07:48 +00:00
|
|
|
await page.goto("/chat")
|
2026-09-08 17:23:22 +00:00
|
|
|
|
|
|
|
|
await page.getByRole("button", {name: "Open space menu"}).click()
|
|
|
|
|
|
|
|
|
|
await expect(drawer.getByRole("link", {name: "General"})).toBeVisible()
|
|
|
|
|
})
|