first commit
This commit is contained in:
13
webapp/test/integration/AllJourneys.js
Normal file
13
webapp/test/integration/AllJourneys.js
Normal file
@ -0,0 +1,13 @@
|
||||
sap.ui.define([
|
||||
"sap/ui/test/Opa5",
|
||||
"./arrangements/Startup",
|
||||
"./NavigationJourney"
|
||||
], function (Opa5, Startup) {
|
||||
"use strict";
|
||||
|
||||
Opa5.extendConfig({
|
||||
arrangements: new Startup(),
|
||||
viewNamespace: "restaurant.z00124ss25restaurant.view.",
|
||||
autoWait: true
|
||||
});
|
||||
});
|
23
webapp/test/integration/NavigationJourney.js
Normal file
23
webapp/test/integration/NavigationJourney.js
Normal file
@ -0,0 +1,23 @@
|
||||
/*global QUnit*/
|
||||
|
||||
sap.ui.define([
|
||||
"sap/ui/test/opaQunit",
|
||||
"./pages/App",
|
||||
"./pages/tablePos"
|
||||
], function (opaTest) {
|
||||
"use strict";
|
||||
|
||||
QUnit.module("Navigation Journey");
|
||||
|
||||
opaTest("Should see the initial page of the app", function (Given, When, Then) {
|
||||
// Arrangements
|
||||
Given.iStartMyApp();
|
||||
|
||||
// Assertions
|
||||
Then.onTheAppPage.iShouldSeeTheApp();
|
||||
Then.onTheViewPage.iShouldSeeThePageView();
|
||||
|
||||
//Cleanup
|
||||
Then.iTeardownMyApp();
|
||||
});
|
||||
});
|
25
webapp/test/integration/arrangements/Startup.js
Normal file
25
webapp/test/integration/arrangements/Startup.js
Normal file
@ -0,0 +1,25 @@
|
||||
sap.ui.define([
|
||||
"sap/ui/test/Opa5"
|
||||
], function (Opa5) {
|
||||
"use strict";
|
||||
|
||||
return Opa5.extend("integration.arrangements.Startup", {
|
||||
|
||||
iStartMyApp: function (oOptionsParameter) {
|
||||
var oOptions = oOptionsParameter || {};
|
||||
|
||||
// start the app with a minimal delay to make tests fast but still async to discover basic timing issues
|
||||
oOptions.delay = oOptions.delay || 50;
|
||||
|
||||
// start the app UI component
|
||||
this.iStartMyUIComponent({
|
||||
componentConfig: {
|
||||
name: "restaurant.z00124ss25restaurant",
|
||||
async: true
|
||||
},
|
||||
hash: oOptions.hash,
|
||||
autoWait: oOptions.autoWait
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
29
webapp/test/integration/opaTests.qunit.html
Normal file
29
webapp/test/integration/opaTests.qunit.html
Normal file
@ -0,0 +1,29 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title>Integration tests for Basic Template</title>
|
||||
|
||||
<script
|
||||
id="sap-ui-bootstrap"
|
||||
src="../../resources/sap-ui-core.js"
|
||||
data-sap-ui-theme="sap_horizon"
|
||||
data-sap-ui-resourceroots='{
|
||||
"restaurant.z00124ss25restaurant": "../../",
|
||||
"integration": "./"
|
||||
}'
|
||||
data-sap-ui-animation="false"
|
||||
data-sap-ui-compatVersion="edge"
|
||||
data-sap-ui-async="true"
|
||||
data-sap-ui-preload="async"
|
||||
data-sap-ui-oninit="module:integration/opaTests.qunit">
|
||||
</script>
|
||||
<link rel="stylesheet" type="text/css" href="../../resources/sap/ui/thirdparty/qunit-2.css">
|
||||
<script src="../../resources/sap/ui/thirdparty/qunit-2.js"></script>
|
||||
<script src="../../resources/sap/ui/qunit/qunit-junit.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="qunit"></div>
|
||||
<div id="qunit-fixture"></div>
|
||||
</body>
|
||||
</html>
|
7
webapp/test/integration/opaTests.qunit.js
Normal file
7
webapp/test/integration/opaTests.qunit.js
Normal file
@ -0,0 +1,7 @@
|
||||
/* global QUnit */
|
||||
|
||||
sap.ui.require(["restaurant/z00124ss25restaurant/test/integration/AllJourneys"
|
||||
], function () {
|
||||
QUnit.config.autostart = false;
|
||||
QUnit.start();
|
||||
});
|
28
webapp/test/integration/pages/App.js
Normal file
28
webapp/test/integration/pages/App.js
Normal file
@ -0,0 +1,28 @@
|
||||
sap.ui.define([
|
||||
"sap/ui/test/Opa5"
|
||||
], function (Opa5) {
|
||||
"use strict";
|
||||
var sViewName = "App";
|
||||
|
||||
Opa5.createPageObjects({
|
||||
onTheAppPage: {
|
||||
|
||||
actions: {},
|
||||
|
||||
assertions: {
|
||||
|
||||
iShouldSeeTheApp: function () {
|
||||
return this.waitFor({
|
||||
id: "app",
|
||||
viewName: sViewName,
|
||||
success: function () {
|
||||
Opa5.assert.ok(true, "The " + sViewName + " view is displayed");
|
||||
},
|
||||
errorMessage: "Did not find the " + sViewName + " view"
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
});
|
28
webapp/test/integration/pages/tablePos.js
Normal file
28
webapp/test/integration/pages/tablePos.js
Normal file
@ -0,0 +1,28 @@
|
||||
sap.ui.define([
|
||||
"sap/ui/test/Opa5"
|
||||
], function (Opa5) {
|
||||
"use strict";
|
||||
var sViewName = "tablePos";
|
||||
|
||||
Opa5.createPageObjects({
|
||||
onTheViewPage: {
|
||||
|
||||
actions: {},
|
||||
|
||||
assertions: {
|
||||
|
||||
iShouldSeeThePageView: function () {
|
||||
return this.waitFor({
|
||||
id: "page",
|
||||
viewName: sViewName,
|
||||
success: function () {
|
||||
Opa5.assert.ok(true, "The " + sViewName + " view is displayed");
|
||||
},
|
||||
errorMessage: "Did not find the " + sViewName + " view"
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
});
|
9
webapp/test/testsuite.qunit.html
Normal file
9
webapp/test/testsuite.qunit.html
Normal file
@ -0,0 +1,9 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>QUnit test suite</title>
|
||||
<script src="../resources/sap/ui/qunit/qunit-redirect.js"></script>
|
||||
<script src="testsuite.qunit.js" data-sap-ui-testsuite></script>
|
||||
</head>
|
||||
<body></body>
|
||||
</html>
|
16
webapp/test/testsuite.qunit.js
Normal file
16
webapp/test/testsuite.qunit.js
Normal file
@ -0,0 +1,16 @@
|
||||
/* global window, parent, location */
|
||||
|
||||
// eslint-disable-next-line fiori-custom/sap-no-global-define
|
||||
|
||||
window.suite = function() {
|
||||
"use strict";
|
||||
|
||||
// eslint-disable-next-line
|
||||
var oSuite = new parent.jsUnitTestSuite(),
|
||||
|
||||
sContextPath = location.pathname.substring(0, location.pathname.lastIndexOf('/') + 1);
|
||||
oSuite.addTestPage(sContextPath + 'unit/unitTests.qunit.html');
|
||||
oSuite.addTestPage(sContextPath + 'integration/opaTests.qunit.html');
|
||||
|
||||
return oSuite;
|
||||
};
|
5
webapp/test/unit/AllTests.js
Normal file
5
webapp/test/unit/AllTests.js
Normal file
@ -0,0 +1,5 @@
|
||||
sap.ui.define([
|
||||
"restaurant/z00124ss25restaurant/test/unit/controller/tablePos.controller"
|
||||
], function () {
|
||||
"use strict";
|
||||
});
|
16
webapp/test/unit/controller/tablePos.controller.js
Normal file
16
webapp/test/unit/controller/tablePos.controller.js
Normal file
@ -0,0 +1,16 @@
|
||||
/*global QUnit*/
|
||||
|
||||
sap.ui.define([
|
||||
"restaurant/z00124ss25restaurant/controller/tablePos.controller"
|
||||
], function (Controller) {
|
||||
"use strict";
|
||||
|
||||
QUnit.module("tablePos Controller");
|
||||
|
||||
QUnit.test("I should test the tablePos controller", function (assert) {
|
||||
var oAppController = new Controller();
|
||||
oAppController.onInit();
|
||||
assert.ok(oAppController);
|
||||
});
|
||||
|
||||
});
|
27
webapp/test/unit/unitTests.qunit.html
Normal file
27
webapp/test/unit/unitTests.qunit.html
Normal file
@ -0,0 +1,27 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Unit tests for restaurant.z00124ss25restaurant</title>
|
||||
<script
|
||||
id="sap-ui-bootstrap"
|
||||
src="../../resources/sap-ui-core.js"
|
||||
data-sap-ui-resourceroots='{
|
||||
"restaurant/z00124ss25restaurant": "../../",
|
||||
"unit": "."
|
||||
}'
|
||||
data-sap-ui-async="true"
|
||||
data-sap-ui-oninit="module:unit/unitTests.qunit">
|
||||
</script>
|
||||
<link rel="stylesheet" type="text/css" href="../../resources/sap/ui/thirdparty/qunit-2.css">
|
||||
<script src="../../resources/sap/ui/thirdparty/qunit-2.js"></script>
|
||||
<script src="../../resources/sap/ui/qunit/qunit-junit.js"></script>
|
||||
<script src="../../resources/sap/ui/qunit/qunit-coverage.js"></script>
|
||||
<script src="../../resources/sap/ui/thirdparty/sinon.js"></script>
|
||||
<script src="../../resources/sap/ui/thirdparty/sinon-qunit.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="qunit"></div>
|
||||
<div id="qunit-fixture"></div>
|
||||
</body>
|
||||
</html>
|
12
webapp/test/unit/unitTests.qunit.js
Normal file
12
webapp/test/unit/unitTests.qunit.js
Normal file
@ -0,0 +1,12 @@
|
||||
/* global QUnit */
|
||||
QUnit.config.autostart = false;
|
||||
|
||||
sap.ui.getCore().attachInit(function () {
|
||||
"use strict";
|
||||
|
||||
sap.ui.require([
|
||||
"restaurant/z00124ss25restaurant/test/unit/AllTests"
|
||||
], function () {
|
||||
QUnit.start();
|
||||
});
|
||||
});
|
Reference in New Issue
Block a user