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.
Files changed (186) hide show
  1. package/README.md +3 -2
  2. package/dist/Npm.js +80 -0
  3. package/dist/browsers/IBrowser.js +1 -0
  4. package/dist/browsers/factory.js +9 -0
  5. package/dist/browsers/puppeteer.js +158 -0
  6. package/dist/cli.js +17 -0
  7. package/dist/configuration/CommandLine.js +112 -0
  8. package/dist/configuration/Configuration.js +1 -0
  9. package/dist/configuration/ConfigurationValidator.js +79 -0
  10. package/dist/configuration/Option.js +1 -0
  11. package/dist/configuration/OptionValidationError.js +15 -0
  12. package/dist/configuration/indexedOptions.js +13 -0
  13. package/dist/configuration/options.js +191 -0
  14. package/dist/configuration/validators/OptionValidator.js +1 -0
  15. package/dist/configuration/validators/boolean.js +15 -0
  16. package/dist/configuration/validators/browser.js +11 -0
  17. package/dist/configuration/validators/fsEntry.js +70 -0
  18. package/dist/configuration/validators/index.js +20 -0
  19. package/dist/configuration/validators/integer.js +10 -0
  20. package/dist/configuration/validators/percent.js +17 -0
  21. package/dist/configuration/validators/regexp.js +20 -0
  22. package/dist/configuration/validators/string.js +7 -0
  23. package/dist/configuration/validators/timeout.js +24 -0
  24. package/dist/configuration/validators/url.js +8 -0
  25. package/dist/modes/ModeFunction.js +1 -0
  26. package/dist/modes/Modes.js +9 -0
  27. package/dist/modes/execute.js +27 -0
  28. package/dist/modes/help.js +3 -0
  29. package/dist/modes/log/ILogStorage.js +1 -0
  30. package/dist/modes/log/LogMetrics.js +9 -0
  31. package/dist/modes/log/LogReader.js +37 -0
  32. package/dist/modes/log/LogStorage.js +68 -0
  33. package/dist/modes/log/REserve.js +101 -0
  34. package/dist/modes/log/index.js +58 -0
  35. package/dist/modes/test/REserve.js +31 -0
  36. package/dist/modes/test/agent.js +8 -0
  37. package/dist/modes/test/browser.js +37 -0
  38. package/dist/modes/test/index.js +66 -0
  39. package/dist/modes/test/pageTask.js +145 -0
  40. package/dist/modes/test/report.js +3 -0
  41. package/dist/modes/test/server.js +109 -0
  42. package/dist/modes/version.js +11 -0
  43. package/dist/platform/Exit.js +139 -0
  44. package/dist/platform/FileSystem.js +13 -0
  45. package/dist/platform/Host.js +10 -0
  46. package/dist/platform/Http.js +38 -0
  47. package/dist/platform/Path.js +5 -0
  48. package/dist/platform/Process.js +133 -0
  49. package/dist/platform/Terminal.js +47 -0
  50. package/dist/platform/Thread.js +43 -0
  51. package/dist/platform/ZLib.js +7 -0
  52. package/dist/platform/assert.js +17 -0
  53. package/dist/platform/constants.js +5 -0
  54. package/dist/platform/environment.js +28 -0
  55. package/dist/platform/index.js +13 -0
  56. package/dist/platform/logger/ILogger.js +1 -0
  57. package/dist/platform/logger/allCompressed.js +54 -0
  58. package/dist/platform/logger/compress.js +277 -0
  59. package/dist/platform/logger/output/BaseLoggerOutput.js +158 -0
  60. package/dist/platform/logger/output/InteractiveLoggerOutput.js +102 -0
  61. package/dist/platform/logger/output/StaticLoggerOutput.js +32 -0
  62. package/dist/platform/logger/output/factory.js +10 -0
  63. package/dist/platform/logger/output.js +58 -0
  64. package/dist/platform/logger/proxy.js +6 -0
  65. package/dist/platform/logger/toInternalLogAttributes.js +22 -0
  66. package/dist/platform/logger/types.js +7 -0
  67. package/dist/platform/logger.js +138 -0
  68. package/dist/platform/mock.js +104 -0
  69. package/dist/platform/version.js +8 -0
  70. package/dist/platform/workerBootstrap.js +21 -0
  71. package/dist/reports/html.js +46 -0
  72. package/dist/types/AgentState.js +1 -0
  73. package/dist/types/CommonTestReportFormat.js +50 -0
  74. package/dist/types/IError.js +1 -0
  75. package/dist/types/IUserInterfaceController.js +1 -0
  76. package/dist/types/typeUtilities.js +1 -0
  77. package/dist/ui/agent.js +3 -0
  78. package/dist/ui/html-report.js +2 -0
  79. package/dist/ui/lib.js +1 -0
  80. package/dist/ui/log-viewer.js +2 -0
  81. package/dist/utils/node/Folder.js +28 -0
  82. package/dist/utils/node/FramedStreamReader.js +86 -0
  83. package/dist/utils/node/FramedStreamWriter.js +27 -0
  84. package/dist/utils/shared/ProgressBar.js +43 -0
  85. package/dist/utils/shared/TestReportBuilder.js +48 -0
  86. package/dist/utils/shared/memoize.js +19 -0
  87. package/dist/utils/shared/object.js +8 -0
  88. package/dist/utils/shared/parallelize.js +59 -0
  89. package/dist/utils/shared/string.js +23 -0
  90. package/dist/utils/shared/toIError.js +17 -0
  91. package/package.json +73 -50
  92. package/.releaserc +0 -5
  93. package/index.js +0 -175
  94. package/jest.config.json +0 -31
  95. package/src/add-test-pages.js +0 -67
  96. package/src/batch.js +0 -214
  97. package/src/browsers.js +0 -319
  98. package/src/capabilities/index.js +0 -204
  99. package/src/capabilities/tests/basic/iframe.html +0 -8
  100. package/src/capabilities/tests/basic/index.html +0 -12
  101. package/src/capabilities/tests/basic/index.js +0 -20
  102. package/src/capabilities/tests/basic/ui5.html +0 -24
  103. package/src/capabilities/tests/dynamic-include/index.js +0 -21
  104. package/src/capabilities/tests/dynamic-include/mix.html +0 -11
  105. package/src/capabilities/tests/dynamic-include/one.html +0 -11
  106. package/src/capabilities/tests/dynamic-include/post.js +0 -3
  107. package/src/capabilities/tests/dynamic-include/test.js +0 -1
  108. package/src/capabilities/tests/dynamic-include/two.html +0 -11
  109. package/src/capabilities/tests/index.js +0 -16
  110. package/src/capabilities/tests/local-storage/index.html +0 -16
  111. package/src/capabilities/tests/local-storage/index.js +0 -21
  112. package/src/capabilities/tests/screenshot/index.html +0 -23
  113. package/src/capabilities/tests/screenshot/index.js +0 -24
  114. package/src/capabilities/tests/scripts/coverage.html +0 -32
  115. package/src/capabilities/tests/scripts/iframe.html +0 -18
  116. package/src/capabilities/tests/scripts/index.js +0 -59
  117. package/src/capabilities/tests/scripts/qunit.html +0 -22
  118. package/src/capabilities/tests/scripts/testsuite.html +0 -10
  119. package/src/capabilities/tests/scripts/testsuite.js +0 -8
  120. package/src/capabilities/tests/timeout/index.html +0 -21
  121. package/src/capabilities/tests/timeout/index.js +0 -19
  122. package/src/capabilities/tests/traces/index.html +0 -18
  123. package/src/capabilities/tests/traces/index.js +0 -81
  124. package/src/capabilities/tests/ui5/focus.html +0 -89
  125. package/src/capabilities/tests/ui5/index.js +0 -39
  126. package/src/capabilities/tests/ui5/language.html +0 -50
  127. package/src/capabilities/tests/ui5/timezone.html +0 -27
  128. package/src/clean.js +0 -22
  129. package/src/cors.js +0 -21
  130. package/src/coverage.js +0 -384
  131. package/src/csv-reader.js +0 -36
  132. package/src/csv-writer.js +0 -55
  133. package/src/defaults/.nycrc.json +0 -4
  134. package/src/defaults/browser.js +0 -217
  135. package/src/defaults/happy-dom.js +0 -123
  136. package/src/defaults/jsdom/compatibility.js +0 -163
  137. package/src/defaults/jsdom/debug.js +0 -23
  138. package/src/defaults/jsdom/resource-loader.js +0 -44
  139. package/src/defaults/jsdom/sap.ui.test.matchers.visible.js +0 -39
  140. package/src/defaults/jsdom.js +0 -95
  141. package/src/defaults/json-report.js +0 -36
  142. package/src/defaults/junit-xml-report.js +0 -90
  143. package/src/defaults/playwright.js +0 -142
  144. package/src/defaults/puppeteer.js +0 -124
  145. package/src/defaults/report/common.js +0 -38
  146. package/src/defaults/report/decompress.js +0 -19
  147. package/src/defaults/report/default.html +0 -99
  148. package/src/defaults/report/main.js +0 -69
  149. package/src/defaults/report/progress.js +0 -60
  150. package/src/defaults/report/styles.css +0 -66
  151. package/src/defaults/report.js +0 -91
  152. package/src/defaults/scan-ui5.js +0 -26
  153. package/src/defaults/selenium-webdriver/chrome.js +0 -39
  154. package/src/defaults/selenium-webdriver/edge.js +0 -24
  155. package/src/defaults/selenium-webdriver/firefox.js +0 -30
  156. package/src/defaults/selenium-webdriver.js +0 -129
  157. package/src/defaults/text-report.js +0 -108
  158. package/src/defaults/webdriverio.js +0 -80
  159. package/src/end.js +0 -62
  160. package/src/endpoints.js +0 -219
  161. package/src/error.js +0 -54
  162. package/src/get-job-progress.js +0 -78
  163. package/src/handle.js +0 -43
  164. package/src/if.js +0 -10
  165. package/src/inject/jest2qunit.js +0 -289
  166. package/src/inject/opa-iframe-coverage.js +0 -22
  167. package/src/inject/post.js +0 -141
  168. package/src/inject/qunit-hooks.js +0 -107
  169. package/src/inject/qunit-redirect.js +0 -65
  170. package/src/inject/ui5-coverage.js +0 -33
  171. package/src/job-mode.js +0 -65
  172. package/src/job.js +0 -493
  173. package/src/npm.js +0 -136
  174. package/src/options.js +0 -95
  175. package/src/output.js +0 -739
  176. package/src/parallelize.js +0 -63
  177. package/src/qunit-hooks.js +0 -219
  178. package/src/report.js +0 -89
  179. package/src/reserve.js +0 -25
  180. package/src/start.js +0 -129
  181. package/src/symbols.js +0 -8
  182. package/src/tests.js +0 -183
  183. package/src/timeout.js +0 -53
  184. package/src/tools.js +0 -179
  185. package/src/ui5.js +0 -199
  186. package/src/unhandled.js +0 -32
@@ -1,22 +0,0 @@
1
- (function () {
2
- 'use strict'
3
-
4
- const MODULE = 'ui5-test-runner/opa-iframe-coverage'
5
- if (window[MODULE]) {
6
- return // already installed
7
- }
8
- window[MODULE] = true
9
-
10
- if (window !== window.top || window !== window.parent) {
11
- // Inside an iframe
12
- Object.defineProperty(window, '__coverage__', {
13
- get () {
14
- return window.top.__coverage__
15
- },
16
- set (value) {
17
- window.top.__coverage__ = value
18
- return true
19
- }
20
- })
21
- }
22
- }())
@@ -1,141 +0,0 @@
1
- (function () {
2
- 'use strict'
3
-
4
- const MODULE = 'ui5-test-runner/post'
5
- if (window[MODULE]) {
6
- return // already installed
7
- }
8
-
9
- const base = window['ui5-test-runner/base-host'] || ''
10
- const probe = window['ui5-test-runner/probe'] || false
11
- const batchSize = !probe && (window['ui5-test-runner/batch'] || 0)
12
-
13
- let lastPost = Promise.resolve()
14
-
15
- function isUI5Object (obj) {
16
- return typeof obj === 'object' &&
17
- obj !== null &&
18
- typeof obj.getId === 'function' &&
19
- typeof obj.getMetadata === 'function'
20
- }
21
-
22
- function stringify (data) {
23
- const objects = []
24
- const referenced = []
25
- const ui5Summary = obj => {
26
- const id = obj.getId && obj.getId()
27
- const className = obj.getMetadata && obj.getMetadata() && obj.getMetadata().getName()
28
- return {
29
- 'ui5:class': className,
30
- 'ui5:id': id
31
- }
32
- }
33
- const simple = JSON.stringify(data, function (key, value) {
34
- if (typeof value === 'object' && value) {
35
- if (isUI5Object(value)) {
36
- return ui5Summary(value)
37
- }
38
- const id = objects.indexOf(value)
39
- if (id !== -1) {
40
- referenced[id] = true
41
- return null // Skip error and check all references
42
- }
43
- objects.push(value)
44
- }
45
- return value
46
- })
47
- if (referenced.length === 0) {
48
- return simple
49
- }
50
- const stringified = []
51
- return JSON.stringify(data, function (key, value) {
52
- if (typeof value === 'object' && value) {
53
- if (isUI5Object(value)) {
54
- return ui5Summary(value)
55
- }
56
- const id = objects.indexOf(value)
57
- if (referenced[id]) {
58
- if (stringified[id]) {
59
- return { 'circular:ref': id }
60
- }
61
- stringified[id] = true
62
- if (Array.isArray(value)) {
63
- return {
64
- 'circular:id': id,
65
- 'circular:array': [].concat(value) // 'new' object
66
- }
67
- }
68
- return {
69
- 'circular:id': id,
70
- ...value
71
- }
72
- }
73
- }
74
- return value
75
- })
76
- }
77
-
78
- window['ui5-test-runner/stringify'] = stringify
79
-
80
- const xPageUrl = top.location.toString()
81
-
82
- const nativeFetch = window.fetch
83
- let request
84
- if (nativeFetch) {
85
- request = async function (url, data) {
86
- const response = await nativeFetch(base + '/_/' + url, {
87
- method: 'POST',
88
- headers: {
89
- 'x-page-url': xPageUrl,
90
- 'content-type': 'application/json'
91
- },
92
- body: stringify(data)
93
- })
94
- if (response.status !== 200) {
95
- throw response.statusText
96
- }
97
- return response.text()
98
- }
99
- } else {
100
- const XHR = window.XMLHttpRequest
101
- request = function (url, data) {
102
- return new Promise(function (resolve, reject) {
103
- const xhr = new XHR()
104
- xhr.addEventListener('load', () => {
105
- resolve(xhr.responseText)
106
- })
107
- xhr.addEventListener('error', () => {
108
- reject(xhr.statusText)
109
- })
110
- xhr.open('POST', base + '/_/' + url)
111
- xhr.setRequestHeader('x-page-url', xPageUrl)
112
- xhr.setRequestHeader('content-type', 'application/json')
113
- const json = stringify(data)
114
- xhr.send(json)
115
- })
116
- }
117
- }
118
-
119
- function post (url, data) {
120
- lastPost = lastPost.then(() => request(url, data))
121
- if (!window.__unsafe__) {
122
- lastPost = lastPost
123
- .then(undefined, function (reason) {
124
- console.error('Failed to POST to ' + url + '\nreason: ' + reason.toString())
125
- })
126
- }
127
- return lastPost
128
- }
129
-
130
- const aggregatedData = []
131
-
132
- function batch (url, data) {
133
- aggregatedData.push([url, data])
134
- if (url === 'QUnit/done' || aggregatedData.length === batchSize) {
135
- post('QUnit/batch', [...aggregatedData])
136
- aggregatedData.length = 0
137
- }
138
- }
139
-
140
- window[MODULE] = batchSize ? batch : post
141
- }())
@@ -1,107 +0,0 @@
1
- /* Injected QUnit hooks */
2
- (function () {
3
- 'use strict'
4
-
5
- const MODULE = 'ui5-test-runner/qunit-hooks'
6
- if (window[MODULE]) {
7
- return // already installed
8
- }
9
- window[MODULE] = true
10
-
11
- const post = window['ui5-test-runner/post']
12
-
13
- function isOpa () {
14
- try {
15
- return !!window.sap.ui.test.Opa5
16
- } catch (e) {
17
- return false
18
- }
19
- }
20
-
21
- function getModules () {
22
- if (QUnit.config && QUnit.config.modules) {
23
- return QUnit.config.modules.map(({ name, moduleId, tests }) => ({
24
- name,
25
- moduleId,
26
- tests: tests.map(({ name, testId, skip }) => ({ name, testId, skip }))
27
- }))
28
- }
29
- return []
30
- }
31
-
32
- function extend (details) {
33
- details.isOpa = isOpa()
34
- details.modules = getModules()
35
- return details
36
- }
37
-
38
- function installQUnitHooks () {
39
- if (window !== window.top || window !== window.parent) {
40
- return // Do not install in iframe
41
- }
42
-
43
- QUnit.begin(function (details) {
44
- details.isOpa = isOpa()
45
- return post('QUnit/begin', details)
46
- })
47
-
48
- QUnit.testStart(function (details) {
49
- return post('QUnit/testStart', extend(details))
50
- })
51
-
52
- QUnit.log(function (log) {
53
- let ready = false
54
- const result = post('QUnit/log', extend(log))
55
- if (result && result.then) {
56
- result
57
- .then(undefined, function () {
58
- console.error('Failed to POST to QUnit/log (no timestamp)', log)
59
- })
60
- .then(function () {
61
- ready = true
62
- })
63
- if (isOpa()) {
64
- window.sap.ui.test.Opa5.prototype.waitFor({
65
- timeout: 10,
66
- autoWait: false, // Ignore interactable constraint
67
- check: function () {
68
- return ready
69
- }
70
- })
71
- }
72
- }
73
- })
74
-
75
- QUnit.testDone(function (report) {
76
- return post('QUnit/testDone', report)
77
- })
78
-
79
- QUnit.done(function (report) {
80
- if (window.__coverage__) {
81
- report.__coverage__ = window.__coverage__
82
- }
83
- return post('QUnit/done', report)
84
- })
85
- }
86
-
87
- if (typeof window.QUnit !== 'undefined' && QUnit.begin) {
88
- installQUnitHooks()
89
- } else {
90
- let QUnit
91
- let install = true
92
-
93
- Object.defineProperty(window, 'QUnit', {
94
- get: function () {
95
- return QUnit
96
- },
97
-
98
- set: function (value) {
99
- QUnit = value
100
- if (QUnit && QUnit.begin && install) {
101
- installQUnitHooks()
102
- install = false
103
- }
104
- }
105
- })
106
- }
107
- }())
@@ -1,65 +0,0 @@
1
- (function () {
2
- 'use strict'
3
-
4
- const MODULE = 'ui5-test-runner/qunit-redirect'
5
- if (window[MODULE]) {
6
- return // already installed
7
- }
8
- window[MODULE] = true
9
- window['ui5-test-runner/qunit-hooks'] = true // prevents qunit-hooks
10
-
11
- /* global suite */
12
-
13
- const post = window['ui5-test-runner/post']
14
-
15
- const pages = []
16
-
17
- function jsUnitTestSuite () {}
18
-
19
- jsUnitTestSuite.prototype.addTestPage = function (url) {
20
- pages.push(url)
21
- }
22
-
23
- window.jsUnitTestSuite = jsUnitTestSuite
24
-
25
- let QUnit
26
-
27
- Object.defineProperty(window, 'QUnit', {
28
- get: function () {
29
- return QUnit
30
- },
31
-
32
- set: function (value) {
33
- QUnit = value
34
-
35
- const { test } = QUnit
36
- if (typeof test === 'function') {
37
- QUnit.test = (label) => test(label, (assert) => assert.ok(true, label))
38
-
39
- let timeoutId
40
- QUnit.moduleDone(function () {
41
- if (timeoutId) {
42
- clearTimeout(timeoutId)
43
- }
44
- timeoutId = setTimeout(notify, 10)
45
- })
46
-
47
- function notify () {
48
- const moduleIds = QUnit.config.modules.map(({ moduleId }) => moduleId).filter(moduleId => !!moduleId)
49
- const moduleNames = QUnit.config.modules.map(({ name }) => name)
50
- const opa = !!window?.sap?.ui?.test?.Opa5
51
- post('addTestPages', { type: 'qunit', opa, module: { ids: moduleIds.length ? moduleIds : undefined, names: moduleNames }, page: location.toString() })
52
- }
53
- }
54
- }
55
- })
56
-
57
- window.addEventListener('load', function () {
58
- if (typeof suite === 'function') {
59
- suite()
60
- post('addTestPages', { type: 'suite', pages })
61
- } else if (!QUnit) {
62
- post('addTestPages', { type: 'none' })
63
- }
64
- })
65
- }())
@@ -1,33 +0,0 @@
1
- (function () {
2
- 'use strict'
3
-
4
- const MODULE = 'ui5-test-runner/ui5-coverage'
5
- if (window[MODULE]) {
6
- return // already installed
7
- }
8
- window[MODULE] = true
9
-
10
- // inspired from ui5/resources/sap/ui/qunit/qunit-coverage-istanbul-dbg.js
11
-
12
- function appendUrlParameter (url) {
13
- const urlObject = new URL(url, document.baseURI)
14
- urlObject.searchParams.set('instrument', 'true')
15
- return urlObject.toString()
16
- }
17
-
18
- const nativeSetAttribute = HTMLScriptElement.prototype.setAttribute
19
- HTMLScriptElement.prototype.setAttribute = function (name, value) {
20
- if (name === 'data-sap-ui-module') {
21
- this.src = appendUrlParameter(this.src)
22
- }
23
- nativeSetAttribute.apply(this, arguments)
24
- }
25
-
26
- const nativeXhrOpen = XMLHttpRequest.prototype.open
27
- XMLHttpRequest.prototype.open = function (method, url) {
28
- if (window.sap && window.sap.ui && window.sap.ui.loader && url && url.endsWith('.js')) {
29
- arguments[1] = appendUrlParameter(url)
30
- }
31
- nativeXhrOpen.apply(this, arguments)
32
- }
33
- }())
package/src/job-mode.js DELETED
@@ -1,65 +0,0 @@
1
- const { UTRError } = require('./error')
2
- const { $valueSources } = require('./symbols')
3
-
4
- function check (job, allowed, forbidden) {
5
- const valueSources = job[$valueSources]
6
- const incompatible = Object.keys(valueSources).filter(option => {
7
- const source = valueSources[option]
8
- return source === 'cli' && !option.startsWith('debug') &&
9
- (
10
- (allowed && !allowed.includes(option)) ||
11
- (forbidden && forbidden.includes(option))
12
- )
13
- })
14
- if (incompatible.length) {
15
- throw UTRError.MODE_INCOMPATIBLE_OPTION(incompatible.join(','))
16
- }
17
- }
18
-
19
- function buildAndCheckMode (job) {
20
- if (job.batch) {
21
- return 'batch'
22
- }
23
- if (job.capabilities) {
24
- check(job, [
25
- 'capabilities',
26
- 'cwd',
27
- 'port',
28
- 'logServer',
29
- 'browser',
30
- 'parallel',
31
- 'reportDir',
32
- 'pageTimeout',
33
- 'browserCloseTimeout',
34
- 'browserRetry',
35
- 'failFast',
36
- 'keepAlive',
37
- 'alternateNpmPath',
38
- 'outputInterval',
39
- 'screenshotTimeout',
40
- 'config',
41
- 'batchMode',
42
- 'batchId',
43
- 'batchLabel',
44
- 'ci',
45
- 'if'
46
- ])
47
- return 'capabilities'
48
- }
49
- if (job.url && job.url.length) {
50
- check(job, undefined, [
51
- 'testsuite'
52
- ])
53
- return 'url'
54
- }
55
- check(job, undefined, [
56
- 'coverageProxy',
57
- 'coverageProxyInclude',
58
- 'coverageProxyExclude'
59
- ])
60
- return 'legacy'
61
- }
62
-
63
- module.exports = {
64
- buildAndCheckMode
65
- }