Files
radicle-explorer/tests/e2e/modal.spec.ts
T
Rūdolfs Ošiņš 3d018dae18 Refactor modals
Signed-off-by: Rūdolfs Ošiņš <rudolfs@osins.org>
2023-01-30 09:24:49 +01:00

19 lines
710 B
TypeScript

import { test, expect } from "@tests/support/fixtures.js";
test("open and close modal", async ({ page }) => {
await page.goto("/");
await page.locator("body").press(`?`);
await expect(page.getByText("Keyboard shortcuts")).toBeVisible();
// Close modal by pressing the `Esc` key.
await page.locator("body").press("Escape");
await expect(page.getByText("Keyboard shortcuts")).not.toBeVisible();
await page.locator("body").press(`?`);
await expect(page.getByText("Keyboard shortcuts")).toBeVisible();
// Close modal by clicking outside of it.
await page.locator(".overlay").click({ position: { x: 10, y: 10 } });
await expect(page.getByText("Keyboard shortcuts")).not.toBeVisible();
});