Files
hextra/tests/mobile-menu-focus.spec.ts

22 lines
678 B
TypeScript
Raw Normal View History

import { test, expect } from "@playwright/test";
test("clicking mobile hamburger does not focus the sidebar search input", async ({
page,
}) => {
await page.setViewportSize({ width: 375, height: 812 });
await page.goto("/", { waitUntil: "load" });
const menuButton = page.locator(".hextra-hamburger-menu");
await expect(menuButton).toBeVisible();
const sidebarSearchInput = page
.locator(".hextra-sidebar-container .hextra-search-input")
.first();
await expect(sidebarSearchInput).toBeVisible();
await menuButton.click();
await expect(menuButton).toHaveAttribute("aria-expanded", "true");
await expect(sidebarSearchInput).not.toBeFocused();
});