ui5-test-runner 1.1.4 → 2.0.0
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 +30 -12
- 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 +42 -0
- package/src/reserve.js +3 -2
- package/src/simulate.spec.js +437 -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/report.html +0 -202
- /package/{defaults → src/defaults}/nyc.json +0 -0
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
const { screenshot, stop } = require('./browsers')
|
|
4
|
+
const { collect } = require('./coverage')
|
|
5
|
+
const { UTRError } = require('./error')
|
|
6
|
+
const { getOutput } = require('./output')
|
|
7
|
+
const { basename } = require('path')
|
|
8
|
+
const { filename, stripUrlHash } = require('./tools')
|
|
9
|
+
|
|
10
|
+
function error (job, url, details = '') {
|
|
11
|
+
stop(job, url)
|
|
12
|
+
job.failed = true
|
|
13
|
+
throw UTRError.QUNIT_ERROR(details)
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
function get (job, urlWithHash, testId) {
|
|
17
|
+
const url = stripUrlHash(urlWithHash)
|
|
18
|
+
const page = job.qunitPages && job.qunitPages[url]
|
|
19
|
+
if (!page) {
|
|
20
|
+
error(job, url, `No QUnit page found for ${urlWithHash}`)
|
|
21
|
+
}
|
|
22
|
+
let test
|
|
23
|
+
if (testId !== undefined) {
|
|
24
|
+
page.modules.every(module => {
|
|
25
|
+
test = module.tests.find(test => test.testId === testId)
|
|
26
|
+
return test === undefined
|
|
27
|
+
})
|
|
28
|
+
if (!test) {
|
|
29
|
+
error(job, url, `No QUnit unit test found with id ${testId}`)
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
return { url, page, test }
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
module.exports = {
|
|
36
|
+
get,
|
|
37
|
+
|
|
38
|
+
async begin (job, urlWithHash, { isOpa, totalTests, modules }) {
|
|
39
|
+
const url = stripUrlHash(urlWithHash)
|
|
40
|
+
if (!totalTests || !modules) {
|
|
41
|
+
error(job, url, 'Invalid begin hook details')
|
|
42
|
+
}
|
|
43
|
+
if (!job.qunitPages) {
|
|
44
|
+
job.qunitPages = {}
|
|
45
|
+
}
|
|
46
|
+
const qunitPage = {
|
|
47
|
+
id: filename(url),
|
|
48
|
+
start: new Date(),
|
|
49
|
+
isOpa: !!isOpa,
|
|
50
|
+
failed: 0,
|
|
51
|
+
passed: 0,
|
|
52
|
+
count: totalTests,
|
|
53
|
+
modules
|
|
54
|
+
}
|
|
55
|
+
job.qunitPages[url] = qunitPage
|
|
56
|
+
},
|
|
57
|
+
|
|
58
|
+
async testStart (job, urlWithHash, { module, name, testId }) {
|
|
59
|
+
const { test } = get(job, urlWithHash, testId)
|
|
60
|
+
test.start = new Date()
|
|
61
|
+
},
|
|
62
|
+
|
|
63
|
+
async log (job, urlWithHash, { module, name, testId, ...log }) {
|
|
64
|
+
const { url, page, test } = get(job, urlWithHash, testId)
|
|
65
|
+
if (!test.logs) {
|
|
66
|
+
test.logs = []
|
|
67
|
+
}
|
|
68
|
+
test.logs.push(log)
|
|
69
|
+
if (page.isOpa && job.browserCapabilities.screenshot && job.screenshot) {
|
|
70
|
+
try {
|
|
71
|
+
const absoluteName = await screenshot(job, url, `${testId}-${log.runtime}`)
|
|
72
|
+
log.screenshot = basename(absoluteName)
|
|
73
|
+
} catch (error) {
|
|
74
|
+
getOutput(job).genericError(error, url)
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
},
|
|
78
|
+
|
|
79
|
+
async testDone (job, urlWithHash, { name, module, testId, assertions, ...report }) {
|
|
80
|
+
const { failed } = report
|
|
81
|
+
const { url, page, test } = get(job, urlWithHash, testId)
|
|
82
|
+
if (failed) {
|
|
83
|
+
if (job.browserCapabilities.screenshot) {
|
|
84
|
+
try {
|
|
85
|
+
await screenshot(job, url, testId)
|
|
86
|
+
} catch (error) {
|
|
87
|
+
getOutput(job).genericError(error, url)
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
++page.failed
|
|
91
|
+
job.failed = true
|
|
92
|
+
} else {
|
|
93
|
+
++page.passed
|
|
94
|
+
}
|
|
95
|
+
test.end = new Date()
|
|
96
|
+
test.report = report
|
|
97
|
+
},
|
|
98
|
+
|
|
99
|
+
async done (job, urlWithHash, report) {
|
|
100
|
+
const { url, page } = get(job, urlWithHash)
|
|
101
|
+
if (job.browserCapabilities.screenshot) {
|
|
102
|
+
try {
|
|
103
|
+
await screenshot(job, url, 'done')
|
|
104
|
+
} catch (error) {
|
|
105
|
+
getOutput(job).genericError(error, url)
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
if (report.__coverage__) {
|
|
109
|
+
collect(job, url, report.__coverage__)
|
|
110
|
+
delete report.__coverage__
|
|
111
|
+
}
|
|
112
|
+
page.end = new Date()
|
|
113
|
+
page.report = report
|
|
114
|
+
stop(job, url)
|
|
115
|
+
}
|
|
116
|
+
}
|