skip certain test when testing ssv6

This commit is contained in:
Yann Braga 2023-02-06 12:44:17 +01:00
parent 8a576e6b1f
commit 3b2c3c4f18
5 changed files with 32 additions and 17 deletions

View File

@ -1,3 +1,4 @@
/* eslint-disable jest/valid-title */
/* eslint-disable jest/no-disabled-tests */
/* eslint-disable no-await-in-loop */
import { test, expect } from '@playwright/test';
@ -16,7 +17,6 @@ test.describe('addon-docs', () => {
test('should provide source snippet', async ({ page }) => {
// templateName is e.g. 'Vue-CLI (Default JS)'
test.skip(
// eslint-disable-next-line jest/valid-title
/^(vue3|vue-cli|preact)/i.test(`${templateName}`),
`Skipping ${templateName}, which does not support dynamic source snippets`
);
@ -54,6 +54,12 @@ test.describe('addon-docs', () => {
});
test('should order entries correctly', async ({ page }) => {
// TODO: This is broken in SSV6 Webpack. Context: https://github.com/storybookjs/storybook/issues/20941
test.skip(
templateName.includes('ssv6-webpack'),
`${templateName} fails because of a known issue: https://github.com/storybookjs/storybook/issues/20941`
);
const sbPage = new SbPage(page);
await sbPage.navigateToStory('addons/docs/docspage/basic', 'docs');

View File

@ -8,18 +8,20 @@ const storybookUrl = process.env.STORYBOOK_URL || 'http://localhost:6006';
const templateName = process.env.STORYBOOK_TEMPLATE_NAME;
test.describe('Next.js', () => {
// TODO: improve these E2E tests given that we have more version of Next.js to test
// and this only tests nextjs/default-js
test.skip(
// eslint-disable-next-line jest/valid-title
!templateName.includes('nextjs/default-js'),
'Only run this test for the Frameworks that support next/navigation'
);
test.beforeEach(async ({ page }) => {
await page.goto(storybookUrl);
await new SbPage(page).waitUntilLoaded();
});
test.describe('next/navigation', () => {
test.skip(
// eslint-disable-next-line jest/valid-title
!templateName.includes('nextjs/default-js'),
'Only run this test for the Frameworks that support next/navigation'
);
let root: Locator;
let sbPage: SbPage;
@ -52,12 +54,6 @@ test.describe('Next.js', () => {
});
test.describe('next/router', () => {
test.skip(
// eslint-disable-next-line jest/valid-title
!templateName.includes('nextjs'),
'Only run this test for the Frameworks that support next/router'
);
let root: Locator;
let sbPage: SbPage;

View File

@ -1,7 +1,9 @@
/* eslint-disable jest/no-disabled-tests */
import { test, expect } from '@playwright/test';
import process from 'process';
const storybookUrl = process.env.STORYBOOK_URL || 'http://localhost:8001';
const templateName = process.env.STORYBOOK_TEMPLATE_NAME;
test.describe('JSON files', () => {
test.beforeEach(async ({ page }) => {
@ -9,6 +11,11 @@ test.describe('JSON files', () => {
});
test('should have index.json', async ({ page }) => {
test.skip(
// eslint-disable-next-line jest/valid-title
templateName.includes('ssv6'),
'Only run this test for Sandboxes with StoryStoreV7 enabled'
);
const json = await page.evaluate(() => fetch('/index.json').then((res) => res.json()));
expect(json).toEqual({

View File

@ -9,13 +9,13 @@ export const e2eTests: Task = {
async ready() {
return false;
},
async run({ codeDir, junitFilename, template }, { dryRun, debug }) {
async run({ codeDir, junitFilename, key }, { dryRun, debug }) {
await exec(
`yarn playwright test`,
{
env: {
STORYBOOK_URL: `http://localhost:${PORT}`,
STORYBOOK_TEMPLATE_NAME: template.name,
STORYBOOK_TEMPLATE_NAME: key,
...(junitFilename && {
PLAYWRIGHT_JUNIT_OUTPUT_NAME: junitFilename,
}),

View File

@ -9,11 +9,17 @@ export const testRunner: Task = {
async ready() {
return false;
},
async run({ sandboxDir, junitFilename }, { dryRun, debug }) {
async run({ sandboxDir, junitFilename, template }, { dryRun, debug }) {
const execOptions = { cwd: sandboxDir };
const flags = [`--url http://localhost:${PORT}`, '--junit', '--maxWorkers=2'];
// index-json mode is only supported in ssv7
if (template.modifications?.mainConfig?.features?.storyStoreV7 !== false) {
flags.push('--index-json');
}
await exec(
`yarn test-storybook --url http://localhost:${PORT} --junit --index-json --maxWorkers=2`,
`yarn test-storybook ${flags.join(' ')}`,
{
...execOptions,
env: {