-
Notifications
You must be signed in to change notification settings - Fork 4
/
web-test-runner.bs.config.mjs
46 lines (40 loc) · 1.3 KB
/
web-test-runner.bs.config.mjs
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
import { legacyPlugin } from '@web/dev-server-legacy';
import { browserstackLauncher } from '@web/test-runner-browserstack';
import browserslist from 'browserslist';
import browserslistBrowserstack from 'browserslist-browserstack';
import config from './web-test-runner.config.mjs';
const getCapabilities = browserslistBrowserstack.default;
function filterUniqueCapabilities(capabilities) {
return capabilities.filter((c) => (
c === capabilities.find((c2) => (
c2.browser === c.browser && c2.browser_version === c.browser_version
))
));
}
const allCapabilities = await getCapabilities({
username: process.env.BROWSERSTACK_USERNAME,
accessKey: process.env.BROWSERSTACK_ACCESS_KEY,
browserslist: { queries: browserslist() },
formatForSelenium: true,
});
const uniqueCapabilities = filterUniqueCapabilities(allCapabilities);
const browsers = uniqueCapabilities.map(capability => {
return browserstackLauncher({
capabilities: {
'browserstack.user': process.env.BROWSERSTACK_USERNAME,
'browserstack.key': process.env.BROWSERSTACK_ACCESS_KEY,
project: 'carehtml',
name: 'specs',
build: `carehtml local run at ${Date.now()}`,
...capability,
}
});
});
export default {
...config,
concurrentBrowsers: 5,
browsers,
plugins: [
legacyPlugin(),
],
};