ui5-test-runner 5.3.6 → 5.3.7
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 +4 -4
- package/src/capabilities/tests/scripts/index.js +2 -2
- package/src/capabilities/tests/ui5-focus/index.html +89 -0
- package/src/capabilities/tests/ui5-focus/index.js +12 -0
- package/src/inject/qunit-hooks.js +59 -35
- package/src/tests.js +0 -1
- package/src/inject/qunit-intercept.js +0 -38
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ui5-test-runner",
|
|
3
|
-
"version": "5.3.
|
|
3
|
+
"version": "5.3.7",
|
|
4
4
|
"description": "Standalone test runner for UI5",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"bin": {
|
|
@@ -49,8 +49,8 @@
|
|
|
49
49
|
"reserve": "2.0.5"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
|
-
"@openui5/types": "^1.130.
|
|
53
|
-
"@ui5/cli": "^4.0.
|
|
52
|
+
"@openui5/types": "^1.130.1",
|
|
53
|
+
"@ui5/cli": "^4.0.11",
|
|
54
54
|
"@ui5/middleware-code-coverage": "^2.0.1",
|
|
55
55
|
"dotenv": "^16.4.5",
|
|
56
56
|
"jest": "^29.7.0",
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
"rimraf": "^6.0.1",
|
|
60
60
|
"standard": "^17.1.2",
|
|
61
61
|
"start-server-and-test": "^2.0.8",
|
|
62
|
-
"typescript": "^5.
|
|
62
|
+
"typescript": "^5.7.2",
|
|
63
63
|
"ui5-tooling-transpile": "^3.5.1"
|
|
64
64
|
},
|
|
65
65
|
"optionalDependencies": {
|
|
@@ -25,7 +25,7 @@ module.exports = [{
|
|
|
25
25
|
label: 'Scripts (QUnit)',
|
|
26
26
|
for: capabilities => !!capabilities.scripts,
|
|
27
27
|
url: 'scripts/qunit.html',
|
|
28
|
-
scripts: ['
|
|
28
|
+
scripts: ['post.js', 'qunit-hooks.js'],
|
|
29
29
|
endpoint: qUnitEndpoints
|
|
30
30
|
}, {
|
|
31
31
|
label: 'Scripts (TestSuite)',
|
|
@@ -46,7 +46,7 @@ module.exports = [{
|
|
|
46
46
|
label: 'Scripts (External QUnit)',
|
|
47
47
|
for: capabilities => !!capabilities.scripts,
|
|
48
48
|
url: 'https://ui5.sap.com/test-resources/sap/m/demokit/orderbrowser/webapp/test/unit/unitTests.qunit.html',
|
|
49
|
-
scripts: ['
|
|
49
|
+
scripts: ['post.js', 'qunit-hooks.js'],
|
|
50
50
|
endpoint: qUnitEndpoints
|
|
51
51
|
}, {
|
|
52
52
|
label: 'Scripts (IFrame Coverage)',
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
|
|
2
|
+
<!DOCTYPE html>
|
|
3
|
+
<html>
|
|
4
|
+
<head>
|
|
5
|
+
<meta charset="utf-8">
|
|
6
|
+
<script id='sap-ui-bootstrap'
|
|
7
|
+
src='https://ui5.sap.com/resources/sap-ui-core.js'
|
|
8
|
+
data-sap-ui-libs='sap.m'
|
|
9
|
+
data-sap-ui-theme='sap_horizon'
|
|
10
|
+
data-sap-ui-compatVersion='edge'>
|
|
11
|
+
</script>
|
|
12
|
+
<script id="myXml" type="text/xmldata">
|
|
13
|
+
<mvc:View xmlns:mvc="sap.ui.core.mvc" xmlns="sap.m" controllerName="myController" displayBlock="true">
|
|
14
|
+
<App>
|
|
15
|
+
<Page title="Table Example">
|
|
16
|
+
<Table id="myTable"
|
|
17
|
+
items="{/items}"
|
|
18
|
+
mode="SingleSelectMaster"
|
|
19
|
+
>
|
|
20
|
+
<headerToolbar>
|
|
21
|
+
<Toolbar>
|
|
22
|
+
<Title text="Sample Table"/>
|
|
23
|
+
</Toolbar>
|
|
24
|
+
</headerToolbar>
|
|
25
|
+
<columns>
|
|
26
|
+
<Column>
|
|
27
|
+
<Text text="Name"/>
|
|
28
|
+
</Column>
|
|
29
|
+
<Column>
|
|
30
|
+
<Text text="Age"/>
|
|
31
|
+
</Column>
|
|
32
|
+
</columns>
|
|
33
|
+
<items>
|
|
34
|
+
<ColumnListItem>
|
|
35
|
+
<cells>
|
|
36
|
+
<Text text="{name}"/>
|
|
37
|
+
<Text text="{age}"/>
|
|
38
|
+
</cells>
|
|
39
|
+
</ColumnListItem>
|
|
40
|
+
</items>
|
|
41
|
+
</Table>
|
|
42
|
+
</Page>
|
|
43
|
+
</App>
|
|
44
|
+
</mvc:View>
|
|
45
|
+
</script>
|
|
46
|
+
<script>
|
|
47
|
+
sap.ui.require([
|
|
48
|
+
"sap/ui/core/mvc/Controller",
|
|
49
|
+
"sap/ui/core/mvc/XMLView",
|
|
50
|
+
"sap/m/Dialog",
|
|
51
|
+
"sap/m/Button"
|
|
52
|
+
], function (Controller, XMLView, Dialog, Button) {
|
|
53
|
+
Controller.extend("myController", {
|
|
54
|
+
onInit: function () {
|
|
55
|
+
var model = new sap.ui.model.json.JSONModel();
|
|
56
|
+
model.setData({
|
|
57
|
+
items: [
|
|
58
|
+
{name: "John Doe", age: 30},
|
|
59
|
+
{name: "Jane Smith", age: 25},
|
|
60
|
+
{name: "Max Mustermann", age: 40}
|
|
61
|
+
]
|
|
62
|
+
});
|
|
63
|
+
this.getView().setModel(model);
|
|
64
|
+
// Set focus on the second row
|
|
65
|
+
this.getView().byId("myTable").attachEventOnce("updateFinished", function() {
|
|
66
|
+
// Need to do it asynchronously or the first item is selected instead
|
|
67
|
+
setTimeout(() => {
|
|
68
|
+
const listItem = this.getItems()[1];
|
|
69
|
+
listItem.focus();
|
|
70
|
+
|
|
71
|
+
// Notify the test framework
|
|
72
|
+
const xhr = new XMLHttpRequest();
|
|
73
|
+
xhr.open('POST', '/_/log');
|
|
74
|
+
xhr.send(JSON.stringify({
|
|
75
|
+
'is-focus-set': document.activeElement.id === listItem.getFocusDomRef()?.id,
|
|
76
|
+
}));
|
|
77
|
+
}, 0);
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
XMLView.create({definition: jQuery('#myXml').html()}).then(function (oView) {
|
|
83
|
+
oView.placeAt(document.querySelector('body'));
|
|
84
|
+
});
|
|
85
|
+
});
|
|
86
|
+
</script>
|
|
87
|
+
</head>
|
|
88
|
+
<body class='sapUiBody'></body>
|
|
89
|
+
</html>
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
const assert = require('assert')
|
|
4
|
+
|
|
5
|
+
module.exports = [{
|
|
6
|
+
label: 'UI5 focus handling',
|
|
7
|
+
for: capabilities => !capabilities.modules.includes('jsdom'), // does not work on JSDOM
|
|
8
|
+
url: 'ui5-focus/index.html',
|
|
9
|
+
endpoint: ({ body }) => {
|
|
10
|
+
assert.strictEqual(body['is-focus-set'], true)
|
|
11
|
+
}
|
|
12
|
+
}]
|
|
@@ -35,43 +35,67 @@
|
|
|
35
35
|
return details
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
38
|
+
function installQUnitHooks () {
|
|
39
|
+
QUnit.begin(function (details) {
|
|
40
|
+
details.isOpa = isOpa()
|
|
41
|
+
return post('QUnit/begin', details)
|
|
42
|
+
})
|
|
43
|
+
|
|
44
|
+
QUnit.testStart(function (details) {
|
|
45
|
+
return post('QUnit/testStart', extend(details))
|
|
46
|
+
})
|
|
47
|
+
|
|
48
|
+
QUnit.log(function (log) {
|
|
49
|
+
let ready = false
|
|
50
|
+
post('QUnit/log', extend(log))
|
|
51
|
+
.then(undefined, function () {
|
|
52
|
+
console.error('Failed to POST to QUnit/log (no timestamp)', log)
|
|
53
|
+
})
|
|
54
|
+
.then(function () {
|
|
55
|
+
ready = true
|
|
56
|
+
})
|
|
57
|
+
if (isOpa()) {
|
|
58
|
+
window.sap.ui.test.Opa5.prototype.waitFor({
|
|
59
|
+
timeout: 10,
|
|
60
|
+
autoWait: false, // Ignore interactable constraint
|
|
61
|
+
check: function () {
|
|
62
|
+
return ready
|
|
63
|
+
}
|
|
64
|
+
})
|
|
65
|
+
}
|
|
66
|
+
})
|
|
67
|
+
|
|
68
|
+
QUnit.testDone(function (report) {
|
|
69
|
+
return post('QUnit/testDone', report)
|
|
70
|
+
})
|
|
71
|
+
|
|
72
|
+
QUnit.done(function (report) {
|
|
73
|
+
if (window.__coverage__) {
|
|
74
|
+
report.__coverage__ = window.__coverage__
|
|
75
|
+
}
|
|
76
|
+
return post('QUnit/done', report)
|
|
77
|
+
})
|
|
78
|
+
}
|
|
42
79
|
|
|
43
|
-
QUnit.
|
|
44
|
-
|
|
45
|
-
}
|
|
80
|
+
if (typeof window.QUnit !== 'undefined' && QUnit.begin) {
|
|
81
|
+
installQUnitHooks();
|
|
82
|
+
} else {
|
|
83
|
+
let QUnit
|
|
84
|
+
let install = true
|
|
46
85
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
window.sap.ui.test.Opa5.prototype.waitFor({
|
|
58
|
-
timeout: 10,
|
|
59
|
-
autoWait: false, // Ignore interactable constraint
|
|
60
|
-
check: function () {
|
|
61
|
-
return ready
|
|
86
|
+
Object.defineProperty(window, 'QUnit', {
|
|
87
|
+
get: function () {
|
|
88
|
+
return QUnit
|
|
89
|
+
},
|
|
90
|
+
|
|
91
|
+
set: function (value) {
|
|
92
|
+
QUnit = value
|
|
93
|
+
if (QUnit && QUnit.begin && install) {
|
|
94
|
+
installQUnitHooks()
|
|
95
|
+
install = false
|
|
62
96
|
}
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
QUnit.testDone(function (report) {
|
|
68
|
-
return post('QUnit/testDone', report)
|
|
69
|
-
})
|
|
97
|
+
}
|
|
98
|
+
})
|
|
99
|
+
}
|
|
70
100
|
|
|
71
|
-
QUnit.done(function (report) {
|
|
72
|
-
if (window.__coverage__) {
|
|
73
|
-
report.__coverage__ = window.__coverage__
|
|
74
|
-
}
|
|
75
|
-
return post('QUnit/done', report)
|
|
76
|
-
})
|
|
77
101
|
}())
|
package/src/tests.js
CHANGED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
/* Injected QUnit hooks */
|
|
2
|
-
(function () {
|
|
3
|
-
'use strict'
|
|
4
|
-
|
|
5
|
-
const MODULE = 'ui5-test-runner/qunit-intercept'
|
|
6
|
-
if (window[MODULE]) {
|
|
7
|
-
return // already installed
|
|
8
|
-
}
|
|
9
|
-
window[MODULE] = true
|
|
10
|
-
|
|
11
|
-
const callbacks = {}
|
|
12
|
-
const mock = new Proxy({}, {
|
|
13
|
-
get: function (instance, property) {
|
|
14
|
-
if (property !== 'version') {
|
|
15
|
-
return function (callback) {
|
|
16
|
-
callbacks[property] = callback
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
})
|
|
21
|
-
|
|
22
|
-
let QUnit = mock
|
|
23
|
-
|
|
24
|
-
Object.defineProperty(window, 'QUnit', {
|
|
25
|
-
get: function () {
|
|
26
|
-
return QUnit
|
|
27
|
-
},
|
|
28
|
-
|
|
29
|
-
set: function (value) {
|
|
30
|
-
QUnit = value
|
|
31
|
-
Object.keys(callbacks).forEach(property => {
|
|
32
|
-
if (typeof QUnit[property] === 'function') {
|
|
33
|
-
QUnit[property](callbacks[property])
|
|
34
|
-
}
|
|
35
|
-
})
|
|
36
|
-
}
|
|
37
|
-
})
|
|
38
|
-
}())
|