diff options
author | Chocobozzz <me@florianbigard.com> | 2021-08-30 16:24:25 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-09-01 15:06:46 +0200 |
commit | 3419e0e1fe8e48a08b63ca0ded31087f913eb2b6 (patch) | |
tree | 63ac7190b79194e93aec9bbfd3c336e60f469e9d /client/e2e/wdio.browserstack.conf.ts | |
parent | 2a4c9669d2d6ac6cd4ae43544698f826ae98080f (diff) | |
download | PeerTube-3419e0e1fe8e48a08b63ca0ded31087f913eb2b6.tar.gz PeerTube-3419e0e1fe8e48a08b63ca0ded31087f913eb2b6.tar.zst PeerTube-3419e0e1fe8e48a08b63ca0ded31087f913eb2b6.zip |
Migrate to webdriverio
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 | } | ||