@ui5/mcp-server 0.1.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.
Files changed (221) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/LICENSE +201 -0
  3. package/LICENSES/Apache-2.0.txt +73 -0
  4. package/README.md +131 -0
  5. package/bin/ui5mcp.js +2 -0
  6. package/lib/Context.d.ts +28 -0
  7. package/lib/Context.js +71 -0
  8. package/lib/Context.js.map +1 -0
  9. package/lib/api.d.ts +3 -0
  10. package/lib/api.js +3 -0
  11. package/lib/api.js.map +1 -0
  12. package/lib/cli.d.ts +1 -0
  13. package/lib/cli.js +12 -0
  14. package/lib/cli.js.map +1 -0
  15. package/lib/registerTools.d.ts +133 -0
  16. package/lib/registerTools.js +59 -0
  17. package/lib/registerTools.js.map +1 -0
  18. package/lib/resources/documentation/getDocumentation.d.ts +18 -0
  19. package/lib/resources/documentation/getDocumentation.js +70 -0
  20. package/lib/resources/documentation/getDocumentation.js.map +1 -0
  21. package/lib/server.d.ts +10 -0
  22. package/lib/server.js +113 -0
  23. package/lib/server.js.map +1 -0
  24. package/lib/tools/create_ui5_app/ODataMetadata.d.ts +55 -0
  25. package/lib/tools/create_ui5_app/ODataMetadata.js +99 -0
  26. package/lib/tools/create_ui5_app/ODataMetadata.js.map +1 -0
  27. package/lib/tools/create_ui5_app/createSuccessMessage.d.ts +13 -0
  28. package/lib/tools/create_ui5_app/createSuccessMessage.js +45 -0
  29. package/lib/tools/create_ui5_app/createSuccessMessage.js.map +1 -0
  30. package/lib/tools/create_ui5_app/create_ui5_app.d.ts +8 -0
  31. package/lib/tools/create_ui5_app/create_ui5_app.js +273 -0
  32. package/lib/tools/create_ui5_app/create_ui5_app.js.map +1 -0
  33. package/lib/tools/create_ui5_app/index.d.ts +3 -0
  34. package/lib/tools/create_ui5_app/index.js +58 -0
  35. package/lib/tools/create_ui5_app/index.js.map +1 -0
  36. package/lib/tools/create_ui5_app/isValidUrl.d.ts +16 -0
  37. package/lib/tools/create_ui5_app/isValidUrl.js +59 -0
  38. package/lib/tools/create_ui5_app/isValidUrl.js.map +1 -0
  39. package/lib/tools/create_ui5_app/schema.d.ts +135 -0
  40. package/lib/tools/create_ui5_app/schema.js +67 -0
  41. package/lib/tools/create_ui5_app/schema.js.map +1 -0
  42. package/lib/tools/create_ui5_app/templateProcessor.d.ts +67 -0
  43. package/lib/tools/create_ui5_app/templateProcessor.js +59 -0
  44. package/lib/tools/create_ui5_app/templateProcessor.js.map +1 -0
  45. package/lib/tools/create_ui5_app/ui5Version.d.ts +2 -0
  46. package/lib/tools/create_ui5_app/ui5Version.js +6 -0
  47. package/lib/tools/create_ui5_app/ui5Version.js.map +1 -0
  48. package/lib/tools/get_api_reference/createUriForSymbol.d.ts +2 -0
  49. package/lib/tools/get_api_reference/createUriForSymbol.js +49 -0
  50. package/lib/tools/get_api_reference/createUriForSymbol.js.map +1 -0
  51. package/lib/tools/get_api_reference/getApiReference.d.ts +10 -0
  52. package/lib/tools/get_api_reference/getApiReference.js +51 -0
  53. package/lib/tools/get_api_reference/getApiReference.js.map +1 -0
  54. package/lib/tools/get_api_reference/index.d.ts +3 -0
  55. package/lib/tools/get_api_reference/index.js +38 -0
  56. package/lib/tools/get_api_reference/index.js.map +1 -0
  57. package/lib/tools/get_api_reference/lib/ApiReferenceProvider.d.ts +85 -0
  58. package/lib/tools/get_api_reference/lib/ApiReferenceProvider.js +452 -0
  59. package/lib/tools/get_api_reference/lib/ApiReferenceProvider.js.map +1 -0
  60. package/lib/tools/get_api_reference/lib/apiReferenceResources.d.ts +18 -0
  61. package/lib/tools/get_api_reference/lib/apiReferenceResources.js +138 -0
  62. package/lib/tools/get_api_reference/lib/apiReferenceResources.js.map +1 -0
  63. package/lib/tools/get_api_reference/lib/formatSymbol.d.ts +24 -0
  64. package/lib/tools/get_api_reference/lib/formatSymbol.js +109 -0
  65. package/lib/tools/get_api_reference/lib/formatSymbol.js.map +1 -0
  66. package/lib/tools/get_api_reference/schema.d.ts +16 -0
  67. package/lib/tools/get_api_reference/schema.js +12 -0
  68. package/lib/tools/get_api_reference/schema.js.map +1 -0
  69. package/lib/tools/get_guidelines/guidelines.d.ts +1 -0
  70. package/lib/tools/get_guidelines/guidelines.js +6 -0
  71. package/lib/tools/get_guidelines/guidelines.js.map +1 -0
  72. package/lib/tools/get_guidelines/index.d.ts +3 -0
  73. package/lib/tools/get_guidelines/index.js +30 -0
  74. package/lib/tools/get_guidelines/index.js.map +1 -0
  75. package/lib/tools/get_project_info/getProjectInfo.d.ts +2 -0
  76. package/lib/tools/get_project_info/getProjectInfo.js +205 -0
  77. package/lib/tools/get_project_info/getProjectInfo.js.map +1 -0
  78. package/lib/tools/get_project_info/index.d.ts +3 -0
  79. package/lib/tools/get_project_info/index.js +28 -0
  80. package/lib/tools/get_project_info/index.js.map +1 -0
  81. package/lib/tools/get_project_info/schema.d.ts +87 -0
  82. package/lib/tools/get_project_info/schema.js +28 -0
  83. package/lib/tools/get_project_info/schema.js.map +1 -0
  84. package/lib/tools/get_version_info/getVersionInfo.d.ts +8 -0
  85. package/lib/tools/get_version_info/getVersionInfo.js +41 -0
  86. package/lib/tools/get_version_info/getVersionInfo.js.map +1 -0
  87. package/lib/tools/get_version_info/index.d.ts +9 -0
  88. package/lib/tools/get_version_info/index.js +33 -0
  89. package/lib/tools/get_version_info/index.js.map +1 -0
  90. package/lib/tools/get_version_info/schema.d.ts +66 -0
  91. package/lib/tools/get_version_info/schema.js +16 -0
  92. package/lib/tools/get_version_info/schema.js.map +1 -0
  93. package/lib/tools/get_version_info/types.d.ts +5 -0
  94. package/lib/tools/get_version_info/types.js +2 -0
  95. package/lib/tools/get_version_info/types.js.map +1 -0
  96. package/lib/tools/run_ui5_linter/index.d.ts +3 -0
  97. package/lib/tools/run_ui5_linter/index.js +86 -0
  98. package/lib/tools/run_ui5_linter/index.js.map +1 -0
  99. package/lib/tools/run_ui5_linter/migrationGuides.d.ts +6 -0
  100. package/lib/tools/run_ui5_linter/migrationGuides.js +88 -0
  101. package/lib/tools/run_ui5_linter/migrationGuides.js.map +1 -0
  102. package/lib/tools/run_ui5_linter/resultContext.d.ts +3 -0
  103. package/lib/tools/run_ui5_linter/resultContext.js +236 -0
  104. package/lib/tools/run_ui5_linter/resultContext.js.map +1 -0
  105. package/lib/tools/run_ui5_linter/runUi5Linter.d.ts +2 -0
  106. package/lib/tools/run_ui5_linter/runUi5Linter.js +72 -0
  107. package/lib/tools/run_ui5_linter/runUi5Linter.js.map +1 -0
  108. package/lib/tools/run_ui5_linter/schema.d.ts +340 -0
  109. package/lib/tools/run_ui5_linter/schema.js +55 -0
  110. package/lib/tools/run_ui5_linter/schema.js.map +1 -0
  111. package/lib/utils/cdnHelper.d.ts +9 -0
  112. package/lib/utils/cdnHelper.js +50 -0
  113. package/lib/utils/cdnHelper.js.map +1 -0
  114. package/lib/utils/dataStorageHelper.d.ts +2 -0
  115. package/lib/utils/dataStorageHelper.js +65 -0
  116. package/lib/utils/dataStorageHelper.js.map +1 -0
  117. package/lib/utils/ui5Framework.d.ts +4 -0
  118. package/lib/utils/ui5Framework.js +6 -0
  119. package/lib/utils/ui5Framework.js.map +1 -0
  120. package/lib/utils.d.ts +10 -0
  121. package/lib/utils.js +87 -0
  122. package/lib/utils.js.map +1 -0
  123. package/npm-shrinkwrap.json +7880 -0
  124. package/package.json +121 -0
  125. package/resources/docs/1.136.7/00737d6c1b864dc3ab72ef56611491c4.md +155 -0
  126. package/resources/docs/1.136.7/0187ea5e2eff4166b0453b9dcc8fc64f.md +164 -0
  127. package/resources/docs/1.136.7/032be2cb2e1d4115af20862673bedcdb.md +12 -0
  128. package/resources/docs/1.136.7/28fcd55b04654977b63dacbee0552712.md +317 -0
  129. package/resources/docs/1.136.7/676b636446c94eada183b1218a824717.md +135 -0
  130. package/resources/docs/1.136.7/a87ca843bcee469f82a9072927a7dcdb.md +355 -0
  131. package/resources/docs/1.136.7/b0fb4de7364f4bcbb053a99aa645affe.md +126 -0
  132. package/resources/docs/1.136.7/fe1a6dba940e479fb7c3bc753f92b28c.md +670 -0
  133. package/resources/docs/1.136.7/index.json +58 -0
  134. package/resources/guidelines.md +104 -0
  135. package/resources/migrationGuides/deprecated-controller-factory.md +116 -0
  136. package/resources/migrationGuides/deprecated-getLibraryResourceBundle.md +62 -0
  137. package/resources/migrationGuides/deprecated-jquery-sap-require.md +141 -0
  138. package/resources/migrationGuides/deprecated-messagePage.md +162 -0
  139. package/resources/migrationGuides/deprecated-table-table-property.md +154 -0
  140. package/resources/template-js/LICENSE +201 -0
  141. package/resources/template-js/README.md +87 -0
  142. package/resources/template-js/_.editorconfig +22 -0
  143. package/resources/template-js/_.gitignore +17 -0
  144. package/resources/template-js/eslint.config.js +68 -0
  145. package/resources/template-js/karma-ci-cov.conf.js +20 -0
  146. package/resources/template-js/karma-ci.conf.js +9 -0
  147. package/resources/template-js/karma.conf.js +9 -0
  148. package/resources/template-js/package.json +34 -0
  149. package/resources/template-js/ui5-dist.yaml +18 -0
  150. package/resources/template-js/ui5.yaml +24 -0
  151. package/resources/template-js/webapp/Component.js +41 -0
  152. package/resources/template-js/webapp/controller/App.controller.js +10 -0
  153. package/resources/template-js/webapp/controller/BaseController.js +67 -0
  154. package/resources/template-js/webapp/controller/Main.controller.js +14 -0
  155. package/resources/template-js/webapp/i18n/i18n.properties +3 -0
  156. package/resources/template-js/webapp/i18n/i18n_en.properties +3 -0
  157. package/resources/template-js/webapp/index-cdn.html +34 -0
  158. package/resources/template-js/webapp/index.html +34 -0
  159. package/resources/template-js/webapp/manifest.json +103 -0
  160. package/resources/template-js/webapp/model/formatter.js +9 -0
  161. package/resources/template-js/webapp/model/models.js +11 -0
  162. package/resources/template-js/webapp/test/Test.qunit.html +16 -0
  163. package/resources/template-js/webapp/test/integration/HelloJourney.js +85 -0
  164. package/resources/template-js/webapp/test/integration/opaTests.qunit.js +1 -0
  165. package/resources/template-js/webapp/test/integration/pages/Main.js +112 -0
  166. package/resources/template-js/webapp/test/testsuite.qunit.html +18 -0
  167. package/resources/template-js/webapp/test/testsuite.qunit.js +37 -0
  168. package/resources/template-js/webapp/test/unit/controller/Main.qunit.js +11 -0
  169. package/resources/template-js/webapp/test/unit/unitTests.qunit.js +1 -0
  170. package/resources/template-js/webapp/test-lt1_124/integration/HelloJourney.js +85 -0
  171. package/resources/template-js/webapp/test-lt1_124/integration/opaTests.qunit.html +31 -0
  172. package/resources/template-js/webapp/test-lt1_124/integration/opaTests.qunit.js +11 -0
  173. package/resources/template-js/webapp/test-lt1_124/integration/pages/Main.js +112 -0
  174. package/resources/template-js/webapp/test-lt1_124/testsuite.qunit.html +13 -0
  175. package/resources/template-js/webapp/test-lt1_124/testsuite.qunit.js +9 -0
  176. package/resources/template-js/webapp/test-lt1_124/unit/controller/Main.qunit.js +11 -0
  177. package/resources/template-js/webapp/test-lt1_124/unit/unitTests.qunit.html +30 -0
  178. package/resources/template-js/webapp/test-lt1_124/unit/unitTests.qunit.js +12 -0
  179. package/resources/template-js/webapp/view/App.view.xml +9 -0
  180. package/resources/template-js/webapp/view/Main.view.xml +90 -0
  181. package/resources/template-ts/LICENSE +201 -0
  182. package/resources/template-ts/README.md +101 -0
  183. package/resources/template-ts/_.editorconfig +23 -0
  184. package/resources/template-ts/_.gitignore +18 -0
  185. package/resources/template-ts/_.nycrc.json +7 -0
  186. package/resources/template-ts/_tsconfig.json +21 -0
  187. package/resources/template-ts/eslint.config.mjs +27 -0
  188. package/resources/template-ts/package.json +40 -0
  189. package/resources/template-ts/ui5-coverage.yaml +40 -0
  190. package/resources/template-ts/ui5-dist.yaml +18 -0
  191. package/resources/template-ts/ui5.yaml +27 -0
  192. package/resources/template-ts/webapp/Component.ts +49 -0
  193. package/resources/template-ts/webapp/controller/App.controller.ts +11 -0
  194. package/resources/template-ts/webapp/controller/BaseController.ts +83 -0
  195. package/resources/template-ts/webapp/controller/Main.controller.ts +19 -0
  196. package/resources/template-ts/webapp/i18n/i18n.properties +3 -0
  197. package/resources/template-ts/webapp/i18n/i18n_en.properties +3 -0
  198. package/resources/template-ts/webapp/index-cdn.html +35 -0
  199. package/resources/template-ts/webapp/index.html +35 -0
  200. package/resources/template-ts/webapp/manifest.json +105 -0
  201. package/resources/template-ts/webapp/model/formatter.ts +5 -0
  202. package/resources/template-ts/webapp/model/models.ts +15 -0
  203. package/resources/template-ts/webapp/test/Test.qunit.html +16 -0
  204. package/resources/template-ts/webapp/test/integration/HelloJourney.ts +84 -0
  205. package/resources/template-ts/webapp/test/integration/opaTests.qunit.ts +2 -0
  206. package/resources/template-ts/webapp/test/integration/pages/MainPage.ts +112 -0
  207. package/resources/template-ts/webapp/test/testsuite.qunit.html +18 -0
  208. package/resources/template-ts/webapp/test/testsuite.qunit.ts +33 -0
  209. package/resources/template-ts/webapp/test/unit/controller/Main.qunit.ts +8 -0
  210. package/resources/template-ts/webapp/test/unit/unitTests.qunit.ts +2 -0
  211. package/resources/template-ts/webapp/test-lt1_124/integration/HelloJourney.ts +86 -0
  212. package/resources/template-ts/webapp/test-lt1_124/integration/opaTests.qunit.html +34 -0
  213. package/resources/template-ts/webapp/test-lt1_124/integration/opaTests.qunit.ts +8 -0
  214. package/resources/template-ts/webapp/test-lt1_124/integration/pages/MainPage.ts +112 -0
  215. package/resources/template-ts/webapp/test-lt1_124/testsuite.qunit.html +13 -0
  216. package/resources/template-ts/webapp/test-lt1_124/testsuite.qunit.ts +9 -0
  217. package/resources/template-ts/webapp/test-lt1_124/unit/controller/Main.qunit.ts +8 -0
  218. package/resources/template-ts/webapp/test-lt1_124/unit/unitTests.qunit.html +37 -0
  219. package/resources/template-ts/webapp/test-lt1_124/unit/unitTests.qunit.ts +8 -0
  220. package/resources/template-ts/webapp/view/App.view.xml +9 -0
  221. package/resources/template-ts/webapp/view/Main.view.xml +90 -0
@@ -0,0 +1,105 @@
1
+ {
2
+ "_version": "1.21.0",
3
+
4
+ "sap.app": {
5
+ "id": "<%= appId %>",
6
+ "type": "application",
7
+ "i18n": "i18n/i18n.properties",
8
+ "title": "{{appTitle}}",
9
+ "description": "{{appDescription}}",
10
+ "applicationVersion": {
11
+ "version": "${version}"
12
+ }<% if (oDataV4Url) { %>,
13
+ "dataSources": {
14
+ "default": {
15
+ "uri": "<%= oDataV4Url %>",
16
+ "type": "OData",
17
+ "settings": {
18
+ "odataVersion": "4.0"
19
+ }
20
+ }
21
+ }<% } %>
22
+ },
23
+
24
+ "sap.ui": {
25
+ "technology": "UI5",
26
+ "icons": {},
27
+ "deviceTypes": {
28
+ "desktop": true,
29
+ "tablet": true,
30
+ "phone": true
31
+ }
32
+ },
33
+
34
+ "sap.ui5": {
35
+ "rootView": {
36
+ "viewName": "<%= appId %>.view.App",
37
+ "type": "XML",
38
+ "id": "app"
39
+ },
40
+
41
+ "dependencies": {
42
+ "minUI5Version": "<%= frameworkVersion %>",
43
+ "libs": {
44
+ "sap.ui.core": {},
45
+ "sap.m": {}<% if (oDataEntitySet) { %>,
46
+ "sap.ui.layout": {},
47
+ "sap.f": {},
48
+ "sap.ui.table": {}<% } %>
49
+ }
50
+ },
51
+
52
+ "flexEnabled": false,
53
+
54
+ "handleValidation": true,
55
+
56
+ "contentDensities": {
57
+ "compact": true,
58
+ "cozy": true
59
+ },
60
+
61
+ "models": {
62
+ "i18n": {
63
+ "type": "sap.ui.model.resource.ResourceModel",
64
+ "settings": {
65
+ "bundleName": "<%= appId %>.i18n.i18n",
66
+ "async": true
67
+ }
68
+ }<% if (oDataV4Url) { %>,
69
+ "": {
70
+ "dataSource": "default",
71
+ "preload": true,
72
+ "settings": {
73
+ "autoExpandSelect": true,<% if (serverRequiresXCSRF) { %>
74
+ "earlyRequests": true,<% } %>
75
+ "operationMode": "Server"<% if (lt1_110_0) { %>,
76
+ "synchronizationMode": "None"<% } %>
77
+ }
78
+ }<% } %>
79
+ },
80
+
81
+ "routing": {
82
+ "config": {
83
+ "routerClass": "sap.m.routing.Router",
84
+ "type": "View",
85
+ "viewType": "XML",
86
+ "path": "<%= appId %>.view",
87
+ "controlId": "app",
88
+ "controlAggregation": "pages"
89
+ },
90
+ "routes": [
91
+ {
92
+ "pattern": "",
93
+ "name": "main",
94
+ "target": "main"
95
+ }
96
+ ],
97
+ "targets": {
98
+ "main": {
99
+ "id": "main",
100
+ "name": "Main"
101
+ }
102
+ }
103
+ }
104
+ }
105
+ }
@@ -0,0 +1,5 @@
1
+ export default {
2
+ formatValue: (value: string) => {
3
+ return value?.toUpperCase();
4
+ }
5
+ };
@@ -0,0 +1,15 @@
1
+ import JSONModel from "sap/ui/model/json/JSONModel";
2
+ import BindingMode from "sap/ui/model/BindingMode";
3
+ <% if (gte1_115_0) { %>
4
+ import Device from "sap/ui/Device";
5
+ <% } else { %>
6
+ import * as Device from "sap/ui/Device"; // for UI5 >= 1.115.0 use: import Device from "sap/ui/Device";
7
+ <% } %>
8
+
9
+ export default {
10
+ createDeviceModel: () => {
11
+ const oModel = new JSONModel(Device);
12
+ oModel.setDefaultBindingMode(BindingMode.OneWay);
13
+ return oModel;
14
+ }
15
+ };
@@ -0,0 +1,16 @@
1
+ <!doctype html>
2
+ <html>
3
+ <head>
4
+ <meta charset="utf-8" />
5
+ <script
6
+ src="../resources/sap/ui/test/starter/runTest.js"
7
+ data-sap-ui-resource-roots='{
8
+ "test-resources.<%= appId %>": "./"
9
+ }'
10
+ ></script>
11
+ </head>
12
+ <body class="sapUiBody">
13
+ <div id="qunit"></div>
14
+ <div id="qunit-fixture"></div>
15
+ </body>
16
+ </html>
@@ -0,0 +1,84 @@
1
+ import opaTest from "sap/ui/test/opaQunit";
2
+ import MainPage from "./pages/MainPage";
3
+
4
+ const onTheMainPage = new MainPage();
5
+
6
+ <% if (!oDataEntitySet) { %>QUnit.module("Sample Hello Journey");
7
+
8
+ opaTest("Should open the Hello dialog", function () {
9
+ // Arrangements
10
+ onTheMainPage.iStartMyUIComponent({
11
+ componentConfig: {
12
+ name: "<%= appId %>"
13
+ }
14
+ });
15
+
16
+ // Actions
17
+ onTheMainPage.iPressTheSayHelloWithDialogButton();
18
+
19
+ // Assertions
20
+ onTheMainPage.iShouldSeeTheHelloDialog();
21
+
22
+ // Actions
23
+ onTheMainPage.iPressTheOkButtonInTheDialog();
24
+
25
+ // Assertions
26
+ onTheMainPage.iShouldNotSeeTheHelloDialog();
27
+
28
+ // Cleanup
29
+ onTheMainPage.iTeardownMyApp();
30
+ });
31
+
32
+ opaTest("Should close the Hello dialog", function () {
33
+ // Arrangements
34
+ onTheMainPage.iStartMyUIComponent({
35
+ componentConfig: {
36
+ name: "<%= appId %>"
37
+ }
38
+ });
39
+
40
+ // Actions
41
+ onTheMainPage.iPressTheSayHelloWithDialogButton();
42
+ onTheMainPage.iPressTheOkButtonInTheDialog();
43
+
44
+ // Assertions
45
+ onTheMainPage.iShouldNotSeeTheHelloDialog();
46
+
47
+ // Cleanup
48
+ onTheMainPage.iTeardownMyApp();
49
+ });<% } %><% if (oDataEntitySet) { %>QUnit.module("Sample Data Journey");
50
+
51
+ opaTest("Should display the data table", function () {
52
+ // Arrangements
53
+ onTheMainPage.iStartMyUIComponent({
54
+ componentConfig: {
55
+ name: "<%= appId %>"
56
+ }
57
+ });
58
+
59
+ // Assertions
60
+ onTheMainPage.iShouldSeeTheDataTable();
61
+ onTheMainPage.iShouldSeeTheDetailForm();
62
+ onTheMainPage.iShouldSeeTableWithCorrectColumns();
63
+
64
+ // Cleanup
65
+ onTheMainPage.iTeardownMyApp();
66
+ });
67
+
68
+ opaTest("Should select table row and populate detail form", function () {
69
+ // Arrangements
70
+ onTheMainPage.iStartMyUIComponent({
71
+ componentConfig: {
72
+ name: "<%= appId %>"
73
+ }
74
+ });
75
+
76
+ // Actions
77
+ onTheMainPage.iSelectFirstTableRow();
78
+
79
+ // Assertions
80
+ onTheMainPage.iShouldSeeTheDetailForm();
81
+
82
+ // Cleanup
83
+ onTheMainPage.iTeardownMyApp();
84
+ });<% } %>
@@ -0,0 +1,2 @@
1
+ // import all your OPA journeys here
2
+ import "./HelloJourney";
@@ -0,0 +1,112 @@
1
+ import Opa5 from "sap/ui/test/Opa5";<% if (oDataEntitySet) { %>
2
+ import Control from "sap/ui/core/Control";
3
+ import Table from "sap/ui/table/Table";
4
+ import Label from "sap/m/Label";<% } else { %>
5
+ import Press from "sap/ui/test/actions/Press";<% } %>
6
+
7
+ const viewName = "<%= appId %>.view.Main";
8
+
9
+ export default class MainPage extends Opa5 {
10
+ // Actions<% if (!oDataEntitySet) { %>
11
+ iPressTheSayHelloWithDialogButton() {
12
+ this.waitFor({
13
+ id: "helloButton",
14
+ viewName,
15
+ actions: new Press(),
16
+ errorMessage: "Did not find the 'Say Hello With Dialog' button on the Main view"
17
+ });
18
+ }
19
+
20
+ iPressTheOkButtonInTheDialog() {
21
+ this.waitFor({
22
+ controlType: "sap.m.Button",
23
+ searchOpenDialogs: true,
24
+ viewName,
25
+ actions: new Press(),
26
+ errorMessage: "Did not find the 'OK' button in the Dialog"
27
+ });
28
+ }<% } %><% if (oDataEntitySet) { %>
29
+ iSelectFirstTableRow() {
30
+ this.waitFor({
31
+ controlType: "sap.ui.table.Table",
32
+ viewName,
33
+ actions: function (oTable: Table) {
34
+ // Select the first row if available
35
+ if (oTable.getRows().length > 0) {
36
+ oTable.setSelectedIndex(0);
37
+ oTable.fireRowSelectionChange({
38
+ rowIndex: 0,
39
+ rowContext: oTable.getRows()[0].getBindingContext(),
40
+ userInteraction: true
41
+ });
42
+ }
43
+ },
44
+ errorMessage: "Did not find the data table"
45
+ });
46
+ }<% } %>
47
+
48
+ // Assertions<% if (!oDataEntitySet) { %>
49
+ iShouldSeeTheHelloDialog() {
50
+ this.waitFor({
51
+ controlType: "sap.m.Dialog",
52
+ success: function () {
53
+ // we set the view busy, so we need to query the parent of the app
54
+ Opa5.assert.ok(true, "The dialog is open");
55
+ },
56
+ errorMessage: "Did not find the dialog control"
57
+ });
58
+ }
59
+
60
+ iShouldNotSeeTheHelloDialog() {
61
+ this.waitFor({
62
+ controlType: "sap.m.App", // dummy, I just want a check function, where I can search the DOM. Probably there is a better way for a NEGATIVE test (NO dialog).
63
+ check: function () {
64
+ return document.querySelectorAll(".sapMDialog").length === 0;
65
+ },
66
+ success: function () {
67
+ Opa5.assert.ok(true, "No dialog is open");
68
+ }
69
+ });
70
+ }<% } %><% if (oDataEntitySet) { %>
71
+ iShouldSeeTheDataTable() {
72
+ this.waitFor({
73
+ controlType: "sap.ui.table.Table",
74
+ viewName,
75
+ success: function (aTables: Table[]) {
76
+ Opa5.assert.ok(aTables.length > 0, "The data table is displayed");
77
+ },
78
+ errorMessage: "Did not find the data table"
79
+ });
80
+ }
81
+
82
+ iShouldSeeTheDetailForm() {
83
+ this.waitFor({
84
+ id: "detailForm",
85
+ viewName,
86
+ success: function (oForm: Control) {
87
+ Opa5.assert.ok(oForm, "The detail form is displayed");
88
+ },
89
+ errorMessage: "Did not find the detail form"
90
+ });
91
+ }
92
+
93
+ iShouldSeeTableWithCorrectColumns() {
94
+ this.waitFor({
95
+ controlType: "sap.ui.table.Table",
96
+ viewName,
97
+ success: function (aTables: Table[]) {
98
+ const oTable = aTables[0];
99
+ const aColumns = oTable.getColumns();
100
+ const expectedColumns = [<% entityProperties.forEach(function(property, index) { %>"<%= property %>"<% if (index < entityProperties.length - 1) { %>, <% } %><% }); %>];
101
+
102
+ Opa5.assert.equal(aColumns.length, expectedColumns.length, "Table has the correct number of columns");
103
+
104
+ for (let i = 0; i < expectedColumns.length; i++) {
105
+ const sColumnText = (aColumns[i].getLabel() as Label).getText();
106
+ Opa5.assert.equal(sColumnText, expectedColumns[i], `Column ${i} has correct label: ${expectedColumns[i]}`);
107
+ }
108
+ },
109
+ errorMessage: "Table columns do not match expected properties"
110
+ });
111
+ }<% } %>
112
+ }
@@ -0,0 +1,18 @@
1
+ <!doctype html>
2
+ <html>
3
+ <head>
4
+ <meta http-equiv="Cache-control" content="no-cache, no-store, must-revalidate" />
5
+ <meta http-equiv="Pragma" content="no-cache" />
6
+ <meta http-equiv="expires" content="0" />
7
+ <meta charset="utf-8" />
8
+ <title>QUnit test suite for the UI5 Application: <%= namespace %></title>
9
+ <script
10
+ src="../resources/sap/ui/test/starter/createSuite.js"
11
+ data-sap-ui-testsuite="test-resources/<%= appURI %>/testsuite.qunit"
12
+ data-sap-ui-resource-roots='{
13
+ "test-resources.<%= appId %>": "./"
14
+ }'
15
+ ></script>
16
+ </head>
17
+ <body></body>
18
+ </html>
@@ -0,0 +1,33 @@
1
+ export default {
2
+ name: "QUnit test suite for the UI5 Application: <%= namespace %>",
3
+ defaults: {
4
+ page: "ui5://test-resources/<%= appURI %>/Test.qunit.html?testsuite={suite}&test={name}",
5
+ qunit: {
6
+ version: 2
7
+ },
8
+ sinon: {
9
+ version: 4
10
+ },
11
+ ui5: {
12
+ language: "EN",
13
+ theme: "<%= defaultTheme %>"
14
+ },
15
+ coverage: {
16
+ only: "<%= appURI %>/",
17
+ never: "test-resources/<%= appURI %>/"
18
+ },
19
+ loader: {
20
+ paths: {
21
+ "<%= appURI %>": "../"
22
+ }
23
+ }
24
+ },
25
+ tests: {
26
+ "unit/unitTests": {
27
+ title: "Unit tests for <%= namespace %>"
28
+ },
29
+ "integration/opaTests": {
30
+ title: "Integration tests for <%= namespace %>"
31
+ }
32
+ }
33
+ };
@@ -0,0 +1,8 @@
1
+ import Main from "<%= appURI %>/controller/Main.controller";
2
+
3
+ QUnit.module("Sample Main controller test");
4
+
5
+ QUnit.test("The Main controller class has a <% if (!oDataEntitySet) { %>sayHello<% } else { %>onRowSelectionChange<% } %> method", function (assert) {
6
+ // as a very basic test example just check the presence of the "<% if (!oDataEntitySet) { %>sayHello<% } else { %>onRowSelectionChange<% } %>" method
7
+ assert.strictEqual(typeof Main.prototype.<% if (!oDataEntitySet) { %>sayHello<% } else { %>onRowSelectionChange<% } %>, "function");
8
+ });
@@ -0,0 +1,2 @@
1
+ // import all your QUnit tests here
2
+ import "./controller/Main.qunit";
@@ -0,0 +1,86 @@
1
+ import opaTest from "sap/ui/test/opaQunit";
2
+ import MainPage from "./pages/MainPage";
3
+
4
+ const onTheMainPage = new MainPage();
5
+
6
+ <% if (!oDataEntitySet) { %>QUnit.module("Sample Hello Journey");
7
+
8
+ opaTest("Should open the Hello dialog", function () {
9
+ // Arrangements
10
+ onTheMainPage.iStartMyUIComponent({
11
+ componentConfig: {
12
+ name: "<%= appId %>"
13
+ }
14
+ });
15
+
16
+ // Actions
17
+ onTheMainPage.iPressTheSayHelloWithDialogButton();
18
+
19
+ // Assertions
20
+ onTheMainPage.iShouldSeeTheHelloDialog();
21
+
22
+ // Actions
23
+ onTheMainPage.iPressTheOkButtonInTheDialog();
24
+
25
+ // Assertions
26
+ onTheMainPage.iShouldNotSeeTheHelloDialog();
27
+
28
+ // Cleanup
29
+ onTheMainPage.iTeardownMyApp();
30
+ });
31
+
32
+ opaTest("Should close the Hello dialog", function () {
33
+ // Arrangements
34
+ onTheMainPage.iStartMyUIComponent({
35
+ componentConfig: {
36
+ name: "<%= appId %>"
37
+ }
38
+ });
39
+
40
+ // Actions
41
+ onTheMainPage.iPressTheSayHelloWithDialogButton();
42
+ onTheMainPage.iPressTheOkButtonInTheDialog();
43
+
44
+ // Assertions
45
+ onTheMainPage.iShouldNotSeeTheHelloDialog();
46
+
47
+ // Cleanup
48
+ onTheMainPage.iTeardownMyApp();
49
+ });
50
+ <% } %><% if (oDataEntitySet) { %>QUnit.module("Sample Data Journey");
51
+
52
+ opaTest("Should display the data table", function () {
53
+ // Arrangements
54
+ onTheMainPage.iStartMyUIComponent({
55
+ componentConfig: {
56
+ name: "<%= appId %>"
57
+ }
58
+ });
59
+
60
+ // Assertions
61
+ onTheMainPage.iShouldSeeTheDataTable();
62
+ onTheMainPage.iShouldSeeTheDetailForm();
63
+ onTheMainPage.iShouldSeeTableWithCorrectColumns();
64
+
65
+ // Cleanup
66
+ onTheMainPage.iTeardownMyApp();
67
+ });
68
+
69
+ opaTest("Should select table row and populate detail form", function () {
70
+ // Arrangements
71
+ onTheMainPage.iStartMyUIComponent({
72
+ componentConfig: {
73
+ name: "<%= appId %>"
74
+ }
75
+ });
76
+
77
+ // Actions
78
+ onTheMainPage.iSelectFirstTableRow();
79
+
80
+ // Assertions
81
+ onTheMainPage.iShouldSeeTheDetailForm();
82
+
83
+ // Cleanup
84
+ onTheMainPage.iTeardownMyApp();
85
+ });
86
+ <% } %>
@@ -0,0 +1,34 @@
1
+ <!doctype html>
2
+ <html>
3
+ <head>
4
+ <meta http-equiv="Cache-control" content="no-cache, no-store, must-revalidate" />
5
+ <meta http-equiv="Pragma" content="no-cache" />
6
+ <meta http-equiv="expires" content="0" />
7
+ <meta charset="utf-8" />
8
+ <title>Integration tests for the UI5 Application: <%= namespace %></title>
9
+ <script
10
+ id="sap-ui-bootstrap"
11
+ src="../../resources/sap-ui-core.js"<% if (gte1_120_0) { %>
12
+ data-sap-ui-resource-roots='{
13
+ "<%= appId %>": "../../",
14
+ "integration": "."
15
+ }'
16
+ data-sap-ui-compat-version="edge"<% } else { %>
17
+ data-sap-ui-resourceroots='{
18
+ "<%= appId %>": "../../",
19
+ "integration": "."
20
+ }'
21
+ data-sap-ui-compatVersion="edge"<% } %>
22
+ data-sap-ui-async="true"
23
+ ></script>
24
+ <link rel="stylesheet" type="text/css" href="../../resources/sap/ui/thirdparty/qunit-2.css" />
25
+ <script src="../../resources/sap/ui/thirdparty/qunit-2.js"></script>
26
+ <script src="../../resources/sap/ui/qunit/qunit-junit.js"></script>
27
+
28
+ <script src="./opaTests.qunit.js"></script>
29
+ </head>
30
+ <body>
31
+ <div id="qunit"></div>
32
+ <div id="qunit-fixture"></div>
33
+ </body>
34
+ </html>
@@ -0,0 +1,8 @@
1
+ /* @sapUiRequire */
2
+ // https://api.qunitjs.com/config/autostart/
3
+ QUnit.config.autostart = false;
4
+
5
+ // import all your OPA journeys here
6
+ void Promise.all([import("integration/HelloJourney")]).then(() => {
7
+ QUnit.start();
8
+ });
@@ -0,0 +1,112 @@
1
+ import Opa5 from "sap/ui/test/Opa5";<% if (oDataEntitySet) { %>
2
+ import Control from "sap/ui/core/Control";
3
+ import Table from "sap/ui/table/Table";
4
+ import Label from "sap/m/Label";<% } else { %>
5
+ import Press from "sap/ui/test/actions/Press";<% } %>
6
+
7
+ const viewName = "<%= appId %>.view.Main";
8
+
9
+ export default class MainPage extends Opa5 {
10
+ // Actions<% if (!oDataEntitySet) { %>
11
+ iPressTheSayHelloWithDialogButton() {
12
+ this.waitFor({
13
+ id: "helloButton",
14
+ viewName,
15
+ actions: new Press(),
16
+ errorMessage: "Did not find the 'Say Hello With Dialog' button on the Main view"
17
+ });
18
+ }
19
+
20
+ iPressTheOkButtonInTheDialog() {
21
+ this.waitFor({
22
+ controlType: "sap.m.Button",
23
+ searchOpenDialogs: true,
24
+ viewName,
25
+ actions: new Press(),
26
+ errorMessage: "Did not find the 'OK' button in the Dialog"
27
+ });
28
+ }<% } else { %>
29
+ iSelectFirstTableRow() {
30
+ this.waitFor({
31
+ controlType: "sap.ui.table.Table",
32
+ viewName,
33
+ actions: function (oTable: Table) {
34
+ // Select the first row if available
35
+ if (oTable.getRows().length > 0) {
36
+ oTable.setSelectedIndex(0);
37
+ oTable.fireRowSelectionChange({
38
+ rowIndex: 0,
39
+ rowContext: oTable.getRows()[0].getBindingContext(),
40
+ userInteraction: true
41
+ });
42
+ }
43
+ },
44
+ errorMessage: "Did not find the data table"
45
+ });
46
+ }<% } %>
47
+
48
+ // Assertions<% if (!oDataEntitySet) { %>
49
+ iShouldSeeTheHelloDialog() {
50
+ this.waitFor({
51
+ controlType: "sap.m.Dialog",
52
+ success: function () {
53
+ // we set the view busy, so we need to query the parent of the app
54
+ Opa5.assert.ok(true, "The dialog is open");
55
+ },
56
+ errorMessage: "Did not find the dialog control"
57
+ });
58
+ }
59
+
60
+ iShouldNotSeeTheHelloDialog() {
61
+ this.waitFor({
62
+ controlType: "sap.m.App", // dummy, I just want a check function, where I can search the DOM. Probably there is a better way for a NEGATIVE test (NO dialog).
63
+ check: function () {
64
+ return document.querySelectorAll(".sapMDialog").length === 0;
65
+ },
66
+ success: function () {
67
+ Opa5.assert.ok(true, "No dialog is open");
68
+ }
69
+ });
70
+ }<% } else { %>
71
+ iShouldSeeTheDataTable() {
72
+ this.waitFor({
73
+ controlType: "sap.ui.table.Table",
74
+ viewName,
75
+ success: function (aTables: Table[]) {
76
+ Opa5.assert.ok(aTables.length > 0, "The data table is displayed");
77
+ },
78
+ errorMessage: "Did not find the data table"
79
+ });
80
+ }
81
+
82
+ iShouldSeeTheDetailForm() {
83
+ this.waitFor({
84
+ id: "detailForm",
85
+ viewName,
86
+ success: function (oForm: Control) {
87
+ Opa5.assert.ok(oForm, "The detail form is displayed");
88
+ },
89
+ errorMessage: "Did not find the detail form"
90
+ });
91
+ }
92
+
93
+ iShouldSeeTableWithCorrectColumns() {
94
+ this.waitFor({
95
+ controlType: "sap.ui.table.Table",
96
+ viewName,
97
+ success: function (aTables: Table[]) {
98
+ const oTable = aTables[0];
99
+ const aColumns = oTable.getColumns();
100
+ const expectedColumns = [<% entityProperties.forEach(function(property, index) { %>"<%= property %>"<% if (index < entityProperties.length - 1) { %>, <% } %><% }); %>];
101
+
102
+ Opa5.assert.equal(aColumns.length, expectedColumns.length, "Table has the correct number of columns");
103
+
104
+ for (let i = 0; i < expectedColumns.length; i++) {
105
+ const sColumnText = (aColumns[i].getLabel() as Label).getText();
106
+ Opa5.assert.equal(sColumnText, expectedColumns[i], `Column ${i} has correct label: ${expectedColumns[i]}`);
107
+ }
108
+ },
109
+ errorMessage: "Table columns do not match expected properties"
110
+ });
111
+ }<% } %>
112
+ }
@@ -0,0 +1,13 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta http-equiv="Cache-control" content="no-cache, no-store, must-revalidate" />
5
+ <meta http-equiv="Pragma" content="no-cache" />
6
+ <meta http-equiv="expires" content="0" />
7
+ <meta charset="utf-8" />
8
+ <title>QUnit test suite for the UI5 Application: <%= namespace %></title>
9
+ <script src="../resources/sap/ui/qunit/qunit-redirect.js"></script>
10
+ <script src="testsuite.qunit.js" data-sap-ui-testsuite></script>
11
+ </head>
12
+ <body></body>
13
+ </html>
@@ -0,0 +1,9 @@
1
+ /* eslint-disable */
2
+ // @ts-nocheck
3
+ window.suite = function () {
4
+ const suite = new parent.jsUnitTestSuite();
5
+ const sContextPath = location.pathname.match(/(.*\/)(?:[^/]+)/)?.[1];
6
+ suite.addTestPage(sContextPath + "unit/unitTests.qunit.html");
7
+ suite.addTestPage(sContextPath + "integration/opaTests.qunit.html");
8
+ return suite;
9
+ };