Skip to content

Commit

Permalink
chore: improve tree-shake-antd example test case
Browse files Browse the repository at this point in the history
  • Loading branch information
shulandmimi committed Oct 13, 2024
1 parent ab0012d commit 7defe69
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions examples/tree-shake-antd/e2e.spec.ts
Original file line number Diff line number Diff line change
@@ -1,28 +1,33 @@
import { test, expect } from 'vitest';
import { test, expect, describe } from 'vitest';
import { startProjectAndTest } from '../../e2e/vitestSetup';
import { basename, dirname } from 'path';
import { fileURLToPath } from 'url';

const name = basename(import.meta.url);
const projectPath = dirname(fileURLToPath(import.meta.url));

test(`e2e tests - ${name}`, async () => {
describe(`e2e tests - ${name}`, async () => {
const runTest = (command?: 'start' | 'preview') =>
startProjectAndTest(
projectPath,
async (page) => {
const button = await page.waitForSelector('.test-antd-button');

const promise = page.waitForEvent('console', {
predicate: (msg) => msg.text() === 'antd button clicked'
});

const button = await page.waitForSelector('.test-antd-button');

button.click();
await promise;
},
command
);

await runTest();
await runTest('preview');
test(`exmaples ${name} run start`, async () => {
await runTest();
});

test(`exmaples ${name} run prevew`, async () => {
await runTest('preview');
});
});

0 comments on commit 7defe69

Please sign in to comment.