mirror of
https://github.com/storybookjs/storybook.git
synced 2025-04-08 07:41:58 +08:00
24 lines
788 B
TypeScript
24 lines
788 B
TypeScript
import { expect, test } from '@playwright/test';
|
|
import process from 'process';
|
|
|
|
import { SbPage } from './util';
|
|
|
|
const storybookUrl = process.env.STORYBOOK_URL || 'http://localhost:8001';
|
|
|
|
test.describe('navigating', () => {
|
|
test('a URL with a partial storyId will redirect to the first story', async ({ page }) => {
|
|
// this is purposefully not using the SbPage class, and the URL is a partial (it does not contain the full storyId)
|
|
await page.goto(`${storybookUrl}?path=/story/example-button`);
|
|
|
|
const sbPage = new SbPage(page);
|
|
|
|
await sbPage.waitUntilLoaded();
|
|
|
|
await page.waitForFunction(() =>
|
|
window.document.location.href.match('/docs/example-button--docs')
|
|
);
|
|
|
|
await expect(sbPage.page.url()).toContain('/docs/example-button--docs');
|
|
});
|
|
});
|