storybook/scripts/tasks/e2e-tests.ts
2023-02-06 12:44:17 +01:00

29 lines
701 B
TypeScript

import type { Task } from '../task';
import { exec } from '../utils/exec';
import { PORT } from './serve';
export const e2eTests: Task = {
description: 'Run the end-to-end test suite against the sandbox',
dependsOn: ['serve'],
junit: true,
async ready() {
return false;
},
async run({ codeDir, junitFilename, key }, { dryRun, debug }) {
await exec(
`yarn playwright test`,
{
env: {
STORYBOOK_URL: `http://localhost:${PORT}`,
STORYBOOK_TEMPLATE_NAME: key,
...(junitFilename && {
PLAYWRIGHT_JUNIT_OUTPUT_NAME: junitFilename,
}),
},
cwd: codeDir,
},
{ dryRun, debug }
);
},
};