ui5-test-runner 4.5.0 → 4.5.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ui5-test-runner",
3
- "version": "4.5.0",
3
+ "version": "4.5.1",
4
4
  "description": "Standalone test runner for UI5",
5
5
  "main": "index.js",
6
6
  "bin": {
@@ -50,7 +50,7 @@
50
50
  "reserve": "^1.15.9"
51
51
  },
52
52
  "devDependencies": {
53
- "@openui5/types": "^1.122.1",
53
+ "@openui5/types": "^1.123.0",
54
54
  "@ui5/cli": "^3.9.2",
55
55
  "@ui5/middleware-code-coverage": "^1.1.1",
56
56
  "dotenv": "^16.4.5",
@@ -0,0 +1,38 @@
1
+ (function () {
2
+ /* global punybind, punyexpr */
3
+
4
+ const report = {}
5
+
6
+ report.elapsed = function (start, end = Date.now()) {
7
+ if (typeof end === 'string') {
8
+ end = new Date(end).getTime()
9
+ }
10
+ if (typeof start === 'string') {
11
+ start = new Date(start).getTime()
12
+ }
13
+ const ms = end - start
14
+ if (isNaN(ms)) {
15
+ return '-'
16
+ }
17
+ if (ms > 5000) {
18
+ const mins = Math.floor(ms / 60000)
19
+ const secs = Math.floor((ms % 60000) / 1000)
20
+ return `${mins.toString().padStart(2, 0)}:${secs.toString().padStart(2, 0)}`
21
+ }
22
+ return `${ms} ms`
23
+ }
24
+
25
+ let setReady
26
+ report.ready = new Promise(resolve => {
27
+ setReady = resolve
28
+ })
29
+
30
+ window.addEventListener('load', () => {
31
+ const safebind = punybind.use({
32
+ compiler: punyexpr
33
+ })
34
+ safebind(document.body).then(setReady)
35
+ })
36
+
37
+ window.report = report
38
+ }())
@@ -0,0 +1,97 @@
1
+ <html>
2
+ <head>
3
+ <title>ui5-test-runner</title>
4
+ <link rel="stylesheet" href="/_/report/styles.css">
5
+ <script src="/_/punyexpr.js"></script>
6
+ <script src="/_/punybind.js"></script>
7
+ <script src="/_/report/common.js"></script>
8
+ <script src="/_/report/main.js"></script>
9
+ </head>
10
+ <body>
11
+ <div {{if}}="!(qunitPage || qunitTest)">
12
+ <h1>{{ status || 'Test report' }}</h1>
13
+ <div {{if}}="end === undefined" class="elapsed">In progress since {{ elapsed(start) }}</div>
14
+ <div {{else}} class="elapsed">Duration : {{ elapsed(start, end) }} <a href="#" id="download">&#128230;</a></div>
15
+ <div {{if}}="timedOut">
16
+ &#9202;&#65039; Timed out
17
+ </div>
18
+ <table style="visibility: {{ testPageUrls.length > 0 ? 'visible' : 'hidden' }};">
19
+ <tr>
20
+ <th>&nbsp;</th>
21
+ <th class="count">Type</th>
22
+ <th class="status" style="width: 10rem;"><div><span>Status</span></div></th>
23
+ <th class="count">Tests</th>
24
+ <th class="count">Passed</th>
25
+ <th class="count">Failed</th>
26
+ <th class="elapsed">Elapsed</th>
27
+ </tr>
28
+ <tr {{for}}="url of testPageUrls">
29
+ <td class="truncated">
30
+ <span {{if}}="qunitPages === undefined || !qunitPages[url]">{{ url }}</span>
31
+ <a {{else}} href="#{{ qunitPages[url].id }}">{{ url }}</a>
32
+ </td>
33
+ <td>
34
+ <span {{if}}="!qunitPages[url]">-</span>
35
+ <span {{elseif}}="qunitPages[url].isOpa" title="OPA test">&#129404;</span>
36
+ <span {{elseif}}="qunitPages[url].start" title="Unit test">&#129514;</span>
37
+ </td>
38
+ <td>
39
+ <span {{if}}="!qunitPages[url]">-</span>
40
+ <span {{elseif}}="qunitPages[url].failed">&#10060;</span>
41
+ <span {{elseif}}="qunitPages[url].end">&#10004;&#65039;</span>
42
+ <span {{if}}="!qunitPages[url].end">
43
+ <progress max="{{ qunitPages[url].count }}" value="{{ qunitPages[url].failed + qunitPages[url].passed }}"></progress>
44
+ </span>
45
+ </td>
46
+ <td>{{ qunitPages[url] ? qunitPages[url].count : '-' }}</td>
47
+ <td>{{ qunitPages[url] ? qunitPages[url].passed : '-' }}</td>
48
+ <td>{{ qunitPages[url] ? qunitPages[url].failed : '-' }}</td>
49
+ <td>
50
+ <span {{if}}="!qunitPages[url]">-</span>
51
+ <span {{elseif}}="qunitPages[url].end === undefined">{{ elapsed(qunitPages[url].start) }}</span>
52
+ <span {{else}}>{{ elapsed(qunitPages[url].start, qunitPages[url].end) }}</span>
53
+ </td>
54
+ </tr>
55
+ </table>
56
+ </div>
57
+ <div {{if}}="qunitPage">
58
+ <h1 class="truncated">{{ qunitPage.url }}</h1>
59
+ <a href="#">&#9204; back to report</a>
60
+ <div {{if}}="qunitPage.end === undefined" class="elapsed">In progress since {{ elapsed(qunitPage.start) }}</div>
61
+ <div {{else}} class="elapsed">Duration : {{ elapsed(qunitPage.start, qunitPage.end) }}</div>
62
+ <div {{if}}="timedOut">
63
+ &#9202;&#65039; Timed out
64
+ </div>
65
+ <div {{for}}="module of qunitPage.modules">
66
+ <h2>{{ module.name }}</h2>
67
+ <div {{for}}="test of module.tests">
68
+ <a {{if}}="!test.skip" href="#{{ qunitPage.id }}-{{ test.testId }}">{{ test.name }}</a>
69
+ <span {{else}}>{{ test.name }}</span>
70
+ <span {{if}}="test.skip">&#9208;&#65039;</span>
71
+ <span {{elseif}}="!test.end" class="elapsed">{{ elapsed(test.start) }}</span>
72
+ <span {{elseif}}="test.report && !test.report.failed">&#10004;&#65039; {{ elapsed(test.start, test.end) }}</span>
73
+ <span {{elseif}}="test.report">&#10060; {{ elapsed(test.start, test.end) }}</span>
74
+ </div>
75
+ </div>
76
+ </div>
77
+ <div {{elseif}}="qunitTest">
78
+ <h1 class="truncated">{{ qunitTest.url }}</h1>
79
+ <a href="#">&#9204; back to report</a>
80
+ <h2>{{ qunitTest.module }}</h2>
81
+ <a href="#{{ qunitTest.pageId }}">&#9204; back to page</a>
82
+ <h3>{{ qunitTest.name }}
83
+ <span {{if}}="qunitTest.report && qunitTest.report.passed">&#10004;&#65039;</span>
84
+ <span {{elseif}}="qunitTest.report">&#10060;</span>
85
+ </h3>
86
+ <div {{if}}="qunitTest.end === undefined" class="elapsed">In progress since {{ elapsed(qunitTest.start) }}</div>
87
+ <div {{else}} class="elapsed">Duration : {{ elapsed(qunitTest.start, qunitTest.end) }}</div>
88
+ <div {{for}}="log of qunitTest.logs">
89
+ <pre {{if}}="log.result">&#10004;&#65039; {{ log.message }}</pre>
90
+ <pre {{else}}>&#10060; {{ log.message }}</pre>
91
+ <img {{if}}="log.screenshot" loading="lazy" class="log" src="{{ qunitTest.pageId }}/{{ log.screenshot }}" alt="Copy folder '{{ qunitTest.pageId }}' from the job report">
92
+ </div>
93
+ <img {{if}}="qunitTest.screenshot" loading="lazy" class="log" src="{{ qunitTest.pageId }}/{{ qunitTest.screenshot }}" alt="Copy folder '{{ qunitTest.pageId }}' from the job report">
94
+ </div>
95
+ <div style="display: {{ disconnected ? 'block' : 'none' }};">&#10060; Disconnected</div>
96
+ </body>
97
+ </html>
@@ -0,0 +1,69 @@
1
+ /* global report, job */
2
+ report.ready.then(update => {
3
+ const hashChange = hash => {
4
+ const [, pageId, testId] = (hash || '').match(/#?([^-]*)(?:-(.*))?/)
5
+ let [qunitPage, qunitTest] = [null, null]
6
+ if (pageId) {
7
+ const url = Object.keys(job.qunitPages).find(pageUrl => job.qunitPages[pageUrl].id === pageId)
8
+ if (!url) {
9
+ return
10
+ }
11
+ qunitPage = { url, ...job.qunitPages[url] }
12
+ if (testId) {
13
+ let test
14
+ let moduleName
15
+ qunitPage.modules.every(module => module.tests.every(candidate => {
16
+ if (candidate.testId === testId) {
17
+ moduleName = module.name
18
+ test = candidate
19
+ return false
20
+ }
21
+ return true
22
+ }))
23
+ qunitPage = null
24
+ if (test) {
25
+ qunitTest = {
26
+ url,
27
+ pageId,
28
+ module: moduleName,
29
+ ...test
30
+ }
31
+ }
32
+ }
33
+ }
34
+ update({
35
+ ...job,
36
+ qunitPage,
37
+ qunitTest,
38
+ elapsed: report.elapsed
39
+ })
40
+ }
41
+
42
+ window.addEventListener('hashchange', () => {
43
+ hashChange(location.hash)
44
+ })
45
+ if (window.location.href === 'about:srcdoc') {
46
+ window.addEventListener('click', (event) => {
47
+ const { href } = event.target
48
+ if (href) {
49
+ const lastHash = href.lastIndexOf('#')
50
+ hashChange(href.substring(lastHash))
51
+ }
52
+ event.preventDefault()
53
+ return false
54
+ })
55
+ }
56
+ hashChange(location.hash)
57
+
58
+ window.addEventListener('click', (event) => {
59
+ if (event.target.id === 'download') {
60
+ const link = this.document.createElement('a')
61
+ const blob = new Blob([JSON.stringify(job)], {
62
+ type: 'application/json'
63
+ })
64
+ link.setAttribute('href', URL.createObjectURL(blob))
65
+ link.setAttribute('download', 'ui5-test-runner-job.json')
66
+ link.click()
67
+ }
68
+ })
69
+ })
@@ -0,0 +1,60 @@
1
+ (function () {
2
+ /* global report */
3
+
4
+ report.ready.then(update => {
5
+ let lastState = {}
6
+
7
+ async function retry () {
8
+ try {
9
+ await fetch('/_/progress', { method: 'INFO' })
10
+ location.hash = ''
11
+ refresh()
12
+ } catch (e) {
13
+ setTimeout(retry, 250)
14
+ }
15
+ }
16
+
17
+ async function refresh () {
18
+ const [, page, test] = location.hash.match(/#?([^-]*)(?:-(.*))?/)
19
+ let url = '/_/progress'
20
+ if (page) {
21
+ url += `?page=${page}`
22
+ if (test) {
23
+ url += `&test=${test}`
24
+ }
25
+ }
26
+ let json
27
+ try {
28
+ const response = await fetch(url)
29
+ json = await response.json()
30
+ } catch (e) {
31
+ update({
32
+ ...lastState,
33
+ disconnected: true
34
+ })
35
+ retry()
36
+ return
37
+ }
38
+ if (test) {
39
+ lastState = {
40
+ qunitTest: json
41
+ }
42
+ } else if (page) {
43
+ lastState = {
44
+ qunitPage: json
45
+ }
46
+ } else {
47
+ lastState = {
48
+ ...json
49
+ }
50
+ }
51
+ update({
52
+ ...lastState,
53
+ disconnected: false,
54
+ elapsed: report.elapsed
55
+ })
56
+ setTimeout(refresh, 250)
57
+ }
58
+ refresh()
59
+ })
60
+ }())
@@ -0,0 +1,66 @@
1
+ body {
2
+ font-family: "Segoe UI", Arial, sans-serif;
3
+ }
4
+
5
+ h1 {
6
+ margin-bottom: 0;
7
+ }
8
+
9
+ h2 {
10
+ margin-bottom: 0;
11
+ }
12
+
13
+ h3 {
14
+ margin-bottom: 0;
15
+ }
16
+
17
+ progress {
18
+ width: 5rem;
19
+ }
20
+
21
+ th {
22
+ text-align: left;
23
+ }
24
+
25
+ th.count {
26
+ width: 5rem;
27
+ }
28
+
29
+ th.elapsed {
30
+ width: 6rem;
31
+ }
32
+
33
+ th.status {
34
+ width: 10rem;
35
+ }
36
+
37
+ a, a:hover {
38
+ color: black;
39
+ text-decoration: none;
40
+ }
41
+
42
+ a:hover {
43
+ text-decoration: underline;
44
+ text-decoration-style: dotted;
45
+ }
46
+
47
+ table {
48
+ table-layout: fixed;
49
+ width: 100%;
50
+ }
51
+
52
+ .truncated {
53
+ overflow: hidden;
54
+ text-overflow: ellipsis;
55
+ white-space: nowrap;
56
+ direction: rtl;
57
+ text-align: left;
58
+ }
59
+
60
+ img.log {
61
+ width: 50%;
62
+ }
63
+
64
+ img.log:hover {
65
+ width: unset;
66
+ }