summaryrefslogtreecommitdiffhomepage
path: root/packages/app/e2e/sidebar.spec.ts
blob: 925590f51065d5d3850cc70652b8fdce84192a8e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import { test, expect } from "./fixtures"
import { modKey } from "./utils"

test("sidebar can be collapsed and expanded", async ({ page, gotoSession }) => {
  await gotoSession()

  const main = page.locator("main")
  const closedClass = /xl:border-l/
  const isClosed = await main.evaluate((node) => node.className.includes("xl:border-l"))

  if (isClosed) {
    await page.keyboard.press(`${modKey}+B`)
    await expect(main).not.toHaveClass(closedClass)
  }

  await page.keyboard.press(`${modKey}+B`)
  await expect(main).toHaveClass(closedClass)

  await page.keyboard.press(`${modKey}+B`)
  await expect(main).not.toHaveClass(closedClass)
})