ui5-test-runner 1.1.5 → 2.0.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 +32 -188
- package/index.js +47 -16
- package/package.json +28 -10
- package/src/add-test-pages.js +35 -0
- package/src/add-test-pages.spec.js +95 -0
- package/src/browser.spec.js +724 -0
- package/src/browsers.js +220 -59
- package/src/capabilities/index.js +194 -0
- package/src/capabilities/tests/basic/iframe.html +8 -0
- package/src/capabilities/tests/basic/index.html +12 -0
- package/src/capabilities/tests/basic/index.js +20 -0
- package/src/capabilities/tests/basic/ui5.html +24 -0
- package/src/capabilities/tests/dynamic-include/index.js +21 -0
- package/src/capabilities/tests/dynamic-include/mix.html +11 -0
- package/src/capabilities/tests/dynamic-include/one.html +11 -0
- package/src/capabilities/tests/dynamic-include/post.js +3 -0
- package/src/capabilities/tests/dynamic-include/test.js +1 -0
- package/src/capabilities/tests/dynamic-include/two.html +11 -0
- package/src/capabilities/tests/index.js +16 -0
- package/src/capabilities/tests/local-storage/index.html +16 -0
- package/src/capabilities/tests/local-storage/index.js +21 -0
- package/src/capabilities/tests/screenshot/index.html +13 -0
- package/src/capabilities/tests/screenshot/index.js +18 -0
- package/src/capabilities/tests/scripts/index.js +50 -0
- package/src/capabilities/tests/scripts/qunit.html +22 -0
- package/src/capabilities/tests/scripts/testsuite.html +10 -0
- package/src/capabilities/tests/scripts/testsuite.js +8 -0
- package/src/capabilities/tests/timeout/index.html +21 -0
- package/src/capabilities/tests/timeout/index.js +19 -0
- package/src/capabilities/tests/traces/index.html +18 -0
- package/src/capabilities/tests/traces/index.js +81 -0
- package/src/cors.js +1 -1
- package/src/cors.spec.js +41 -0
- package/src/coverage.js +30 -18
- package/src/coverage.spec.js +79 -0
- package/src/csv-reader.js +36 -0
- package/src/csv-reader.spec.js +42 -0
- package/src/csv-writer.js +52 -0
- package/src/csv-writer.spec.js +77 -0
- package/src/defaults/browser.js +144 -0
- package/src/defaults/jsdom/compatibility.js +95 -0
- package/src/defaults/jsdom/debug.js +23 -0
- package/src/defaults/jsdom/resource-loader.js +43 -0
- package/src/defaults/jsdom/sap.ui.test.matchers.visible.js +39 -0
- package/src/defaults/jsdom.js +64 -0
- package/src/defaults/junit-xml-report.js +64 -0
- package/src/defaults/puppeteer.js +111 -0
- package/src/defaults/report/common.js +38 -0
- package/src/defaults/report/default.html +84 -0
- package/src/defaults/report/main.js +44 -0
- package/src/defaults/report/progress.js +49 -0
- package/src/defaults/report/styles.css +66 -0
- package/src/defaults/report.js +69 -0
- package/src/defaults/selenium-webdriver/chrome.js +38 -0
- package/src/defaults/selenium-webdriver/edge.js +25 -0
- package/src/defaults/selenium-webdriver/firefox.js +31 -0
- package/src/defaults/selenium-webdriver.js +138 -0
- package/src/endpoints.js +70 -124
- package/src/error.js +52 -0
- package/src/error.spec.js +17 -0
- package/src/get-job-progress.js +69 -0
- package/src/get-job-progress.spec.js +175 -0
- package/src/inject/post.js +96 -0
- package/src/inject/post.spec.js +147 -0
- package/src/inject/qunit-hooks.js +6 -21
- package/src/inject/qunit-intercept.js +30 -0
- package/src/inject/qunit-redirect.js +15 -7
- package/src/job-mode.js +45 -0
- package/src/job.js +254 -108
- package/src/job.spec.js +413 -0
- package/src/npm.js +73 -0
- package/src/npm.spec.js +98 -0
- package/src/options.js +73 -0
- package/src/options.spec.js +125 -0
- package/src/output.js +450 -131
- package/src/qunit-hooks.js +116 -0
- package/src/qunit-hooks.spec.js +687 -0
- package/src/report.js +47 -0
- package/src/reserve.js +3 -4
- package/src/simulate.spec.js +466 -0
- package/src/symbols.js +8 -0
- package/src/tests.js +127 -84
- package/src/timeout.spec.js +39 -0
- package/src/tools.js +111 -4
- package/src/tools.spec.js +90 -0
- package/src/ui5.js +3 -3
- package/src/unhandled.js +6 -6
- package/src/unhandled.spec.js +63 -0
- package/defaults/chromium.js +0 -62
- package/src/progress.html +0 -71
- package/src/proxies.js +0 -8
- package/src/report.html +0 -202
- /package/{defaults → src/defaults}/nyc.json +0 -0
package/src/progress.html
DELETED
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
<html>
|
|
2
|
-
<head>
|
|
3
|
-
<style>
|
|
4
|
-
|
|
5
|
-
body {
|
|
6
|
-
font-family: Verdana, Geneva, sans-serif;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
th {
|
|
10
|
-
text-align: left;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
</style>
|
|
14
|
-
<script>
|
|
15
|
-
|
|
16
|
-
const byId = id => document.getElementById(id)
|
|
17
|
-
|
|
18
|
-
async function refresh () {
|
|
19
|
-
try {
|
|
20
|
-
const response = await fetch('/_/progress')
|
|
21
|
-
const job = await response.json()
|
|
22
|
-
document.title = job.status
|
|
23
|
-
byId('status').innerHTML = job.status
|
|
24
|
-
if (job.testPageUrls) {
|
|
25
|
-
job.testPageUrls.forEach(url => {
|
|
26
|
-
let tr = byId(url)
|
|
27
|
-
if (!tr) {
|
|
28
|
-
tr = byId('pages').appendChild(byId('tpl').cloneNode(true))
|
|
29
|
-
tr.removeAttribute('style')
|
|
30
|
-
tr.id = url
|
|
31
|
-
tr.querySelector('td').appendChild(document.createTextNode(url))
|
|
32
|
-
}
|
|
33
|
-
const page = job.testPages[url]
|
|
34
|
-
if (page) {
|
|
35
|
-
const progress = tr.querySelector('progress')
|
|
36
|
-
if (page.total) {
|
|
37
|
-
progress.setAttribute('max', page.total)
|
|
38
|
-
}
|
|
39
|
-
if (page.passed || page.failed) {
|
|
40
|
-
progress.setAttribute('value', page.passed + page.failed)
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
})
|
|
44
|
-
}
|
|
45
|
-
} catch (e) {
|
|
46
|
-
console.log(e)
|
|
47
|
-
} finally {
|
|
48
|
-
setTimeout(refresh, 250)
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
</script>
|
|
53
|
-
</head>
|
|
54
|
-
<body onload="refresh()">
|
|
55
|
-
<h1 id="status"></h1>
|
|
56
|
-
<table>
|
|
57
|
-
<thead>
|
|
58
|
-
<tr>
|
|
59
|
-
<th>Page</th>
|
|
60
|
-
<th>Progress</th>
|
|
61
|
-
</tr>
|
|
62
|
-
<tr id="tpl" style="display: none;">
|
|
63
|
-
<td></td>
|
|
64
|
-
<td><progress value="0" max="0"></progress></td>
|
|
65
|
-
</tr>
|
|
66
|
-
</thead>
|
|
67
|
-
<tbody id='pages'>
|
|
68
|
-
</tbody>
|
|
69
|
-
</table>
|
|
70
|
-
</body>
|
|
71
|
-
</html>
|
package/src/proxies.js
DELETED
package/src/report.html
DELETED
|
@@ -1,202 +0,0 @@
|
|
|
1
|
-
<html>
|
|
2
|
-
<head>
|
|
3
|
-
<title>ui5-test-runner report</title>
|
|
4
|
-
<style>
|
|
5
|
-
|
|
6
|
-
body {
|
|
7
|
-
font-family: Verdana, Geneva, Tahoma, sans-serif;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
.testId {
|
|
11
|
-
padding-right: .5rem;
|
|
12
|
-
font-size: x-small;
|
|
13
|
-
color: gray;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
.runtime {
|
|
17
|
-
padding-left: .5rem;
|
|
18
|
-
padding-right: .5rem;
|
|
19
|
-
font-size: x-small;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
.runtime::after {
|
|
23
|
-
content: "ms"
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
.timestamp {
|
|
27
|
-
font-size: x-small;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
.timestamp::before {
|
|
31
|
-
content: "@"
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
.timestamp::after {
|
|
35
|
-
content: "ms"
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
img.log {
|
|
39
|
-
width: 50%;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
table.job {
|
|
43
|
-
font-size: small;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
table.job.object {
|
|
47
|
-
font-size: x-small;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
table.job th {
|
|
51
|
-
text-align: right;
|
|
52
|
-
padding-right: .5rem;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
pre {
|
|
56
|
-
margin-top: 0;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
</style>
|
|
60
|
-
</head>
|
|
61
|
-
<body>
|
|
62
|
-
<script>
|
|
63
|
-
const ok = '\u2714\ufe0f'
|
|
64
|
-
const ko = '\u274c'
|
|
65
|
-
|
|
66
|
-
function tx (content) {
|
|
67
|
-
return document.createTextNode(content)
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
function el (name, attributes = {}, ...children) {
|
|
71
|
-
const element = document.createElement(name)
|
|
72
|
-
Object.keys(attributes).forEach(attribute => {
|
|
73
|
-
element.setAttribute(attribute, attributes[attribute])
|
|
74
|
-
})
|
|
75
|
-
children
|
|
76
|
-
.filter(child => !!child)
|
|
77
|
-
.forEach(child => {
|
|
78
|
-
if (typeof child !== 'object') {
|
|
79
|
-
element.appendChild(tx(child.toString()))
|
|
80
|
-
} else {
|
|
81
|
-
element.appendChild(child)
|
|
82
|
-
}
|
|
83
|
-
})
|
|
84
|
-
return element
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
async function json (url) {
|
|
88
|
-
return (await fetch(url)).json()
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
async function generate () {
|
|
92
|
-
const job = await json('job.json')
|
|
93
|
-
let screenshot = false
|
|
94
|
-
let consoleLog = false
|
|
95
|
-
if (job.browserCapabilities) {
|
|
96
|
-
screenshot = job.browserCapabilities.screenshot
|
|
97
|
-
consoleLog = job.browserCapabilities.consoleLog
|
|
98
|
-
}
|
|
99
|
-
if (job.noScreenshot) {
|
|
100
|
-
screenshot = false
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
const jobDetails = document.body.appendChild(el('details'))
|
|
104
|
-
const jobSummary = jobDetails.appendChild(el('summary'))
|
|
105
|
-
jobSummary.appendChild(el('span', {}, 'job details'))
|
|
106
|
-
const jobParams = jobDetails.appendChild(el('table', { class: 'job' }))
|
|
107
|
-
|
|
108
|
-
function dump (obj, level) {
|
|
109
|
-
Object.keys(obj).forEach(property => {
|
|
110
|
-
const value = obj[property]
|
|
111
|
-
const tr = level.appendChild(el('tr'))
|
|
112
|
-
tr.appendChild(el('th', {}, property))
|
|
113
|
-
if (typeof value !== 'object') {
|
|
114
|
-
let stringifiedValue
|
|
115
|
-
if (typeof value === 'string') {
|
|
116
|
-
if (value.match(/\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z/)) {
|
|
117
|
-
stringifiedValue = new Date(value).toString()
|
|
118
|
-
} else {
|
|
119
|
-
stringifiedValue = value
|
|
120
|
-
}
|
|
121
|
-
} else {
|
|
122
|
-
stringifiedValue = JSON.stringify(value)
|
|
123
|
-
}
|
|
124
|
-
tr.appendChild(el('td', {}, stringifiedValue))
|
|
125
|
-
} else {
|
|
126
|
-
const subLevel = tr.appendChild(el('td')).appendChild(el('table', { class: 'job object' }))
|
|
127
|
-
dump(value, subLevel)
|
|
128
|
-
}
|
|
129
|
-
})
|
|
130
|
-
}
|
|
131
|
-
dump(job, jobParams)
|
|
132
|
-
|
|
133
|
-
const pages = await json('pages.json')
|
|
134
|
-
Object.keys(pages).forEach(async page => {
|
|
135
|
-
const pagePath = pages[page]
|
|
136
|
-
const pageDetails = document.body.appendChild(el('details'))
|
|
137
|
-
const pageSummary = pageDetails.appendChild(el('summary'))
|
|
138
|
-
pageSummary.appendChild(el('b', {}, page))
|
|
139
|
-
|
|
140
|
-
const pageReport = await json(`${pagePath}.json`)
|
|
141
|
-
const { isOpa, report, failed } = pageReport
|
|
142
|
-
if (!report || failed) {
|
|
143
|
-
pageSummary.appendChild(tx(ko))
|
|
144
|
-
} else {
|
|
145
|
-
pageSummary.appendChild(tx(ok))
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
const pageDetailsTable = pageDetails.appendChild(el('table', { width: '100%' }))
|
|
149
|
-
const addPageDetailsRow = module => {
|
|
150
|
-
const tr = pageDetailsTable.appendChild(el('tr'))
|
|
151
|
-
tr.innerHTML = `<td width="15%" valign="top">${module}</td><td width="85%"> </td>`
|
|
152
|
-
return tr
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
let lastModule
|
|
156
|
-
pageReport.order.forEach(testId => {
|
|
157
|
-
const { timestamps, report } = pageReport.tests[testId]
|
|
158
|
-
const { module, name, failed, assertions, runtime } = report
|
|
159
|
-
|
|
160
|
-
let displayModule = module
|
|
161
|
-
if (module !== lastModule) {
|
|
162
|
-
lastModule = module
|
|
163
|
-
} else {
|
|
164
|
-
displayModule = ' '
|
|
165
|
-
}
|
|
166
|
-
const pageAssertions = addPageDetailsRow(displayModule).querySelectorAll('td')[1].appendChild(el('details'))
|
|
167
|
-
pageAssertions.appendChild(el('summary', {}, name, el('span', { class: 'runtime' }, runtime), el('span', { class: 'testId' }, testId), failed ? ko : ''))
|
|
168
|
-
const validTimestamps = assertions.length === timestamps.length
|
|
169
|
-
assertions.forEach((assertion, index) => {
|
|
170
|
-
const bullet = assertion.result && ok || ko
|
|
171
|
-
const timestamp = timestamps[index]
|
|
172
|
-
let preview
|
|
173
|
-
if (isOpa && screenshot && validTimestamps) {
|
|
174
|
-
preview = el('img', { loading: 'lazy', src: `${pagePath}/${testId}-${timestamp}.png`, class: 'log' })
|
|
175
|
-
}
|
|
176
|
-
pageAssertions.appendChild(el('div', {}, el('div', { class: 'timestamp' }, timestamp), el('pre', {}, bullet + ' ' + assertion.message), preview))
|
|
177
|
-
})
|
|
178
|
-
})
|
|
179
|
-
|
|
180
|
-
if (report) {
|
|
181
|
-
addPageDetailsRow(`${report.runtime} ms`)
|
|
182
|
-
} else {
|
|
183
|
-
addPageDetailsRow(`Timed out ${ko}`)
|
|
184
|
-
}
|
|
185
|
-
if (screenshot) {
|
|
186
|
-
pageDetails.appendChild(el('a', { href: `${pagePath}/screenshot.png`, target: '_blank' }, 'screenshot'))
|
|
187
|
-
pageDetails.appendChild(el('span', {}, ' '))
|
|
188
|
-
}
|
|
189
|
-
if (consoleLog) {
|
|
190
|
-
pageDetails.appendChild(el('a', { href: `${pagePath}/console.txt`, target: '_blank' }, 'console'))
|
|
191
|
-
}
|
|
192
|
-
}, () => {
|
|
193
|
-
pageSummary.appendChild(tx(ko))
|
|
194
|
-
pageDetails.appendChild(el('p', {}, 'No report found ', el('i', {}, '(fatal error or timeout)')))
|
|
195
|
-
})
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
generate()
|
|
199
|
-
|
|
200
|
-
</script>
|
|
201
|
-
</body>
|
|
202
|
-
</html>
|
|
File without changes
|