mirror of
https://github.com/Queer-Lexikon/regenbogenkarte
synced 2024-11-21 19:53:07 +00:00
test: add hamburger button tests
This commit is contained in:
parent
cc1ce48234
commit
93751b6c05
1 changed files with 32 additions and 0 deletions
|
@ -21,3 +21,35 @@ test.describe("exit button", () => {
|
|||
await expect(page.context().pages()).toHaveLength(2);
|
||||
});
|
||||
});
|
||||
test.describe("hamburger button", () => {
|
||||
// Use a Pixel 5 as a reference mobile device.
|
||||
test.use({
|
||||
viewport: { width: 393, height: 851 },
|
||||
deviceScaleFactor: 2,
|
||||
hasTouch: true,
|
||||
});
|
||||
|
||||
const buttonLocator = ".js-header-button:visible";
|
||||
|
||||
test.beforeEach(async ({ page, baseURL }) => {
|
||||
test.fail(baseURL === undefined, "baseURL should be set");
|
||||
await page.goto(baseURL!);
|
||||
});
|
||||
|
||||
test("should be visible", async ({ page }) => {
|
||||
await expect(page.locator(buttonLocator)).toBeVisible();
|
||||
});
|
||||
test("click reveals and unreveals menu", async ({ page }) => {
|
||||
page.locator(buttonLocator).click();
|
||||
await expect(page.locator("#mobile-header")).toBeVisible();
|
||||
|
||||
page.locator(buttonLocator).click();
|
||||
await expect(page.locator("#mobile-header")).toBeHidden();
|
||||
});
|
||||
test("info menu button is not affected", async ({ page }) => {
|
||||
const headerBtn = page.locator(buttonLocator);
|
||||
headerBtn.click();
|
||||
await page.locator("#open-menu-btn").tap();
|
||||
await expect(page.locator("#menu >> .z-menu")).toBeVisible();
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue