-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
/
wdio.conf.js
68 lines (62 loc) · 1.9 KB
/
wdio.conf.js
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
import os from 'node:os'
import url from 'node:url'
import path from 'node:path'
import { loadEnv } from 'vite'
const isMac = os.platform() === 'darwin'
const isWindows = os.platform() === 'win32'
/**
* WebdriverIO is using this example to test its component testing features
* and we have experienced issues with Vue when running in Windows,
* see https://github.com/testing-library/vue-testing-library/issues/292
* Please ignore and remove this in your project!
*/
if (process.env.CI && process.env.WDIO_PRESET === 'vue' && (isWindows || isMac)) {
process.exit(0)
}
const __dirname = url.fileURLToPath(new URL('.', import.meta.url))
const browserName = isMac ? 'safari' : 'chrome'
const driver = isMac ? 'safaridriver' : 'chromedriver'
export const config = {
/**
* specify test files
*/
specs: [
path.resolve(__dirname, '*.test.tsx'),
path.resolve(__dirname, '*.test.js')
],
/**
* capabilities
*/
capabilities: [{ browserName }],
/**
* test configurations
*/
logLevel: 'trace',
framework: 'mocha',
outputDir: path.join(__dirname, 'logs', process.env.WDIO_PRESET),
reporters: ['spec', 'dot', 'junit'],
services: [driver],
runner: ['browser', {
preset: process.env.WDIO_PRESET,
rootDir: path.resolve(__dirname, '..'),
viteConfig: ({ command, mode }) => {
const env = loadEnv(mode, __dirname, '')
return {
// vite config
define: {
WDIO_ENV_TEST: `${JSON.stringify(env.WDIO_ENV_TEST)}`,
TEST_COMMAND: `${JSON.stringify(command)}`
},
}
},
coverage: {
enabled: true,
// we skip some tests on Mac, therefor lower coverage treshold
functions: isMac ? 66 : 100
}
}],
mochaOpts: {
ui: 'bdd',
timeout: 150000
}
}