1
0
resumarkdown/tests/desktop.test.ts

44 lines
1.5 KiB
TypeScript
Raw Normal View History

2024-10-12 00:53:39 -05:00
import { expect, test } from '@playwright/test';
test('desktop page has nav tree', async ({ page }) => {
await page.goto('/');
await expect(page.locator('nav')).toBeVisible();
});
test('desktop page does not have nav toggle', async ({ page }) => {
await page.goto('/');
await expect(page.locator('nav button')).toBeHidden();
});
2024-10-12 01:17:44 -05:00
test('desktop page has two-column layout', async ({ page }) => {
await page.goto('/');
await expect(page.locator('#pane-preview')).toBeVisible();
});
2024-10-12 01:50:08 -05:00
test('desktop page has no "preview" nav item', async ({ page }) => {
await page.goto('/');
await expect(page.getByRole('tab').filter({ hasText: 'preview' })).toBeHidden();
});
2024-10-12 11:36:03 -05:00
test('desktop page has equal width for both columns', async ({ page }) => {
await page.goto('/');
const { width: contentWidth } = (await page.getByTestId('content-pane').boundingBox()) ?? {
width: -1,
};
const { width: previewWidth } = (await page.getByTestId('preview-pane').boundingBox()) ?? {
width: -2,
};
expect(contentWidth).toEqual(previewWidth);
});
2024-10-12 11:57:58 -05:00
test('desktop page has equal width for nav items', async ({ page }) => {
await page.goto('/');
const visibleTabs = page.getByRole('tab').filter({ hasNotText: 'preview' });
const { width: firstTabWidth } = (await visibleTabs.first().boundingBox()) ?? {
width: -1,
};
for (let i = 1; i < (await visibleTabs.count()); i++) {
await expect((await visibleTabs.nth(i).boundingBox())?.width).toEqual(firstTabWidth);
}
});