storybook/code/e2e-tests/example.spec.ts

18 lines
562 B
TypeScript
Raw Normal View History

2022-08-01 11:54:32 +10:00
import { test, expect } from '@playwright/test';
import process from 'process';
2022-08-01 16:43:07 +10:00
const storybookUrl = process.env.STORYBOOK_URL || 'http://localhost:8001';
2022-08-01 11:54:32 +10:00
test('Basic story test', async ({ page }) => {
await page.goto(storybookUrl);
const preview = page.frameLocator('#storybook-preview-iframe');
const root = preview.locator('#root:visible, #docs-root:visible');
// General check for any selected entry
await expect(root).not.toBeEmpty();
// Specific check for introduction story
await expect(root).toContainText('Welcome to Storybook');
});