diff options
Diffstat (limited to 'client/e2e/wdio.browserstack.conf.ts')
-rw-r--r-- | client/e2e/wdio.browserstack.conf.ts | 114 |
1 files changed, 114 insertions, 0 deletions
diff --git a/client/e2e/wdio.browserstack.conf.ts b/client/e2e/wdio.browserstack.conf.ts new file mode 100644 index 000000000..af3a454fc --- /dev/null +++ b/client/e2e/wdio.browserstack.conf.ts | |||
@@ -0,0 +1,114 @@ | |||
1 | import { config as mainConfig } from './wdio.main.conf' | ||
2 | |||
3 | const user = process.env.BROWSERSTACK_USER | ||
4 | const key = process.env.BROWSERSTACK_KEY | ||
5 | |||
6 | if (!user) throw new Error('Miss browser stack user') | ||
7 | if (!key) throw new Error('Miss browser stack key') | ||
8 | |||
9 | function buildMainOptions (sessionName: string) { | ||
10 | return { | ||
11 | projectName: 'PeerTube', | ||
12 | buildName: 'Main E2E - ' + new Date().toISOString().split('T')[0], | ||
13 | sessionName, | ||
14 | consoleLogs: 'info', | ||
15 | networkLogs: true | ||
16 | } | ||
17 | } | ||
18 | |||
19 | function buildBStackDesktopOptions (sessionName: string, resolution?: string) { | ||
20 | return { | ||
21 | 'bstack:options': { | ||
22 | ...buildMainOptions(sessionName), | ||
23 | |||
24 | resolution | ||
25 | } | ||
26 | } | ||
27 | } | ||
28 | |||
29 | function buildBStackMobileOptions (sessionName: string, deviceName: string, osVersion: string) { | ||
30 | return { | ||
31 | 'bstack:options': { | ||
32 | ...buildMainOptions(sessionName), | ||
33 | |||
34 | realMobile: true, | ||
35 | osVersion, | ||
36 | deviceName | ||
37 | } | ||
38 | } | ||
39 | } | ||
40 | |||
41 | module.exports = { | ||
42 | config: { | ||
43 | ...mainConfig, | ||
44 | |||
45 | user, | ||
46 | key, | ||
47 | |||
48 | maxInstances: 5, | ||
49 | |||
50 | capabilities: [ | ||
51 | { | ||
52 | browserName: 'Chrome', | ||
53 | |||
54 | ...buildBStackDesktopOptions('Latest Chrome Desktop', '1280x1024') | ||
55 | }, | ||
56 | { | ||
57 | browserName: 'Firefox', | ||
58 | browserVersion: '68', // ESR | ||
59 | |||
60 | ...buildBStackDesktopOptions('Firefox ESR Desktop', '1280x1024') | ||
61 | }, | ||
62 | { | ||
63 | browserName: 'Safari', | ||
64 | browserVersion: '11.1', | ||
65 | |||
66 | ...buildBStackDesktopOptions('Safari Desktop', '1280x1024') | ||
67 | }, | ||
68 | { | ||
69 | browserName: 'Firefox', | ||
70 | |||
71 | ...buildBStackDesktopOptions('Firefox Latest', '1280x1024') | ||
72 | }, | ||
73 | { | ||
74 | browserName: 'Edge', | ||
75 | |||
76 | ...buildBStackDesktopOptions('Edge Latest', '1280x1024') | ||
77 | }, | ||
78 | |||
79 | { | ||
80 | browserName: 'Chrome', | ||
81 | |||
82 | ...buildBStackMobileOptions('Latest Chrome Android', 'Samsung Galaxy S6', '5.0') | ||
83 | }, | ||
84 | { | ||
85 | browserName: 'Safari', | ||
86 | |||
87 | ...buildBStackMobileOptions('Safari iPhone', 'iPhone 8 Plus', '11') | ||
88 | }, | ||
89 | { | ||
90 | browserName: 'Safari', | ||
91 | |||
92 | ...buildBStackMobileOptions('Safari iPad', 'iPad 7th', '13') | ||
93 | } | ||
94 | ], | ||
95 | |||
96 | host: 'hub-cloud.browserstack.com', | ||
97 | connectionRetryTimeout: 240000, | ||
98 | waitforTimeout: 20000, | ||
99 | |||
100 | services: [ | ||
101 | [ | ||
102 | 'browserstack', { browserstackLocal: true } | ||
103 | ] | ||
104 | ], | ||
105 | |||
106 | after: function (result) { | ||
107 | if (result === 0) { | ||
108 | browser.executeScript('browserstack_executor: {"action": "setSessionStatus", "arguments": {"status":"passed","reason": ""}}', []) | ||
109 | } else { | ||
110 | browser.executeScript('browserstack_executor: {"action": "setSessionStatus", "arguments": {"status":"failed","reason": ""}}', []) | ||
111 | } | ||
112 | } | ||
113 | } as WebdriverIO.Config | ||
114 | } | ||