]>
Commit | Line | Data |
---|---|---|
3cf68b86 | 1 | import { onBrowserStackComplete, onBrowserStackPrepare } from './src/utils' |
3419e0e1 C |
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 | ||
a9536a4b | 20 | function buildBStackDesktopOptions (sessionName: string, resolution: string, os?: string) { |
3419e0e1 C |
21 | return { |
22 | 'bstack:options': { | |
23 | ...buildMainOptions(sessionName), | |
24 | ||
a9536a4b | 25 | os, |
3419e0e1 C |
26 | resolution |
27 | } | |
28 | } | |
29 | } | |
30 | ||
a9536a4b | 31 | function buildBStackMobileOptions (sessionName: string, deviceName: string, osVersion: string) { |
3419e0e1 C |
32 | return { |
33 | 'bstack:options': { | |
34 | ...buildMainOptions(sessionName), | |
35 | ||
36 | realMobile: true, | |
37 | osVersion, | |
a9536a4b | 38 | deviceName |
3419e0e1 C |
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', | |
748c6e4e | 60 | browserVersion: '78', // Very old ESR |
3419e0e1 | 61 | |
a9536a4b | 62 | ...buildBStackDesktopOptions('Firefox ESR Desktop', '1280x1024', 'Windows') |
3419e0e1 C |
63 | }, |
64 | { | |
65 | browserName: 'Safari', | |
92a6e85f | 66 | browserVersion: '12.1', |
3419e0e1 C |
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 | ||
d800ec5f | 84 | ...buildBStackMobileOptions('Latest Chrome Android', 'Samsung Galaxy S8', '7.0') |
3419e0e1 C |
85 | }, |
86 | { | |
87 | browserName: 'Safari', | |
88 | ||
748c6e4e | 89 | ...buildBStackMobileOptions('Safari iPhone', 'iPhone 8 Plus', '12.4') |
3419e0e1 C |
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 | ||
6d210220 C |
102 | specs: [ |
103 | // We don't want to test "local" tests | |
104 | './src/suites-all/*.e2e-spec.ts' | |
105 | ], | |
106 | ||
3419e0e1 C |
107 | services: [ |
108 | [ | |
109 | 'browserstack', { browserstackLocal: true } | |
110 | ] | |
111 | ], | |
112 | ||
6d210220 C |
113 | onWorkerStart: function (_cid, capabilities) { |
114 | if (capabilities['bstack:options'].realMobile === true) { | |
115 | capabilities['bstack:options'].local = false | |
3419e0e1 | 116 | } |
3cf68b86 C |
117 | }, |
118 | ||
119 | onPrepare: onBrowserStackPrepare, | |
120 | onComplete: onBrowserStackComplete | |
121 | ||
3419e0e1 C |
122 | } as WebdriverIO.Config |
123 | } |