-
Notifications
You must be signed in to change notification settings - Fork 2.2k
/
vitest.workspace.ts
45 lines (43 loc) · 1.27 KB
/
vitest.workspace.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
import { defineWorkspace } from 'vitest/config';
import type { BrowserCommand } from 'vitest/node';
// TODO: remove when `userEvent.pointer` is supported
const resizeColumn: BrowserCommand<[resizeBy: number]> = async (context, resizeBy) => {
const page = context.page;
const frame = await context.frame();
const resizeHandle = frame.locator('[role="columnheader"][aria-colindex="2"] div');
const { x, y } = (await resizeHandle.boundingBox())!;
await resizeHandle.hover({
position: { x: 5, y: 5 }
});
await page.mouse.down();
await page.mouse.move(x + resizeBy + 5, y);
await page.mouse.up();
};
export default defineWorkspace([
{
extends: './vite.config.ts',
test: {
name: 'browser',
include: ['test/browser/**/*.test.*'],
browser: {
enabled: true,
name: 'chromium',
provider: 'playwright',
commands: { resizeColumn },
viewport: { width: 1920, height: 1080 },
headless: true,
screenshotFailures: process.env.CI !== 'true'
},
setupFiles: ['test/setup.ts', 'test/setupBrowser.ts']
}
},
{
extends: './vite.config.ts',
test: {
name: 'node',
include: ['test/node/**/*.test.*'],
environment: 'node',
setupFiles: ['test/setup.ts']
}
}
]);