ui5-test-runner 5.13.0 → 6.0.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -2
- package/dist/Npm.js +80 -0
- package/dist/browsers/IBrowser.js +1 -0
- package/dist/browsers/factory.js +9 -0
- package/dist/browsers/puppeteer.js +158 -0
- package/dist/cli.js +17 -0
- package/dist/configuration/CommandLine.js +112 -0
- package/dist/configuration/Configuration.js +1 -0
- package/dist/configuration/ConfigurationValidator.js +79 -0
- package/dist/configuration/Option.js +1 -0
- package/dist/configuration/OptionValidationError.js +15 -0
- package/dist/configuration/indexedOptions.js +13 -0
- package/dist/configuration/options.js +191 -0
- package/dist/configuration/validators/OptionValidator.js +1 -0
- package/dist/configuration/validators/boolean.js +15 -0
- package/dist/configuration/validators/browser.js +11 -0
- package/dist/configuration/validators/fsEntry.js +70 -0
- package/dist/configuration/validators/index.js +20 -0
- package/dist/configuration/validators/integer.js +10 -0
- package/dist/configuration/validators/percent.js +17 -0
- package/dist/configuration/validators/regexp.js +20 -0
- package/dist/configuration/validators/string.js +7 -0
- package/dist/configuration/validators/timeout.js +24 -0
- package/dist/configuration/validators/url.js +8 -0
- package/dist/modes/ModeFunction.js +1 -0
- package/dist/modes/Modes.js +9 -0
- package/dist/modes/execute.js +27 -0
- package/dist/modes/help.js +3 -0
- package/dist/modes/log/ILogStorage.js +1 -0
- package/dist/modes/log/LogMetrics.js +9 -0
- package/dist/modes/log/LogReader.js +37 -0
- package/dist/modes/log/LogStorage.js +68 -0
- package/dist/modes/log/REserve.js +101 -0
- package/dist/modes/log/index.js +58 -0
- package/dist/modes/test/REserve.js +31 -0
- package/dist/modes/test/agent.js +8 -0
- package/dist/modes/test/browser.js +37 -0
- package/dist/modes/test/index.js +66 -0
- package/dist/modes/test/pageTask.js +145 -0
- package/dist/modes/test/report.js +3 -0
- package/dist/modes/test/server.js +109 -0
- package/dist/modes/version.js +11 -0
- package/dist/platform/Exit.js +139 -0
- package/dist/platform/FileSystem.js +13 -0
- package/dist/platform/Host.js +10 -0
- package/dist/platform/Http.js +38 -0
- package/dist/platform/Path.js +5 -0
- package/dist/platform/Process.js +133 -0
- package/dist/platform/Terminal.js +47 -0
- package/dist/platform/Thread.js +43 -0
- package/dist/platform/ZLib.js +7 -0
- package/dist/platform/assert.js +17 -0
- package/dist/platform/constants.js +5 -0
- package/dist/platform/environment.js +28 -0
- package/dist/platform/index.js +13 -0
- package/dist/platform/logger/ILogger.js +1 -0
- package/dist/platform/logger/allCompressed.js +54 -0
- package/dist/platform/logger/compress.js +277 -0
- package/dist/platform/logger/output/BaseLoggerOutput.js +158 -0
- package/dist/platform/logger/output/InteractiveLoggerOutput.js +102 -0
- package/dist/platform/logger/output/StaticLoggerOutput.js +32 -0
- package/dist/platform/logger/output/factory.js +10 -0
- package/dist/platform/logger/output.js +58 -0
- package/dist/platform/logger/proxy.js +6 -0
- package/dist/platform/logger/toInternalLogAttributes.js +22 -0
- package/dist/platform/logger/types.js +7 -0
- package/dist/platform/logger.js +138 -0
- package/dist/platform/mock.js +104 -0
- package/dist/platform/version.js +8 -0
- package/dist/platform/workerBootstrap.js +21 -0
- package/dist/reports/html.js +46 -0
- package/dist/types/AgentState.js +1 -0
- package/dist/types/CommonTestReportFormat.js +50 -0
- package/dist/types/IError.js +1 -0
- package/dist/types/IUserInterfaceController.js +1 -0
- package/dist/types/typeUtilities.js +1 -0
- package/dist/ui/agent.js +3 -0
- package/dist/ui/html-report.js +2 -0
- package/dist/ui/lib.js +1 -0
- package/dist/ui/log-viewer.js +2 -0
- package/dist/utils/node/Folder.js +28 -0
- package/dist/utils/node/FramedStreamReader.js +86 -0
- package/dist/utils/node/FramedStreamWriter.js +27 -0
- package/dist/utils/shared/ProgressBar.js +43 -0
- package/dist/utils/shared/TestReportBuilder.js +48 -0
- package/dist/utils/shared/memoize.js +19 -0
- package/dist/utils/shared/object.js +8 -0
- package/dist/utils/shared/parallelize.js +59 -0
- package/dist/utils/shared/string.js +23 -0
- package/dist/utils/shared/toIError.js +17 -0
- package/package.json +73 -50
- package/.releaserc +0 -5
- package/index.js +0 -175
- package/jest.config.json +0 -31
- package/src/add-test-pages.js +0 -67
- package/src/batch.js +0 -214
- package/src/browsers.js +0 -319
- package/src/capabilities/index.js +0 -204
- package/src/capabilities/tests/basic/iframe.html +0 -8
- package/src/capabilities/tests/basic/index.html +0 -12
- package/src/capabilities/tests/basic/index.js +0 -20
- package/src/capabilities/tests/basic/ui5.html +0 -24
- package/src/capabilities/tests/dynamic-include/index.js +0 -21
- package/src/capabilities/tests/dynamic-include/mix.html +0 -11
- package/src/capabilities/tests/dynamic-include/one.html +0 -11
- package/src/capabilities/tests/dynamic-include/post.js +0 -3
- package/src/capabilities/tests/dynamic-include/test.js +0 -1
- package/src/capabilities/tests/dynamic-include/two.html +0 -11
- package/src/capabilities/tests/index.js +0 -16
- package/src/capabilities/tests/local-storage/index.html +0 -16
- package/src/capabilities/tests/local-storage/index.js +0 -21
- package/src/capabilities/tests/screenshot/index.html +0 -23
- package/src/capabilities/tests/screenshot/index.js +0 -24
- package/src/capabilities/tests/scripts/coverage.html +0 -32
- package/src/capabilities/tests/scripts/iframe.html +0 -18
- package/src/capabilities/tests/scripts/index.js +0 -59
- package/src/capabilities/tests/scripts/qunit.html +0 -22
- package/src/capabilities/tests/scripts/testsuite.html +0 -10
- package/src/capabilities/tests/scripts/testsuite.js +0 -8
- package/src/capabilities/tests/timeout/index.html +0 -21
- package/src/capabilities/tests/timeout/index.js +0 -19
- package/src/capabilities/tests/traces/index.html +0 -18
- package/src/capabilities/tests/traces/index.js +0 -81
- package/src/capabilities/tests/ui5/focus.html +0 -89
- package/src/capabilities/tests/ui5/index.js +0 -39
- package/src/capabilities/tests/ui5/language.html +0 -50
- package/src/capabilities/tests/ui5/timezone.html +0 -27
- package/src/clean.js +0 -22
- package/src/cors.js +0 -21
- package/src/coverage.js +0 -384
- package/src/csv-reader.js +0 -36
- package/src/csv-writer.js +0 -55
- package/src/defaults/.nycrc.json +0 -4
- package/src/defaults/browser.js +0 -217
- package/src/defaults/happy-dom.js +0 -123
- package/src/defaults/jsdom/compatibility.js +0 -163
- package/src/defaults/jsdom/debug.js +0 -23
- package/src/defaults/jsdom/resource-loader.js +0 -44
- package/src/defaults/jsdom/sap.ui.test.matchers.visible.js +0 -39
- package/src/defaults/jsdom.js +0 -95
- package/src/defaults/json-report.js +0 -36
- package/src/defaults/junit-xml-report.js +0 -90
- package/src/defaults/playwright.js +0 -142
- package/src/defaults/puppeteer.js +0 -124
- package/src/defaults/report/common.js +0 -38
- package/src/defaults/report/decompress.js +0 -19
- package/src/defaults/report/default.html +0 -99
- package/src/defaults/report/main.js +0 -69
- package/src/defaults/report/progress.js +0 -60
- package/src/defaults/report/styles.css +0 -66
- package/src/defaults/report.js +0 -91
- package/src/defaults/scan-ui5.js +0 -26
- package/src/defaults/selenium-webdriver/chrome.js +0 -39
- package/src/defaults/selenium-webdriver/edge.js +0 -24
- package/src/defaults/selenium-webdriver/firefox.js +0 -30
- package/src/defaults/selenium-webdriver.js +0 -129
- package/src/defaults/text-report.js +0 -108
- package/src/defaults/webdriverio.js +0 -80
- package/src/end.js +0 -62
- package/src/endpoints.js +0 -219
- package/src/error.js +0 -54
- package/src/get-job-progress.js +0 -78
- package/src/handle.js +0 -43
- package/src/if.js +0 -10
- package/src/inject/jest2qunit.js +0 -289
- package/src/inject/opa-iframe-coverage.js +0 -22
- package/src/inject/post.js +0 -141
- package/src/inject/qunit-hooks.js +0 -107
- package/src/inject/qunit-redirect.js +0 -65
- package/src/inject/ui5-coverage.js +0 -33
- package/src/job-mode.js +0 -65
- package/src/job.js +0 -493
- package/src/npm.js +0 -136
- package/src/options.js +0 -95
- package/src/output.js +0 -739
- package/src/parallelize.js +0 -63
- package/src/qunit-hooks.js +0 -219
- package/src/report.js +0 -89
- package/src/reserve.js +0 -25
- package/src/start.js +0 -129
- package/src/symbols.js +0 -8
- package/src/tests.js +0 -183
- package/src/timeout.js +0 -53
- package/src/tools.js +0 -179
- package/src/ui5.js +0 -199
- package/src/unhandled.js +0 -32
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
|
|
3
|
-
const log = (attributes) => {
|
|
4
|
-
console.log(JSON.stringify(attributes, (key, value) => {
|
|
5
|
-
if (key === 'headers' && typeof value === 'object') {
|
|
6
|
-
const literal = {}
|
|
7
|
-
value.forEach((headerValue, headerName) => {
|
|
8
|
-
literal[headerName] = headerValue
|
|
9
|
-
})
|
|
10
|
-
return literal
|
|
11
|
-
}
|
|
12
|
-
return value
|
|
13
|
-
}, 2))
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
require('./browser')({
|
|
17
|
-
metadata: {
|
|
18
|
-
name: 'happy-dom',
|
|
19
|
-
options: [
|
|
20
|
-
['--debug [flag]', 'Enable more traces', false]
|
|
21
|
-
],
|
|
22
|
-
capabilities: {
|
|
23
|
-
modules: ['happy-dom'],
|
|
24
|
-
scripts: true,
|
|
25
|
-
traces: ['multiplex']
|
|
26
|
-
}
|
|
27
|
-
},
|
|
28
|
-
|
|
29
|
-
async run ({
|
|
30
|
-
settings: { url, scripts, modules }
|
|
31
|
-
// options
|
|
32
|
-
}) {
|
|
33
|
-
const happyDom = require(modules['happy-dom'])
|
|
34
|
-
const { Browser } = happyDom
|
|
35
|
-
const browser = new Browser({
|
|
36
|
-
settings: {
|
|
37
|
-
fetch: {
|
|
38
|
-
interceptor: {
|
|
39
|
-
beforeAsyncRequest: async ({ request: { method, url, headers } }) => {
|
|
40
|
-
log({
|
|
41
|
-
timestamp: new Date().toISOString(),
|
|
42
|
-
channel: 'network',
|
|
43
|
-
type: 'request',
|
|
44
|
-
async: true,
|
|
45
|
-
request: { method, url, headers }
|
|
46
|
-
})
|
|
47
|
-
},
|
|
48
|
-
beforeSyncRequest: ({ request: { method, url, headers } }) => {
|
|
49
|
-
log({
|
|
50
|
-
timestamp: new Date().toISOString(),
|
|
51
|
-
channel: 'network',
|
|
52
|
-
type: 'request',
|
|
53
|
-
async: false,
|
|
54
|
-
request: { method, url, headers }
|
|
55
|
-
})
|
|
56
|
-
},
|
|
57
|
-
afterAsyncResponse: async ({ request: { method, url, headers }, response, window }) => {
|
|
58
|
-
const body = await response.text()
|
|
59
|
-
log({
|
|
60
|
-
timestamp: new Date().toISOString(),
|
|
61
|
-
channel: 'network',
|
|
62
|
-
type: 'response',
|
|
63
|
-
async: true,
|
|
64
|
-
request: { method, url, headers },
|
|
65
|
-
response: {
|
|
66
|
-
...response,
|
|
67
|
-
body
|
|
68
|
-
}
|
|
69
|
-
})
|
|
70
|
-
return new window.Response(body, {
|
|
71
|
-
status: response.status,
|
|
72
|
-
statusText: response.statusText,
|
|
73
|
-
headers: response.headers
|
|
74
|
-
})
|
|
75
|
-
},
|
|
76
|
-
afterSyncResponse: ({ request: { method, url, headers }, response }) => {
|
|
77
|
-
log({
|
|
78
|
-
timestamp: new Date().toISOString(),
|
|
79
|
-
channel: 'network',
|
|
80
|
-
type: 'response',
|
|
81
|
-
async: false,
|
|
82
|
-
request: { method, url, headers },
|
|
83
|
-
response: {
|
|
84
|
-
...response,
|
|
85
|
-
body: response.body.toString('utf8')
|
|
86
|
-
}
|
|
87
|
-
})
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
},
|
|
92
|
-
console: {
|
|
93
|
-
error: (...args) => log({
|
|
94
|
-
timestamp: new Date().toISOString(),
|
|
95
|
-
channel: 'console',
|
|
96
|
-
type: 'error',
|
|
97
|
-
message: args.join(' ')
|
|
98
|
-
}),
|
|
99
|
-
warn: (...args) => log({
|
|
100
|
-
timestamp: new Date().toISOString(),
|
|
101
|
-
channel: 'console',
|
|
102
|
-
type: 'warning',
|
|
103
|
-
message: args.join(' ')
|
|
104
|
-
}),
|
|
105
|
-
info: (...args) => log({
|
|
106
|
-
timestamp: new Date().toISOString(),
|
|
107
|
-
channel: 'console',
|
|
108
|
-
type: 'info',
|
|
109
|
-
message: args.join(' ')
|
|
110
|
-
}),
|
|
111
|
-
log: (...args) => log({
|
|
112
|
-
timestamp: new Date().toISOString(),
|
|
113
|
-
channel: 'console',
|
|
114
|
-
type: 'log',
|
|
115
|
-
message: args.join(' ')
|
|
116
|
-
})
|
|
117
|
-
}
|
|
118
|
-
})
|
|
119
|
-
const page = browser.newPage()
|
|
120
|
-
scripts.forEach(script => page.mainFrame.window.eval(script))
|
|
121
|
-
page.goto(url)
|
|
122
|
-
}
|
|
123
|
-
})
|
|
@@ -1,163 +0,0 @@
|
|
|
1
|
-
const noop = () => {}
|
|
2
|
-
|
|
3
|
-
function fakeMatchMedia () {
|
|
4
|
-
return {
|
|
5
|
-
matches: false,
|
|
6
|
-
addListener: noop,
|
|
7
|
-
removeListener: noop
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
function wrapXHR ({ XMLHttpRequest }) {
|
|
12
|
-
const { open, send } = XMLHttpRequest.prototype
|
|
13
|
-
const $async = Symbol('async')
|
|
14
|
-
XMLHttpRequest.prototype.open = function (...args) {
|
|
15
|
-
const [method, url, async] = args
|
|
16
|
-
const log = () => {
|
|
17
|
-
const { status } = this
|
|
18
|
-
console.log(JSON.stringify({
|
|
19
|
-
timestamp: new Date().toISOString(),
|
|
20
|
-
channel: 'network',
|
|
21
|
-
initiator: 'xhr',
|
|
22
|
-
method,
|
|
23
|
-
url,
|
|
24
|
-
async,
|
|
25
|
-
status
|
|
26
|
-
}))
|
|
27
|
-
}
|
|
28
|
-
this.addEventListener('load', log)
|
|
29
|
-
this.addEventListener('error', log)
|
|
30
|
-
if (async === false) {
|
|
31
|
-
this[$async] = { method, url }
|
|
32
|
-
}
|
|
33
|
-
return open.call(this, ...args)
|
|
34
|
-
}
|
|
35
|
-
XMLHttpRequest.prototype.send = function (...args) {
|
|
36
|
-
if (this[$async]) {
|
|
37
|
-
const { method, url } = this[$async]
|
|
38
|
-
console.log(JSON.stringify({
|
|
39
|
-
timestamp: new Date().toISOString(),
|
|
40
|
-
channel: 'debug',
|
|
41
|
-
message: '>> XMLHttpRequest.prototype.send',
|
|
42
|
-
method,
|
|
43
|
-
url,
|
|
44
|
-
async: false
|
|
45
|
-
}))
|
|
46
|
-
}
|
|
47
|
-
const result = send.call(this, ...args)
|
|
48
|
-
if (this[$async]) {
|
|
49
|
-
const { method, url } = this[$async]
|
|
50
|
-
console.log(JSON.stringify({
|
|
51
|
-
timestamp: new Date().toISOString(),
|
|
52
|
-
channel: 'debug',
|
|
53
|
-
message: '<< XMLHttpRequest.prototype.send',
|
|
54
|
-
method,
|
|
55
|
-
url,
|
|
56
|
-
async: false
|
|
57
|
-
}))
|
|
58
|
-
}
|
|
59
|
-
return result
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
function adjustXPathResult ({ Document }) {
|
|
64
|
-
/* https://ui5.sap.com/resources/sap/ui/model/odata/AnnotationParser-dbg.js
|
|
65
|
-
getXPath: function() {
|
|
66
|
-
xmlNodes.length = xmlNodes.snapshotLength;
|
|
67
|
-
*/
|
|
68
|
-
const { evaluate } = Document.prototype
|
|
69
|
-
Document.prototype.evaluate = function () {
|
|
70
|
-
const result = evaluate.apply(this, arguments)
|
|
71
|
-
let length = result.length
|
|
72
|
-
Object.defineProperty(result, 'length', {
|
|
73
|
-
get: () => length,
|
|
74
|
-
set: (value) => {
|
|
75
|
-
length = value
|
|
76
|
-
return true
|
|
77
|
-
}
|
|
78
|
-
})
|
|
79
|
-
return result
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
function fixMatchesDontThrow ({ document }) {
|
|
84
|
-
/* https://github.com/jsdom/jsdom/issues/3057
|
|
85
|
-
Fix _nwsapiDontThrow which throws :-(
|
|
86
|
-
*/
|
|
87
|
-
const [impl] = Object.getOwnPropertySymbols(document)
|
|
88
|
-
const documentImpl = document[impl]
|
|
89
|
-
let _nwsapiDontThrow
|
|
90
|
-
Object.defineProperty(documentImpl, '_nwsapiDontThrow', {
|
|
91
|
-
get () {
|
|
92
|
-
return _nwsapiDontThrow
|
|
93
|
-
},
|
|
94
|
-
set (nwsapiDontThrow) {
|
|
95
|
-
_nwsapiDontThrow = nwsapiDontThrow
|
|
96
|
-
const { match } = nwsapiDontThrow
|
|
97
|
-
_nwsapiDontThrow.match = function () {
|
|
98
|
-
try {
|
|
99
|
-
return match.apply(this, arguments)
|
|
100
|
-
} catch (e) {
|
|
101
|
-
return false
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
return true
|
|
105
|
-
}
|
|
106
|
-
})
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
function fixCaseSensitiveSelectors ({ Document }) {
|
|
110
|
-
/* https://github.com/SAP/openui5/blob/f41ed5504db1dc576dae7e7d403aaa02b918fef5/src/sap.ui.core/src/ui5loader-autoconfig.js#L75
|
|
111
|
-
oResult = check(globalThis.document.querySelector('SCRIPT[src][id=sap-ui-bootstrap]'), rResources);
|
|
112
|
-
jsdom uses case sensitive implementation of querySelector
|
|
113
|
-
*/
|
|
114
|
-
const uppercaseTag = /\bSCRIPT\b/g
|
|
115
|
-
const { querySelector, querySelectorAll } = Document.prototype
|
|
116
|
-
Object.assign(Document.prototype, {
|
|
117
|
-
querySelector (selectors) {
|
|
118
|
-
const result = querySelector.call(this, selectors)
|
|
119
|
-
if (result === null && selectors.match(uppercaseTag)) {
|
|
120
|
-
console.log(JSON.stringify({
|
|
121
|
-
timestamp: new Date().toISOString(),
|
|
122
|
-
channel: 'debug',
|
|
123
|
-
message: 'overriding selectors upon empty result of document.querySelector',
|
|
124
|
-
selectors
|
|
125
|
-
}))
|
|
126
|
-
return querySelector.call(this, selectors.replace(uppercaseTag, tag => tag.toLowerCase()))
|
|
127
|
-
}
|
|
128
|
-
return result
|
|
129
|
-
},
|
|
130
|
-
|
|
131
|
-
querySelectorAll (selectors) {
|
|
132
|
-
const result = querySelectorAll.call(this, selectors) || { length: 0 }
|
|
133
|
-
if (result.length === 0 && selectors.match(uppercaseTag)) {
|
|
134
|
-
console.log(JSON.stringify({
|
|
135
|
-
timestamp: new Date().toISOString(),
|
|
136
|
-
channel: 'debug',
|
|
137
|
-
message: 'overriding selectors upon empty result of document.querySelectorAll',
|
|
138
|
-
selectors
|
|
139
|
-
}))
|
|
140
|
-
return querySelectorAll.call(this, selectors.replace(uppercaseTag, tag => tag.toLowerCase()))
|
|
141
|
-
}
|
|
142
|
-
return result
|
|
143
|
-
}
|
|
144
|
-
})
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
module.exports = window => {
|
|
148
|
-
window.addEventListener('error', event => {
|
|
149
|
-
const { message, filename, lineno, colno } = event
|
|
150
|
-
window.console.error(`${filename}@${lineno}:${colno}: ${message}`)
|
|
151
|
-
})
|
|
152
|
-
|
|
153
|
-
window.performance.timing = {
|
|
154
|
-
navigationStart: new Date().getTime(),
|
|
155
|
-
fetchStart: new Date().getTime()
|
|
156
|
-
}
|
|
157
|
-
window.matchMedia = window.matchMedia || fakeMatchMedia
|
|
158
|
-
|
|
159
|
-
wrapXHR(window)
|
|
160
|
-
adjustXPathResult(window)
|
|
161
|
-
fixMatchesDontThrow(window)
|
|
162
|
-
fixCaseSensitiveSelectors(window)
|
|
163
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
module.exports = window => {
|
|
2
|
-
// Proxify sap.ui to hook the loader and enable traces
|
|
3
|
-
window.sap = {
|
|
4
|
-
ui: new Proxy({}, {
|
|
5
|
-
get (obj, prop) {
|
|
6
|
-
return obj[prop]
|
|
7
|
-
},
|
|
8
|
-
set (obj, prop, value) {
|
|
9
|
-
obj[prop] = value
|
|
10
|
-
if (prop === 'loader') {
|
|
11
|
-
value._.logger = {
|
|
12
|
-
debug: (...args) => window.console.log('LOADER', ...args),
|
|
13
|
-
info: (...args) => window.console.info('LOADER', ...args),
|
|
14
|
-
warning: (...args) => window.console.warn('LOADER', ...args),
|
|
15
|
-
error: (...args) => window.console.error('LOADER', ...args),
|
|
16
|
-
isLoggable: () => true
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
return true
|
|
20
|
-
}
|
|
21
|
-
})
|
|
22
|
-
}
|
|
23
|
-
}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
module.exports = jsdom => {
|
|
2
|
-
const { ResourceLoader: JSDOMResourceLoader } = jsdom
|
|
3
|
-
|
|
4
|
-
const { readFile } = require('fs/promises')
|
|
5
|
-
const { join } = require('path')
|
|
6
|
-
|
|
7
|
-
class ResourceLoader extends JSDOMResourceLoader {
|
|
8
|
-
fetch (url, options) {
|
|
9
|
-
const request = super.fetch(url, options)
|
|
10
|
-
const log = reason => {
|
|
11
|
-
const { response } = request
|
|
12
|
-
let status
|
|
13
|
-
if (response === undefined) {
|
|
14
|
-
console.log(JSON.stringify({
|
|
15
|
-
timestamp: new Date().toISOString(),
|
|
16
|
-
channel: 'console',
|
|
17
|
-
type: 'error',
|
|
18
|
-
message: 'NETWORK ERROR : ' + (reason ? reason.toString() : 'unknown reason')
|
|
19
|
-
}))
|
|
20
|
-
status = 599
|
|
21
|
-
} else {
|
|
22
|
-
status = response.statusCode
|
|
23
|
-
}
|
|
24
|
-
console.log(JSON.stringify({
|
|
25
|
-
timestamp: new Date().toISOString(),
|
|
26
|
-
channel: 'network',
|
|
27
|
-
initiator: 'resource-loader',
|
|
28
|
-
method: 'GET',
|
|
29
|
-
url,
|
|
30
|
-
status
|
|
31
|
-
}))
|
|
32
|
-
}
|
|
33
|
-
request.then(log, log)
|
|
34
|
-
if (url.match(/sap\/ui\/test\/matchers\/Visible(-dbg)?.js/)) {
|
|
35
|
-
return request.then(() => {
|
|
36
|
-
return readFile(join(__dirname, 'sap.ui.test.matchers.visible.js'))
|
|
37
|
-
})
|
|
38
|
-
}
|
|
39
|
-
return request
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
return new ResourceLoader()
|
|
44
|
-
}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
/* Modified version of https://ui5.sap.com/resources/sap/ui/test/matchers/Visible-dbg.js */
|
|
2
|
-
/* see https://github.com/jsdom/jsdom/issues/1048 */
|
|
3
|
-
/* global sap, jQuery */
|
|
4
|
-
sap.ui.define(['sap/ui/test/matchers/Matcher'], function (Matcher) {
|
|
5
|
-
'use strict'
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* @class Checks if a controls domref is visible.
|
|
9
|
-
* @private
|
|
10
|
-
* @extends sap.ui.test.matchers.Matcher
|
|
11
|
-
* @name sap.ui.test.matchers.Visible
|
|
12
|
-
* @author SAP SE
|
|
13
|
-
* @since 1.34
|
|
14
|
-
*/
|
|
15
|
-
return Matcher.extend('sap.ui.test.matchers.Visible', /** @lends sap.ui.test.matchers.Visible.prototype */ {
|
|
16
|
-
isMatching: function (oControl) {
|
|
17
|
-
const oDomRef = oControl.$()
|
|
18
|
-
|
|
19
|
-
if (oDomRef.length) {
|
|
20
|
-
const isVisible = ref => ref.css('display') !== 'none' && ref.css('visibility') !== 'hidden'
|
|
21
|
-
if (!isVisible(oDomRef)) {
|
|
22
|
-
this._oLogger.debug("Control '" + oControl + "' is not visible")
|
|
23
|
-
return false
|
|
24
|
-
}
|
|
25
|
-
const parents = oDomRef.parents()
|
|
26
|
-
for (const parent of parents) {
|
|
27
|
-
if (!isVisible(jQuery(parent))) {
|
|
28
|
-
this._oLogger.debug("Control '" + oControl + "' is not visible (because of hidden parent)")
|
|
29
|
-
return false
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
return true
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
this._oLogger.debug("Control '" + oControl + "'' is not rendered")
|
|
36
|
-
return false
|
|
37
|
-
}
|
|
38
|
-
})
|
|
39
|
-
})
|
package/src/defaults/jsdom.js
DELETED
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
|
|
3
|
-
const { join } = require('path')
|
|
4
|
-
|
|
5
|
-
require('./browser')({
|
|
6
|
-
metadata: {
|
|
7
|
-
name: 'jsdom',
|
|
8
|
-
options: [
|
|
9
|
-
['--debug [flag]', 'Enable more traces', false]
|
|
10
|
-
],
|
|
11
|
-
capabilities: {
|
|
12
|
-
modules: ['jsdom'],
|
|
13
|
-
scripts: true,
|
|
14
|
-
traces: ['multiplex']
|
|
15
|
-
}
|
|
16
|
-
},
|
|
17
|
-
|
|
18
|
-
async run ({
|
|
19
|
-
settings: { url, scripts, modules },
|
|
20
|
-
options
|
|
21
|
-
}) {
|
|
22
|
-
const jsdom = require(modules.jsdom)
|
|
23
|
-
const { JSDOM, VirtualConsole } = jsdom
|
|
24
|
-
|
|
25
|
-
const virtualConsole = new VirtualConsole()
|
|
26
|
-
virtualConsole.on('jsdomError', (...args) => console.log(JSON.stringify({
|
|
27
|
-
timestamp: new Date().toISOString(),
|
|
28
|
-
channel: 'console',
|
|
29
|
-
type: 'jsdomError',
|
|
30
|
-
message: args.join(' ')
|
|
31
|
-
})))
|
|
32
|
-
virtualConsole.on('error', (...args) => console.log(JSON.stringify({
|
|
33
|
-
timestamp: new Date().toISOString(),
|
|
34
|
-
channel: 'console',
|
|
35
|
-
type: 'error',
|
|
36
|
-
message: args.join(' ')
|
|
37
|
-
})))
|
|
38
|
-
virtualConsole.on('warn', (...args) => console.log(JSON.stringify({
|
|
39
|
-
timestamp: new Date().toISOString(),
|
|
40
|
-
channel: 'console',
|
|
41
|
-
type: 'warning',
|
|
42
|
-
message: args.join(' ')
|
|
43
|
-
})))
|
|
44
|
-
virtualConsole.on('info', (...args) => console.log(JSON.stringify({
|
|
45
|
-
timestamp: new Date().toISOString(),
|
|
46
|
-
channel: 'console',
|
|
47
|
-
type: 'info',
|
|
48
|
-
message: args.join(' ')
|
|
49
|
-
})))
|
|
50
|
-
virtualConsole.on('log', (...args) => console.log(JSON.stringify({
|
|
51
|
-
timestamp: new Date().toISOString(),
|
|
52
|
-
channel: 'console',
|
|
53
|
-
type: 'log',
|
|
54
|
-
message: args.join(' ')
|
|
55
|
-
})))
|
|
56
|
-
|
|
57
|
-
let mainWindow
|
|
58
|
-
|
|
59
|
-
const beforeParse = (window) => {
|
|
60
|
-
if (mainWindow === undefined) {
|
|
61
|
-
mainWindow = window
|
|
62
|
-
} else {
|
|
63
|
-
Object.defineProperty(window, 'parent', {
|
|
64
|
-
value: mainWindow,
|
|
65
|
-
writable: false
|
|
66
|
-
})
|
|
67
|
-
}
|
|
68
|
-
require('./jsdom/compatibility')(window)
|
|
69
|
-
if (options.debug) {
|
|
70
|
-
require('./jsdom/debug')(window)
|
|
71
|
-
}
|
|
72
|
-
scripts.forEach(script => window.eval(script))
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
// https://github.com/jsdom/jsdom/issues/2920
|
|
76
|
-
const Window = require(join(modules.jsdom, 'lib/jsdom/browser/Window.js'))
|
|
77
|
-
const origCreate = Window.createWindow.bind(Window)
|
|
78
|
-
Window.createWindow = (...args) => {
|
|
79
|
-
const window = origCreate(...args)
|
|
80
|
-
window._virtualConsole = virtualConsole
|
|
81
|
-
beforeParse(window)
|
|
82
|
-
return window
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
JSDOM.fromURL(url, {
|
|
86
|
-
includeNodeLocations: true,
|
|
87
|
-
storageQuota: 10000000,
|
|
88
|
-
runScripts: 'dangerously',
|
|
89
|
-
pretendToBeVisual: true,
|
|
90
|
-
virtualConsole,
|
|
91
|
-
resources: require('./jsdom/resource-loader')(jsdom),
|
|
92
|
-
beforeParse
|
|
93
|
-
})
|
|
94
|
-
}
|
|
95
|
-
})
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
|
|
3
|
-
const { join, isAbsolute } = require('path')
|
|
4
|
-
const { writeFile } = require('fs').promises
|
|
5
|
-
const [,, reportDir] = process.argv
|
|
6
|
-
const verbose = process.argv.includes('--verbose')
|
|
7
|
-
|
|
8
|
-
const log = verbose ? console.log : () => {}
|
|
9
|
-
|
|
10
|
-
log('🏗 Building JSON report...')
|
|
11
|
-
|
|
12
|
-
async function main () {
|
|
13
|
-
const jobPath = isAbsolute(reportDir) ? reportDir : join(process.cwd(), reportDir)
|
|
14
|
-
log('📦 job path :', jobPath)
|
|
15
|
-
const rawJob = require(join(jobPath, 'job.js'))
|
|
16
|
-
const cleanJob = JSON.parse(JSON.stringify(rawJob, (key, value) => {
|
|
17
|
-
if (value && value instanceof RegExp) {
|
|
18
|
-
return value.toString()
|
|
19
|
-
}
|
|
20
|
-
return value
|
|
21
|
-
}))
|
|
22
|
-
const json = JSON.stringify(cleanJob, null, 2)
|
|
23
|
-
log('📦 json :', json.length)
|
|
24
|
-
|
|
25
|
-
await writeFile(join(reportDir, 'report.json'), json)
|
|
26
|
-
log('✅ generated.')
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
main()
|
|
30
|
-
.catch(reason => {
|
|
31
|
-
console.error(reason)
|
|
32
|
-
return -1
|
|
33
|
-
})
|
|
34
|
-
.then((code = 0) => {
|
|
35
|
-
process.exit(code)
|
|
36
|
-
})
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
|
|
3
|
-
// Based on specification from llg[.]cubic[.]org/docs/junit/
|
|
4
|
-
|
|
5
|
-
const { join, basename } = require('path')
|
|
6
|
-
const { writeFile } = require('fs').promises
|
|
7
|
-
const [, , reportDir] = process.argv
|
|
8
|
-
|
|
9
|
-
const output = []
|
|
10
|
-
function o (text) {
|
|
11
|
-
output.push(text)
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
function xmlEscape (text) {
|
|
15
|
-
return text.replace(/<|>|&|"/g, match => ({
|
|
16
|
-
'<': '<',
|
|
17
|
-
'>': '>',
|
|
18
|
-
'&': '&',
|
|
19
|
-
'"': '"'
|
|
20
|
-
}[match]))
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
async function main () {
|
|
24
|
-
const job = require(join(reportDir, 'job.js'))
|
|
25
|
-
o('<?xml version="1.0" encoding="UTF-8"?>')
|
|
26
|
-
o('<testsuites>')
|
|
27
|
-
const urls = Object.keys(job.qunitPages || {})
|
|
28
|
-
for (const url of urls) {
|
|
29
|
-
const qunitPage = job.qunitPages[url] || { modules: [] }
|
|
30
|
-
for (const module of qunitPage.modules) {
|
|
31
|
-
o(` <testsuite
|
|
32
|
-
name="${xmlEscape(url)}"
|
|
33
|
-
package="${xmlEscape(module.name)}"
|
|
34
|
-
tests="${module.tests.length}"
|
|
35
|
-
>`)
|
|
36
|
-
for (const test of module.tests) {
|
|
37
|
-
let time
|
|
38
|
-
if (test.start && test.end) {
|
|
39
|
-
time = (new Date(test.end) - new Date(test.start)) / 1000
|
|
40
|
-
}
|
|
41
|
-
o(` <testcase
|
|
42
|
-
name="${xmlEscape(test.name)}"
|
|
43
|
-
classname="${xmlEscape(module.name)}" ${
|
|
44
|
-
time === undefined
|
|
45
|
-
? ''
|
|
46
|
-
: `
|
|
47
|
-
time="${time}"`
|
|
48
|
-
}
|
|
49
|
-
>`)
|
|
50
|
-
if (test.screenshot) {
|
|
51
|
-
o(` <system-out>[[ATTACHMENT|${join(basename(reportDir), qunitPage.id, test.screenshot)}]]</system-out>`)
|
|
52
|
-
}
|
|
53
|
-
if (test.skip) {
|
|
54
|
-
o(' <skipped></skipped>')
|
|
55
|
-
} else if (!test.report) {
|
|
56
|
-
o(' <skipped>(no report found)</skipped>')
|
|
57
|
-
} else if (test.report.failed) {
|
|
58
|
-
test.logs
|
|
59
|
-
.filter(({ result }) => !result)
|
|
60
|
-
.forEach(log => {
|
|
61
|
-
if (log.message) {
|
|
62
|
-
o(` <failure
|
|
63
|
-
message="${xmlEscape(log.message)}"
|
|
64
|
-
>`)
|
|
65
|
-
} else {
|
|
66
|
-
o(' <failure>')
|
|
67
|
-
}
|
|
68
|
-
if (log.source) {
|
|
69
|
-
o(xmlEscape(log.source))
|
|
70
|
-
}
|
|
71
|
-
o(' </failure>')
|
|
72
|
-
})
|
|
73
|
-
}
|
|
74
|
-
o(' </testcase>')
|
|
75
|
-
}
|
|
76
|
-
o(' </testsuite>')
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
o('</testsuites>')
|
|
80
|
-
await writeFile(join(reportDir, process.env.JUNIT_XML_REPORT_FILENAME || 'junit.xml'), output.join('\n'))
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
main()
|
|
84
|
-
.catch(reason => {
|
|
85
|
-
console.error(reason)
|
|
86
|
-
return -1
|
|
87
|
-
})
|
|
88
|
-
.then((code = 0) => {
|
|
89
|
-
process.exit(code)
|
|
90
|
-
})
|