Files

20 lines
1.1 KiB
TypeScript

import { expect, test } from '@playwright/test';
for (const javaScriptEnabled of [false, true]) {
test.describe(javaScriptEnabled ? 'WASM tree' : 'static tree', () => {
test.use({ javaScriptEnabled, reducedMotion: 'reduce' });
test('book uses its Object name without a directory suffix', async ({ page }, info) => {
await page.goto('./');
if (javaScriptEnabled) await expect(page.locator('[data-landing-stage]')).toHaveAttribute('data-wip-state', 'ready');
const book = page.locator('.demo-node[data-path="/book"]');
await expect(book.locator('.node-label')).toHaveText('book');
await expect(book).toHaveAttribute('aria-label', 'book');
await expect(book).toHaveAttribute('href', new URL('book/', info.project.use.baseURL!).pathname);
await book.click();
await expect(page).toHaveURL(new URL('book/', info.project.use.baseURL!).href);
if (javaScriptEnabled) await expect(page.locator('[data-landing-stage]')).toHaveAttribute('data-wip-state', 'ready');
await expect(book.locator('.node-label')).toHaveText('book');
});
});
}