Files
resumarkdown/tests/mobile.test.ts
Nicola Clark 2a6523b9f1 [LICENSE] relicense project under MPL 2.0
relicensed due to GitHub's Copilot push. details in README.md.
2025-02-28 10:53:21 -06:00

45 lines
1.5 KiB
TypeScript

/*
* This Source Code Form is subject to the terms of the Mozilla Public License,
* v. 2.0. If a copy of the MPL was not distributed with this file, You can
* obtain one at https://mozilla.org/MPL/2.0/.
*/
import { expect, test } from '@playwright/test';
import UserAgent from 'user-agents';
test.use({
viewport: { height: 2556, width: 1179 },
userAgent: new UserAgent({ deviceCategory: 'mobile' }).toString(),
});
test('mobile page has nav tree hidden by default', async ({ page }) => {
await page.goto('/');
await expect(page.getByRole('navigation').getByRole('tablist')).toBeHidden();
});
test('mobile page has nav toggle', async ({ page }) => {
await page.goto('/');
await expect(page.getByRole('navigation').getByRole('button')).toBeVisible();
});
test('nav toggle works', async ({ page }) => {
await page.goto('/');
await page.getByText('show navigation').click();
await expect(page.getByRole('navigation').getByRole('tablist')).toBeVisible();
await page.getByText('hide navigation').click();
await expect(page.getByRole('navigation').getByRole('tablist')).toBeHidden();
});
test('mobile page has single-column layout', async ({ page }) => {
await page.goto('/');
await expect(page.getByTestId('content-pane')).toBeVisible();
await expect(page.getByTestId('preview-pane')).toBeHidden();
});
test('mobile page has preview nav item', async ({ page }) => {
await page.goto('/');
await page.getByText('show navigation').click();
await expect(page.getByRole('tab').filter({ hasText: 'preview' })).toBeVisible();
});