-
-
Notifications
You must be signed in to change notification settings - Fork 37
/
web-test-runner.config.js
56 lines (53 loc) · 1.55 KB
/
web-test-runner.config.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
import { playwrightLauncher } from '@web/test-runner-playwright';
import { startServer } from './test-browser/githttpserver.js';
startServer();
export default {
files: [
'**/*.spec.js', // include `.spec.ts` files
'!./node_modules/**/*', // exclude any node modules
],
concurrency: 1,
watch: false,
testFramework: {
config: {
ui: 'bdd',
timeout: '5000',
},
},
testRunnerHtml: testRunnerImport =>
`<html>
<body>
<script type="module">
import { expect, assert} from 'https://cdn.jsdelivr.net/npm/[email protected]/+esm';
globalThis.assert = assert;
globalThis.expect = expect;
</script>
<script type="module" src="${testRunnerImport}"></script>
</body>
</html>`,
browsers: [
playwrightLauncher({ product: 'chromium', createBrowserContext: async ({ browser }) => {
const ctx = await browser.newContext({});
await ctx.route(/http:\/\/localhost:8000\/.*\.git\/.*/, async (route) => {
const url = route.request().url();
const response = await route.fetch({url: url.replace(':8000/', ':8080/')});
const body = await response.body();
await route.fulfill({ body });
});
return ctx;
}, }),
/*playwrightLauncher({
product: 'firefox', launchOptions: {
headless: false,
firefoxUserPrefs: {
'media.autoplay.block-webaudio': false
}
}
}),*/
/*playwrightLauncher({
product: 'webkit',launchOptions: {
headless: false
}
})*/
],
};