]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blob - client/e2e/wdio.browserstack.conf.ts
c3c1e2b34723c9eea2e3ec4fbea12b8cf84b5740
[github/Chocobozzz/PeerTube.git] / client / e2e / wdio.browserstack.conf.ts
1 import { onBrowserStackComplete, onBrowserStackPrepare } from './src/utils'
2 import { config as mainConfig } from './wdio.main.conf'
3
4 const user = process.env.BROWSERSTACK_USER
5 const key = process.env.BROWSERSTACK_KEY
6
7 if (!user) throw new Error('Miss browser stack user')
8 if (!key) throw new Error('Miss browser stack key')
9
10 function buildMainOptions (sessionName: string) {
11 return {
12 projectName: 'PeerTube',
13 buildName: 'Main E2E - ' + new Date().toISOString().split('T')[0],
14 sessionName,
15 consoleLogs: 'info',
16 networkLogs: true
17 }
18 }
19
20 function buildBStackDesktopOptions (sessionName: string, resolution: string, os?: string) {
21 return {
22 'bstack:options': {
23 ...buildMainOptions(sessionName),
24
25 os,
26 resolution
27 }
28 }
29 }
30
31 function buildBStackMobileOptions (sessionName: string, deviceName: string, osVersion: string) {
32 return {
33 'bstack:options': {
34 ...buildMainOptions(sessionName),
35
36 realMobile: true,
37 osVersion,
38 deviceName
39 }
40 }
41 }
42
43 module.exports = {
44 config: {
45 ...mainConfig,
46
47 user,
48 key,
49
50 maxInstances: 5,
51
52 capabilities: [
53 {
54 browserName: 'Chrome',
55
56 ...buildBStackDesktopOptions('Latest Chrome Desktop', '1280x1024')
57 },
58 {
59 browserName: 'Firefox',
60 browserVersion: '68', // Very old ESR
61
62 ...buildBStackDesktopOptions('Firefox ESR Desktop', '1280x1024', 'Windows')
63 },
64 {
65 browserName: 'Safari',
66 browserVersion: '12.1',
67
68 ...buildBStackDesktopOptions('Safari Desktop', '1280x1024')
69 },
70 {
71 browserName: 'Firefox',
72
73 ...buildBStackDesktopOptions('Firefox Latest', '1280x1024')
74 },
75 {
76 browserName: 'Edge',
77
78 ...buildBStackDesktopOptions('Edge Latest', '1280x1024')
79 },
80
81 {
82 browserName: 'Chrome',
83
84 ...buildBStackMobileOptions('Latest Chrome Android', 'Samsung Galaxy S8', '7.0')
85 },
86 {
87 browserName: 'Safari',
88
89 ...buildBStackMobileOptions('Safari iPhone', 'iPhone 7', '12')
90 },
91 {
92 browserName: 'Safari',
93
94 ...buildBStackMobileOptions('Safari iPad', 'iPad 7th', '13')
95 }
96 ],
97
98 host: 'hub-cloud.browserstack.com',
99 connectionRetryTimeout: 240000,
100 waitforTimeout: 20000,
101
102 specs: [
103 // We don't want to test "local" tests
104 './src/suites-all/*.e2e-spec.ts'
105 ],
106
107 services: [
108 [
109 'browserstack', { browserstackLocal: true }
110 ]
111 ],
112
113 onWorkerStart: function (_cid, capabilities) {
114 if (capabilities['bstack:options'].realMobile === true) {
115 capabilities['bstack:options'].local = false
116 }
117 },
118
119 onPrepare: onBrowserStackPrepare,
120 onComplete: onBrowserStackComplete
121
122 } as WebdriverIO.Config
123 }