This repository has been archived by the owner on Nov 8, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbrowserstack.conf.js
126 lines (124 loc) · 2.82 KB
/
browserstack.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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
const axios = require('axios');
const { BROWSERSTACK_USERNAME, BROWSERSTACK_KEY, BROWSERSTACK_BUILD_ID } = process.env;
exports.config = {
user: BROWSERSTACK_USERNAME,
key: BROWSERSTACK_KEY,
capabilities: [
{
'device': 'iPhone X',
'os_version': '11.0',
'realMobile': 'true'
},
{
'device': 'iPhone 8',
'os_version': '11.0',
'realMobile': 'true'
},
{
'device': 'Samsung Galaxy S9',
'os_version': '8.0',
'realMobile': 'true'
},
{
'device': 'Google Pixel',
'os_version': '7.1',
'realMobile': 'true'
},
{
'device': 'Samsung Galaxy S8',
'os_version': '7.0',
'realMobile': 'true'
},
{
'device': 'Google Nexus 6',
'os_version': '6.0',
'realMobile': 'true'
},
{
'os': 'Windows',
'os_version': '10',
'browser': 'Chrome',
'resolution': '1920x1080'
},
{
'os': 'Windows',
'os_version': '10',
'browser': 'Firefox',
'browser_version': '61.0',
'resolution': '1920x1080'
},
{
'os': 'Windows',
'os_version': '10',
'browser': 'Edge',
'browser_version': '17.0',
'resolution': '1920x1080'
},
{
'os': 'Windows',
'os_version': '10',
'browser': 'IE',
'browser_version': '11.0',
'resolution': '1920x1080'
},
{
'os': 'OS X',
'os_version': 'High Sierra',
'browser': 'Safari',
'browser_version': '11.0',
'resolution': '1920x1080'
},
{
'os': 'OS X',
'os_version': 'Sierra',
'browser': 'Safari',
'browser_version': '10.0',
'resolution': '1024x768'
},
{
'os': 'OS X',
'os_version': 'High Sierra',
'browser': 'Firefox',
'browser_version': '61.0',
'resolution': '1920x1080'
},
{
'os': 'OS X',
'os_version': 'High Sierra',
'browser': 'Chrome',
'browser_version': '68.0',
'resolution': '1920x1080'
}
],
maxInstances: 10,
specs: [
'./specs/happyPath.js'
],
framework: 'mocha',
mochaOpts: {
ui: 'bdd',
timeout: 100000
},
before: function (capabilities, specs) {
console.log('Session running at:')
console.log(JSON.stringify(capabilities))
console.log(`https://www.browserstack.com/automate/builds/${BROWSERSTACK_BUILD_ID}/sessions/${browser.sessionId}`)
},
after: function (exitCode, capabilities, specs) {
const status = exitCode === 1 ? 'failed' : 'passed';
return axios.put(
`https://api.browserstack.com/automate/sessions/${browser.sessionId}.json`,
{ status },
{
auth: {
username: BROWSERSTACK_USERNAME,
password: BROWSERSTACK_KEY
}
}
)
.catch(err => {
console.error('Error updating status:');
console.error(err);
});
}
}