mirror of
https://github.com/storybookjs/storybook.git
synced 2025-03-19 05:02:40 +08:00
28 lines
859 B
TypeScript
28 lines
859 B
TypeScript
import { test, expect } from '@playwright/test';
|
|
import process from 'process';
|
|
import { SbPage } from './util';
|
|
|
|
const storybookUrl = process.env.STORYBOOK_URL || 'http://localhost:8001';
|
|
|
|
test.describe('addon-actions', () => {
|
|
test.beforeEach(async ({ page }) => {
|
|
await page.goto(storybookUrl);
|
|
await new SbPage(page).waitUntilLoaded();
|
|
});
|
|
|
|
test('should trigger an action', async ({ page }) => {
|
|
const sbPage = new SbPage(page);
|
|
|
|
await sbPage.navigateToStory('example/button', 'primary');
|
|
const root = sbPage.previewRoot();
|
|
const button = root.locator('button', { hasText: 'Button' });
|
|
await button.click();
|
|
|
|
await sbPage.viewAddonPanel('Actions');
|
|
const logItem = await page.locator('#storybook-panel-root #panel-tab-content', {
|
|
hasText: 'click',
|
|
});
|
|
await expect(logItem).toBeVisible();
|
|
});
|
|
});
|