E2E: Conditionally skip vue3 docs snippet tests

This commit is contained in:
Michael Shilman 2022-08-15 08:29:52 +08:00
parent 74f5836fa9
commit 8e373f4b54
2 changed files with 9 additions and 3 deletions

View File

@ -1,19 +1,24 @@
/* eslint-disable jest/no-disabled-tests */
/* eslint-disable no-await-in-loop */
import { test, expect } from '@playwright/test';
import process from 'process';
import { SbPage } from './util';
const storybookUrl = process.env.STORYBOOK_URL || 'http://localhost:8001';
const templateName = process.env.STORYBOOK_TEMPLATE_NAME || '';
test.describe('addon-docs', () => {
test.beforeEach(async ({ page }) => {
await page.goto(storybookUrl);
});
// FIXME: skip html/vue3
test('should provide source snippet', async ({ page }) => {
const sbPage = new SbPage(page);
test.skip(
/^vue3/.test(templateName),
`Skipping ${templateName}, which does not support dynamic source snippets`
);
const sbPage = new SbPage(page);
await sbPage.navigateToStory('example-button', 'docs');
const root = sbPage.previewRoot();
const toggles = root.locator('.docblock-code-toggle');

View File

@ -8,12 +8,13 @@ export const e2eTests: Task = {
async ready() {
return false;
},
async run(_, { builtSandboxDir, junitFilename }) {
async run(_, { builtSandboxDir, junitFilename, template }) {
const storybookController = await serveSandbox(builtSandboxDir, {});
await exec('yarn playwright test --reporter=junit', {
env: {
STORYBOOK_URL: `http://localhost:8001`,
STORYBOOK_TEMPLATE_NAME: template.name,
...(junitFilename && {
PLAYWRIGHT_JUNIT_OUTPUT_NAME: junitFilename,
}),