Repository navigation
Expand file tree
/
Copy pathwdio.conf.js
More file actions
115 lines (109 loc) · 5.13 KB
/
Copy pathwdio.conf.js
File metadata and controls
115 lines (109 loc) · 5.13 KB
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
const shared = require('./wdio.shared.conf.js');
const process = require('process');
// BROWSERS_JSON lets CI point the e2e suite at an explicit browser set - e.g. the
// older browsers that the --ES5 build targets. Use `||` rather than `??`: an unset
// workflow input reaches us as the empty string, not as undefined.
const browsersFile = process.env.BROWSERS_JSON || 'browsers.json';
const allBrowsers = require(`./${browsersFile}`);
// An explicitly requested set is used as-is; the default matrix gets filtered.
const browsers = process.env.BROWSERS_JSON ? allBrowsers : Object.fromEntries(
Object.entries(allBrowsers)
.filter(([k, v]) => {
// run only on latest; exclude Safari
// (Webdriver's `browser.url(...)` times out on Safari if the page loads a video; does it wait for playback to complete?)
return v.browser_version === 'latest' && v.browser !== 'safari'
})
);
/**
* Specs that cannot pass on a given browser because of a limitation of the *creative*
* under test, rather than of prebid or of the ES5 bundle. Keyed by `browser@version`,
* so the modern matrix is unaffected.
*
* triplelift: their creative script - fixtured as
* test/fake-server/static/triplelift-ttj.js, standing in for the real `ttj` tag so the
* test does not break when they change it - builds a nested iframe and fills it with
* `document.open()/write()`. Prebid renders creatives inside an `iframe[srcdoc]`, and in
* a document whose ancestor is about:srcdoc, Firefox before 66 throws
* NS_ERROR_MALFORMED_URI from `document.open()`: it re-resolves the document URI and
* cannot parse about:srcdoc as a base. The ad iframe is left empty, so the creative
* never appears. Verified directly on firefox 65 - `contentWindow` is fine, and the
* same markup renders when handed to the iframe as `srcdoc` instead.
*
* That is a real limitation: triplelift bids would not render on firefox 65. Excluding
* the spec records it honestly instead of adjusting the fixture to hide it.
*/
const UNSUPPORTED_SPECS = {
'firefox@65.0': ['test/spec/e2e/triplelift_banner/**'],
};
function getCapabilities() {
function getPlatform(os) {
const platformMap = {
'Windows': 'WINDOWS',
'OS X': 'OS X',
}
return platformMap[os];
}
let capabilities = []
Object.values(browsers).forEach(browser => {
const exclude = UNSUPPORTED_SPECS[`${browser.browser}@${browser.browser_version}`];
capabilities.push({
browserName: browser.browser,
browserVersion: browser.browser_version,
...(exclude ? { exclude } : {}),
'bstack:options': {
os: getPlatform(browser.os),
osVersion: browser.os_version,
networkLogs: true,
consoleLogs: 'verbose',
buildName: process.env.BROWSERSTACK_BUILD_NAME,
projectName: process.env.BROWSERSTACK_PROJECT_NAME,
// Bind each session to *our* tunnel explicitly. Leaving this to the service to
// inject is not reliable: its SDK bootstrap fails on CI runners, and a session
// with no binding is free to pick any tunnel open on the account - including one
// belonging to an unrelated concurrent run, which is how results end up
// attributed to the wrong session.
//
// (Do not read anything into an empty `browser_console_logs_url`: browserstack
// captures console logs on chrome only. Firefox and safari sessions report "No
// messages were logged in this Session" even when they pass, so that is not
// evidence a session failed to reach the local server.)
local: true,
localIdentifier: process.env.BROWSERSTACK_LOCAL_IDENTIFIER
},
acceptInsecureCerts: true,
});
});
return capabilities;
}
exports.config = {
...shared.config,
services: [
['browserstack', {
// `testReporting`/`testReportingOptions` are accepted aliases for
// `testObservability`/`testObservabilityOptions`; the service maps them itself.
// These names carry the values run-tests.yml exports via the browserstack
// setup-env action, which would otherwise go unused - observability is on by
// default, so without them sessions just show up unnamed.
testReporting: true,
testReportingOptions: {
projectName: process.env.BROWSERSTACK_PROJECT_NAME,
buildName: process.env.BROWSERSTACK_BUILD_NAME
},
opts: {
// reuse the tunnel that setup-local already started in CI rather than
// opening a second one with an unrelated identifier
localIdentifier: process.env.BROWSERSTACK_LOCAL_IDENTIFIER
},
// CI's run-tests.yml already starts BrowserStackLocal (setup-local, which exports
// BROWSERSTACK_LOCAL_IDENTIFIER); starting a second binary against the same
// identifier is at best redundant. Manage the tunnel ourselves only when nobody
// else has.
browserstackLocal: !process.env.BROWSERSTACK_LOCAL_IDENTIFIER
}]
],
user: process.env.BROWSERSTACK_USERNAME,
key: process.env.BROWSERSTACK_ACCESS_KEY,
maxInstances: 5, // Do not increase this, since we have only 5 parallel tests in browserstack account
maxInstancesPerCapability: 1,
capabilities: getCapabilities(),
}