-
-
Notifications
You must be signed in to change notification settings - Fork 163
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: improve tree-shake-antd example test case
- Loading branch information
1 parent
ab0012d
commit 7defe69
Showing
1 changed file
with
11 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'); | ||
}); | ||
}); |