-
Notifications
You must be signed in to change notification settings - Fork 0
/
minimal.js
48 lines (42 loc) · 1.2 KB
/
minimal.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
const { Builder } = require('selenium-webdriver');
const {
default: getCapabilities,
BrowserFilter,
OperatingSystemFilter,
WindowsOperatingSystemVersionFilter,
OSXOperatingSystemVersionFilter
} = require('browserslist-browserstack');
(async () => {
const capabilities = await getCapabilities({
browserslist: {
queries: 'last 1 versions'
},
browsers: {
include: [BrowserFilter.FIREFOX, BrowserFilter.EDGE]
},
operatingSystems: {
include: [OperatingSystemFilter.WINDOWS, OperatingSystemFilter.OSX]
},
operatingSystemVersion: {
include: [
WindowsOperatingSystemVersionFilter.TEN,
OSXOperatingSystemVersionFilter.MOJAVE
]
},
formatForSelenium: true
});
for (const capability of capabilities) {
const driver = new Builder()
.usingServer('http://hub-cloud.browserstack.com/wd/hub')
.withCapabilities({
project: '<your-project-name>',
'browserstack.user': process.env.BROWSER_STACK_USER,
'browserstack.key': process.env.BROWSER_STACK_KEY,
...capability
})
.build();
await driver.get('https://www.google.com')
// do some tests.
await driver.quit();
}
})();