Files
react-test/test/e2e-website/joy-docs.spec.ts

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

30 lines
922 B
TypeScript
Raw Permalink Normal View History

2025-12-12 14:26:25 +09:00
import { test as base, expect } from '@playwright/test';
import { kebabCase } from 'es-toolkit/string';
import { TestFixture } from './playwright.config';
const test = base.extend<TestFixture>({});
test.describe('Joy docs', () => {
test('should have correct link with hash in the TOC', async ({ page }) => {
await page.goto('/joy-ui/getting-started/installation/');
const anchors = page.locator('[aria-label="Page table of contents"] ul a');
const firstAnchor = anchors.first();
const textContent = await firstAnchor.textContent();
await expect(firstAnchor).toHaveAttribute(
'href',
`/joy-ui/getting-started/installation/#${kebabCase(textContent || '')}`,
);
});
test('should be able to see demos', async ({ page }) => {
await page.goto('/joy-ui/react-button/');
const headline = page.locator('main h1');
await expect(headline).toHaveText('Button');
});
});