@sap-ux/ui5-test-writer 0.4.0 → 0.5.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/dist/fiori-elements-opa-writer.d.ts +43 -0
- package/dist/fiori-elements-opa-writer.js +283 -0
- package/dist/fiori-freestyle-opa-writer.d.ts +14 -0
- package/dist/fiori-freestyle-opa-writer.js +166 -0
- package/dist/i18n.js +2 -3
- package/dist/index.d.ts +2 -33
- package/dist/index.js +5 -275
- package/dist/translations/ui5-test-writer.i18n.json +3 -1
- package/dist/types.d.ts +12 -0
- package/package.json +5 -3
- package/templates/freestyle/webapp/test/1.120.0/integration/AllJourneys.js +13 -0
- package/templates/freestyle/webapp/test/1.120.0/integration/NavigationJourney.js +23 -0
- package/templates/freestyle/webapp/test/1.120.0/integration/NavigationJourney.ts +34 -0
- package/templates/freestyle/webapp/test/1.120.0/integration/arrangements/Startup.js +25 -0
- package/templates/freestyle/webapp/test/1.120.0/integration/opaTests.qunit.html +29 -0
- package/templates/freestyle/webapp/test/1.120.0/integration/opaTests.qunit.js +7 -0
- package/templates/freestyle/webapp/test/1.120.0/integration/opaTests.qunit.ts +6 -0
- package/templates/freestyle/webapp/test/1.120.0/integration/pages/App.js +28 -0
- package/templates/freestyle/webapp/test/1.120.0/integration/pages/AppPage.ts +22 -0
- package/templates/freestyle/webapp/test/1.120.0/integration/pages/viewName.js +28 -0
- package/templates/freestyle/webapp/test/1.120.0/integration/pages/viewName.ts +23 -0
- package/templates/freestyle/webapp/test/1.120.0/unit/AllTests.js +5 -0
- package/templates/freestyle/webapp/test/1.120.0/unit/controller/viewName.controller.js +16 -0
- package/templates/freestyle/webapp/test/1.120.0/unit/controller/viewName.controller.ts +10 -0
- package/templates/freestyle/webapp/test/1.120.0/unit/unitTests.qunit.html +28 -0
- package/templates/freestyle/webapp/test/1.120.0/unit/unitTests.qunit.js +12 -0
- package/templates/freestyle/webapp/test/1.120.0/unit/unitTests.qunit.ts +10 -0
- package/templates/freestyle/webapp/test/1.71.0/integration/AllJourneys.js +13 -0
- package/templates/freestyle/webapp/test/1.71.0/integration/NavigationJourney.js +23 -0
- package/templates/freestyle/webapp/test/1.71.0/integration/NavigationJourney.ts +34 -0
- package/templates/freestyle/webapp/test/1.71.0/integration/arrangements/Startup.js +25 -0
- package/templates/freestyle/webapp/test/1.71.0/integration/opaTests.qunit.html +29 -0
- package/templates/freestyle/webapp/test/1.71.0/integration/opaTests.qunit.js +7 -0
- package/templates/freestyle/webapp/test/1.71.0/integration/opaTests.qunit.ts +10 -0
- package/templates/freestyle/webapp/test/1.71.0/integration/pages/App.js +28 -0
- package/templates/freestyle/webapp/test/1.71.0/integration/pages/AppPage.ts +22 -0
- package/templates/freestyle/webapp/test/1.71.0/integration/pages/viewName.js +28 -0
- package/templates/freestyle/webapp/test/1.71.0/integration/pages/viewName.ts +23 -0
- package/templates/freestyle/webapp/test/1.71.0/unit/AllTests.js +5 -0
- package/templates/freestyle/webapp/test/1.71.0/unit/controller/viewName.controller.js +16 -0
- package/templates/freestyle/webapp/test/1.71.0/unit/controller/viewName.controller.ts +10 -0
- package/templates/freestyle/webapp/test/1.71.0/unit/unitTests.qunit.html +27 -0
- package/templates/freestyle/webapp/test/1.71.0/unit/unitTests.qunit.js +12 -0
- package/templates/freestyle/webapp/test/1.71.0/unit/unitTests.qunit.ts +10 -0
- package/templates/freestyle/webapp/test/testsuite.qunit.js +16 -0
- package/templates/freestyle/webapp/test/testsuite.qunit.ts +14 -0
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/* @sapUiRequire */
|
|
2
|
+
QUnit.config.autostart = false;
|
|
3
|
+
|
|
4
|
+
// import all your QUnit tests here
|
|
5
|
+
void Promise.all([
|
|
6
|
+
import("sap/ui/core/Core"), // Required to wait until Core has booted to start the QUnit tests
|
|
7
|
+
import("unit/controller/<%= viewName %>Page.controller")
|
|
8
|
+
]).then(([{ default: Core }]) => {
|
|
9
|
+
QUnit.start();
|
|
10
|
+
});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
sap.ui.define([
|
|
2
|
+
"sap/ui/test/Opa5",
|
|
3
|
+
"./arrangements/Startup",
|
|
4
|
+
"./NavigationJourney"
|
|
5
|
+
], function (Opa5, Startup) {
|
|
6
|
+
"use strict";
|
|
7
|
+
|
|
8
|
+
Opa5.extendConfig({
|
|
9
|
+
arrangements: new Startup(),
|
|
10
|
+
viewNamespace: "<%= appId %>.view.",
|
|
11
|
+
autoWait: true
|
|
12
|
+
});
|
|
13
|
+
});
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/*global QUnit*/
|
|
2
|
+
|
|
3
|
+
sap.ui.define([
|
|
4
|
+
"sap/ui/test/opaQunit",
|
|
5
|
+
"./pages/App",
|
|
6
|
+
"./pages/<%= viewName %>"
|
|
7
|
+
], function (opaTest) {
|
|
8
|
+
"use strict";
|
|
9
|
+
|
|
10
|
+
QUnit.module("Navigation Journey");
|
|
11
|
+
|
|
12
|
+
opaTest("Should see the initial page of the app", function (Given, When, Then) {
|
|
13
|
+
// Arrangements
|
|
14
|
+
Given.iStartMyApp();
|
|
15
|
+
|
|
16
|
+
// Assertions
|
|
17
|
+
Then.onTheAppPage.iShouldSeeTheApp();
|
|
18
|
+
Then.onTheViewPage.iShouldSeeThePageView();
|
|
19
|
+
|
|
20
|
+
//Cleanup
|
|
21
|
+
Then.iTeardownMyApp();
|
|
22
|
+
});
|
|
23
|
+
});
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/*global QUnit*/
|
|
2
|
+
import opaTest from "sap/ui/test/opaQunit";
|
|
3
|
+
import AppPage from "./pages/AppPage";
|
|
4
|
+
import ViewPage from "./pages/<%= viewName %>Page";
|
|
5
|
+
|
|
6
|
+
import Opa5 from "sap/ui/test/Opa5";
|
|
7
|
+
|
|
8
|
+
QUnit.module("Navigation Journey");
|
|
9
|
+
|
|
10
|
+
const onTheAppPage = new AppPage();
|
|
11
|
+
const onTheViewPage = new ViewPage();
|
|
12
|
+
Opa5.extendConfig({
|
|
13
|
+
viewNamespace: "<%= appId %>.view.",
|
|
14
|
+
autoWait: true
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
opaTest("Should see the initial page of the app", function () {
|
|
18
|
+
// Arrangements
|
|
19
|
+
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
20
|
+
onTheAppPage.iStartMyUIComponent({
|
|
21
|
+
componentConfig: {
|
|
22
|
+
name: "<%= appId %>"
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
// Assertions
|
|
27
|
+
onTheAppPage.iShouldSeeTheApp();
|
|
28
|
+
onTheViewPage.iShouldSeeThePageView();
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
// Cleanup
|
|
32
|
+
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
33
|
+
onTheAppPage.iTeardownMyApp();
|
|
34
|
+
});
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
sap.ui.define([
|
|
2
|
+
"sap/ui/test/Opa5"
|
|
3
|
+
], function (Opa5) {
|
|
4
|
+
"use strict";
|
|
5
|
+
|
|
6
|
+
return Opa5.extend("integration.arrangements.Startup", {
|
|
7
|
+
|
|
8
|
+
iStartMyApp: function (oOptionsParameter) {
|
|
9
|
+
var oOptions = oOptionsParameter || {};
|
|
10
|
+
|
|
11
|
+
// start the app with a minimal delay to make tests fast but still async to discover basic timing issues
|
|
12
|
+
oOptions.delay = oOptions.delay || 50;
|
|
13
|
+
|
|
14
|
+
// start the app UI component
|
|
15
|
+
this.iStartMyUIComponent({
|
|
16
|
+
componentConfig: {
|
|
17
|
+
name: "<%= appId %>",
|
|
18
|
+
async: true
|
|
19
|
+
},
|
|
20
|
+
hash: oOptions.hash,
|
|
21
|
+
autoWait: oOptions.autoWait
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
});
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8" />
|
|
5
|
+
<title>Integration tests for Basic Template</title>
|
|
6
|
+
|
|
7
|
+
<script
|
|
8
|
+
id="sap-ui-bootstrap"
|
|
9
|
+
src="../../resources/sap-ui-core.js"
|
|
10
|
+
data-sap-ui-theme="<%= ui5Theme %>"
|
|
11
|
+
data-sap-ui-resourceroots='{
|
|
12
|
+
"<%= appId %>": "../../",
|
|
13
|
+
"integration": "./"
|
|
14
|
+
}'
|
|
15
|
+
data-sap-ui-animation="false"
|
|
16
|
+
data-sap-ui-compatVersion="edge"
|
|
17
|
+
data-sap-ui-async="true"
|
|
18
|
+
data-sap-ui-preload="async"
|
|
19
|
+
data-sap-ui-oninit="module:integration/opaTests.qunit">
|
|
20
|
+
</script>
|
|
21
|
+
<link rel="stylesheet" type="text/css" href="../../resources/sap/ui/thirdparty/qunit-2.css">
|
|
22
|
+
<script src="../../resources/sap/ui/thirdparty/qunit-2.js"></script>
|
|
23
|
+
<script src="../../resources/sap/ui/qunit/qunit-junit.js"></script>
|
|
24
|
+
</head>
|
|
25
|
+
<body>
|
|
26
|
+
<div id="qunit"></div>
|
|
27
|
+
<div id="qunit-fixture"></div>
|
|
28
|
+
</body>
|
|
29
|
+
</html>
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
sap.ui.define([
|
|
2
|
+
"sap/ui/test/Opa5"
|
|
3
|
+
], function (Opa5) {
|
|
4
|
+
"use strict";
|
|
5
|
+
var sViewName = "App";
|
|
6
|
+
|
|
7
|
+
Opa5.createPageObjects({
|
|
8
|
+
onTheAppPage: {
|
|
9
|
+
|
|
10
|
+
actions: {},
|
|
11
|
+
|
|
12
|
+
assertions: {
|
|
13
|
+
|
|
14
|
+
iShouldSeeTheApp: function () {
|
|
15
|
+
return this.waitFor({
|
|
16
|
+
id: "app",
|
|
17
|
+
viewName: sViewName,
|
|
18
|
+
success: function () {
|
|
19
|
+
Opa5.assert.ok(true, "The " + sViewName + " view is displayed");
|
|
20
|
+
},
|
|
21
|
+
errorMessage: "Did not find the " + sViewName + " view"
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
});
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import Opa5 from "sap/ui/test/Opa5";
|
|
2
|
+
|
|
3
|
+
const sViewName = "App";
|
|
4
|
+
|
|
5
|
+
export default class AppPage extends Opa5 {
|
|
6
|
+
// Actions
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
// Assertions
|
|
10
|
+
iShouldSeeTheApp() {
|
|
11
|
+
return this.waitFor({
|
|
12
|
+
id: "app",
|
|
13
|
+
viewName: sViewName,
|
|
14
|
+
success: function () {
|
|
15
|
+
Opa5.assert.ok(true, "The " + sViewName + " view is displayed");
|
|
16
|
+
},
|
|
17
|
+
errorMessage: "Did not find the " + sViewName + " view"
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
}
|
|
22
|
+
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
sap.ui.define([
|
|
2
|
+
"sap/ui/test/Opa5"
|
|
3
|
+
], function (Opa5) {
|
|
4
|
+
"use strict";
|
|
5
|
+
var sViewName = "<%= viewName %>";
|
|
6
|
+
|
|
7
|
+
Opa5.createPageObjects({
|
|
8
|
+
onTheViewPage: {
|
|
9
|
+
|
|
10
|
+
actions: {},
|
|
11
|
+
|
|
12
|
+
assertions: {
|
|
13
|
+
|
|
14
|
+
iShouldSeeThePageView: function () {
|
|
15
|
+
return this.waitFor({
|
|
16
|
+
id: "page",
|
|
17
|
+
viewName: sViewName,
|
|
18
|
+
success: function () {
|
|
19
|
+
Opa5.assert.ok(true, "The " + sViewName + " view is displayed");
|
|
20
|
+
},
|
|
21
|
+
errorMessage: "Did not find the " + sViewName + " view"
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
});
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import Opa5 from "sap/ui/test/Opa5";
|
|
2
|
+
|
|
3
|
+
const sViewName = "<%= viewName %>";
|
|
4
|
+
|
|
5
|
+
export default class <%= viewNamePage %> extends Opa5 {
|
|
6
|
+
// Actions
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
// Assertions
|
|
10
|
+
iShouldSeeThePageView() {
|
|
11
|
+
return this.waitFor({
|
|
12
|
+
id: "page",
|
|
13
|
+
viewName: sViewName,
|
|
14
|
+
success: function () {
|
|
15
|
+
Opa5.assert.ok(true, "The " + sViewName + " view is displayed");
|
|
16
|
+
},
|
|
17
|
+
errorMessage: "Did not find the " + sViewName + " view"
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/*global QUnit*/
|
|
2
|
+
|
|
3
|
+
sap.ui.define([
|
|
4
|
+
"<%= appIdWithSlash %>/controller/<%= viewName %>.controller"
|
|
5
|
+
], function (Controller) {
|
|
6
|
+
"use strict";
|
|
7
|
+
|
|
8
|
+
QUnit.module("<%= viewName %> Controller");
|
|
9
|
+
|
|
10
|
+
QUnit.test("I should test the <%= viewName %> controller", function (assert) {
|
|
11
|
+
var oAppController = new Controller();
|
|
12
|
+
oAppController.onInit();
|
|
13
|
+
assert.ok(oAppController);
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
});
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/*global QUnit*/
|
|
2
|
+
import Controller from "<%= appIdWithSlash %>/controller/<%= viewName %>.controller";
|
|
3
|
+
|
|
4
|
+
QUnit.module("<%= viewName %> Controller");
|
|
5
|
+
|
|
6
|
+
QUnit.test("I should test the <%= viewName %> controller", function (assert: Assert) {
|
|
7
|
+
const oAppController = new Controller("<%= viewName %>");
|
|
8
|
+
oAppController.onInit();
|
|
9
|
+
assert.ok(oAppController);
|
|
10
|
+
});
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8">
|
|
5
|
+
<title>Unit tests for <%= appId %></title>
|
|
6
|
+
<script
|
|
7
|
+
id="sap-ui-bootstrap"
|
|
8
|
+
src="../../resources/sap-ui-core.js"
|
|
9
|
+
data-sap-ui-resourceroots='{
|
|
10
|
+
"<%= appIdWithSlash %>": "../../",
|
|
11
|
+
"unit": "."
|
|
12
|
+
}'
|
|
13
|
+
data-sap-ui-async="true"
|
|
14
|
+
data-sap-ui-oninit="module:unit/unitTests.qunit">
|
|
15
|
+
</script>
|
|
16
|
+
<link rel="stylesheet" type="text/css" href="../../resources/sap/ui/thirdparty/qunit-2.css">
|
|
17
|
+
<script src="../../resources/sap/ui/thirdparty/qunit-2.js"></script>
|
|
18
|
+
<script src="../../resources/sap/ui/qunit/qunit-junit.js"></script>
|
|
19
|
+
<script src="../../resources/sap/ui/qunit/qunit-coverage.js"></script>
|
|
20
|
+
<script src="../../resources/sap/ui/thirdparty/sinon.js"></script>
|
|
21
|
+
<script src="../../resources/sap/ui/thirdparty/sinon-qunit.js"></script>
|
|
22
|
+
</head>
|
|
23
|
+
<body>
|
|
24
|
+
<div id="qunit"></div>
|
|
25
|
+
<div id="qunit-fixture"></div>
|
|
26
|
+
</body>
|
|
27
|
+
</html>
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/* global QUnit */
|
|
2
|
+
// https://api.qunitjs.com/config/autostart/
|
|
3
|
+
QUnit.config.autostart = false;
|
|
4
|
+
|
|
5
|
+
// import all your QUnit tests here
|
|
6
|
+
void Promise.all([
|
|
7
|
+
import("unit/controller/<%= viewName %>Page.controller")
|
|
8
|
+
]).then(() => {
|
|
9
|
+
QUnit.start();
|
|
10
|
+
});
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/* global window, parent, location */
|
|
2
|
+
|
|
3
|
+
// eslint-disable-next-line fiori-custom/sap-no-global-define
|
|
4
|
+
|
|
5
|
+
window.suite = function() {
|
|
6
|
+
"use strict";
|
|
7
|
+
|
|
8
|
+
// eslint-disable-next-line
|
|
9
|
+
var oSuite = new parent.jsUnitTestSuite(),
|
|
10
|
+
|
|
11
|
+
sContextPath = location.pathname.substring(0, location.pathname.lastIndexOf('/') + 1);
|
|
12
|
+
oSuite.addTestPage(sContextPath + 'unit/unitTests.qunit.html');
|
|
13
|
+
oSuite.addTestPage(sContextPath + 'integration/opaTests.qunit.html');
|
|
14
|
+
|
|
15
|
+
return oSuite;
|
|
16
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/* global window, parent, location */
|
|
2
|
+
|
|
3
|
+
// eslint-disable-next-line fiori-custom/sap-no-global-define,@typescript-eslint/ban-ts-comment
|
|
4
|
+
// @ts-nocheck
|
|
5
|
+
window.suite = function() {
|
|
6
|
+
// eslint-disable-next-line
|
|
7
|
+
var oSuite = new parent.jsUnitTestSuite(),
|
|
8
|
+
sContextPath = location.pathname.substring(0, location.pathname.lastIndexOf("/") + 1);
|
|
9
|
+
|
|
10
|
+
oSuite.addTestPage(sContextPath + "unit/unitTests.qunit.html");
|
|
11
|
+
oSuite.addTestPage(sContextPath + "integration/opaTests.qunit.html");
|
|
12
|
+
|
|
13
|
+
return oSuite;
|
|
14
|
+
};
|