From 2565b2c4ec7ef6a990e7a4c3810c3c097fa14dcf Mon Sep 17 00:00:00 2001 From: Max Reichmann <91143102+maxreichmann@users.noreply.github.com> Date: Mon, 9 Dec 2024 20:12:20 +0100 Subject: [PATCH] Migrate tutorial and generator template to use Test Starter setup (#19) --- exercises/ex0/README.md | 2 +- exercises/ex1/README.md | 2 +- exercises/ex1/com.myorg.myapp/package.json | 4 +-- exercises/ex1/com.myorg.myapp/ui5-dist.yaml | 2 +- exercises/ex1/com.myorg.myapp/ui5.yaml | 2 +- .../webapp/test/Test.qunit.html | 16 ++++++++++ .../test/integration/opaTests.qunit.html | 30 ----------------- .../webapp/test/integration/opaTests.qunit.ts | 8 +---- .../webapp/test/testsuite.qunit.html | 22 +++++++------ .../webapp/test/testsuite.qunit.ts | 32 ++++++++++++++----- .../webapp/test/unit/unitTests.qunit.html | 30 ----------------- .../webapp/test/unit/unitTests.qunit.ts | 8 +---- exercises/ex2/com.myorg.myapp/package.json | 4 +-- exercises/ex2/com.myorg.myapp/ui5-dist.yaml | 2 +- exercises/ex2/com.myorg.myapp/ui5.yaml | 2 +- .../webapp/test/Test.qunit.html | 16 ++++++++++ .../test/integration/opaTests.qunit.html | 30 ----------------- .../webapp/test/integration/opaTests.qunit.ts | 8 +---- .../webapp/test/testsuite.qunit.html | 18 ++++++----- .../webapp/test/testsuite.qunit.ts | 32 ++++++++++++++----- .../webapp/test/unit/unitTests.qunit.html | 30 ----------------- .../webapp/test/unit/unitTests.qunit.ts | 8 +---- exercises/ex3/com.myorg.myapp/package.json | 2 +- exercises/ex3/com.myorg.myapp/ui5-dist.yaml | 2 +- exercises/ex3/com.myorg.myapp/ui5.yaml | 2 +- .../webapp/test/Test.qunit.html | 16 ++++++++++ .../test/integration/opaTests.qunit.html | 30 ----------------- .../webapp/test/integration/opaTests.qunit.ts | 8 +---- .../webapp/test/testsuite.qunit.html | 18 ++++++----- .../webapp/test/testsuite.qunit.ts | 32 ++++++++++++++----- .../webapp/test/unit/unitTests.qunit.html | 30 ----------------- .../webapp/test/unit/unitTests.qunit.ts | 8 +---- exercises/ex4/README.md | 2 +- exercises/ex4/com.myorg.myapp/package.json | 4 +-- exercises/ex4/com.myorg.myapp/ui5-dist.yaml | 2 +- exercises/ex4/com.myorg.myapp/ui5.yaml | 2 +- .../webapp/test/Test.qunit.html | 16 ++++++++++ .../test/integration/opaTests.qunit.html | 30 ----------------- .../webapp/test/integration/opaTests.qunit.ts | 8 +---- .../webapp/test/testsuite.qunit.html | 18 ++++++----- .../webapp/test/testsuite.qunit.ts | 32 ++++++++++++++----- .../webapp/test/unit/unitTests.qunit.html | 30 ----------------- .../webapp/test/unit/unitTests.qunit.ts | 8 +---- exercises/ex5/com.myorg.myapp/package.json | 4 +-- exercises/ex5/com.myorg.myapp/ui5-dist.yaml | 2 +- exercises/ex5/com.myorg.myapp/ui5.yaml | 2 +- .../webapp/test/Test.qunit.html | 16 ++++++++++ .../test/integration/opaTests.qunit.html | 30 ----------------- .../webapp/test/integration/opaTests.qunit.ts | 8 +---- .../webapp/test/testsuite.qunit.html | 18 ++++++----- .../webapp/test/testsuite.qunit.ts | 32 ++++++++++++++----- .../webapp/test/unit/unitTests.qunit.html | 30 ----------------- .../webapp/test/unit/unitTests.qunit.ts | 8 +---- exercises/ex6/README.md | 11 +++---- exercises/ex6/com.myorg.myapp/package.json | 2 +- exercises/ex6/com.myorg.myapp/ui5-dist.yaml | 2 +- exercises/ex6/com.myorg.myapp/ui5.yaml | 2 +- .../webapp/test/Test.qunit.html | 16 ++++++++++ .../test/integration/opaTests.qunit.html | 30 ----------------- .../webapp/test/integration/opaTests.qunit.ts | 8 +---- .../webapp/test/testsuite.qunit.html | 18 ++++++----- .../webapp/test/testsuite.qunit.ts | 32 ++++++++++++++----- .../webapp/test/unit/unitTests.qunit.html | 30 ----------------- .../webapp/test/unit/unitTests.qunit.ts | 12 ++----- .../generators/app/templates/package.json | 2 +- .../app/templates/webapp/test/Test.qunit.html | 16 ++++++++++ .../test/integration/opaTests.qunit.html | 30 ----------------- .../webapp/test/integration/opaTests.qunit.ts | 8 +---- .../webapp/test/testsuite.qunit.html | 25 +++++++-------- .../templates/webapp/test/testsuite.qunit.ts | 32 ++++++++++++++----- .../webapp/test/unit/unitTests.qunit.html | 30 ----------------- .../webapp/test/unit/unitTests.qunit.ts | 8 +---- 72 files changed, 400 insertions(+), 672 deletions(-) create mode 100644 exercises/ex1/com.myorg.myapp/webapp/test/Test.qunit.html delete mode 100644 exercises/ex1/com.myorg.myapp/webapp/test/integration/opaTests.qunit.html delete mode 100644 exercises/ex1/com.myorg.myapp/webapp/test/unit/unitTests.qunit.html create mode 100644 exercises/ex2/com.myorg.myapp/webapp/test/Test.qunit.html delete mode 100644 exercises/ex2/com.myorg.myapp/webapp/test/integration/opaTests.qunit.html delete mode 100644 exercises/ex2/com.myorg.myapp/webapp/test/unit/unitTests.qunit.html create mode 100644 exercises/ex3/com.myorg.myapp/webapp/test/Test.qunit.html delete mode 100644 exercises/ex3/com.myorg.myapp/webapp/test/integration/opaTests.qunit.html delete mode 100644 exercises/ex3/com.myorg.myapp/webapp/test/unit/unitTests.qunit.html create mode 100644 exercises/ex4/com.myorg.myapp/webapp/test/Test.qunit.html delete mode 100644 exercises/ex4/com.myorg.myapp/webapp/test/integration/opaTests.qunit.html delete mode 100644 exercises/ex4/com.myorg.myapp/webapp/test/unit/unitTests.qunit.html create mode 100644 exercises/ex5/com.myorg.myapp/webapp/test/Test.qunit.html delete mode 100644 exercises/ex5/com.myorg.myapp/webapp/test/integration/opaTests.qunit.html delete mode 100644 exercises/ex5/com.myorg.myapp/webapp/test/unit/unitTests.qunit.html create mode 100644 exercises/ex6/com.myorg.myapp/webapp/test/Test.qunit.html delete mode 100644 exercises/ex6/com.myorg.myapp/webapp/test/integration/opaTests.qunit.html delete mode 100644 exercises/ex6/com.myorg.myapp/webapp/test/unit/unitTests.qunit.html create mode 100644 generator/generators/app/templates/webapp/test/Test.qunit.html delete mode 100644 generator/generators/app/templates/webapp/test/integration/opaTests.qunit.html delete mode 100644 generator/generators/app/templates/webapp/test/unit/unitTests.qunit.html diff --git a/exercises/ex0/README.md b/exercises/ex0/README.md index 97d3551..e4d0171 100644 --- a/exercises/ex0/README.md +++ b/exercises/ex0/README.md @@ -21,7 +21,7 @@ Make sure that `easy-ui5` is listed. To verify the version of the installed generator-easy-ui5 you can run the following command: ```sh -npm info generator-easy-ui5 version +npm list -g "generator-easy-ui5" ``` > :warning: **Remark:** The version must be at least **```3.6.2```** to be able to consume the latest template from this repository available [here](https://github.com/SAP-samples/ui5-typescript-tutorial/tree/main/generator)!
diff --git a/exercises/ex1/README.md b/exercises/ex1/README.md index 2d9d26a..dc9def6 100644 --- a/exercises/ex1/README.md +++ b/exercises/ex1/README.md @@ -17,7 +17,7 @@ Now Yeoman will ask you several questions necessary to create your application. ```sh ? Enter your application id (namespace)? com.myorg.myapp ? Which framework do you want to use? OpenUI5 -? Which framework version do you want to use? 1.115.1 +? Which framework version do you want to use? 1.131.1 ? Who is the author of the application? ? Would you like to create a new directory for the application? Yes ? Would you like to initialize a local git repository for the application? Yes diff --git a/exercises/ex1/com.myorg.myapp/package.json b/exercises/ex1/com.myorg.myapp/package.json index dc49b17..55f62ff 100644 --- a/exercises/ex1/com.myorg.myapp/package.json +++ b/exercises/ex1/com.myorg.myapp/package.json @@ -20,10 +20,10 @@ "test": "npm run lint && npm run karma-ci-cov" }, "devDependencies": { - "@openui5/types": "1.115.1", + "@openui5/types": "1.131.1", "@typescript-eslint/eslint-plugin": "^5.61.0", "@typescript-eslint/parser": "^5.61.0", - "@ui5/cli": "^3.3.1", + "@ui5/cli": "^4.0.11", "eslint": "^8.44.0", "karma": "^6.4.2", "karma-chrome-launcher": "^3.2.0", diff --git a/exercises/ex1/com.myorg.myapp/ui5-dist.yaml b/exercises/ex1/com.myorg.myapp/ui5-dist.yaml index 694cae8..218a9fa 100644 --- a/exercises/ex1/com.myorg.myapp/ui5-dist.yaml +++ b/exercises/ex1/com.myorg.myapp/ui5-dist.yaml @@ -8,7 +8,7 @@ resources: webapp: dist framework: name: OpenUI5 - version: "1.115.1" + version: "1.131.1" libraries: - name: sap.m - name: sap.ui.core diff --git a/exercises/ex1/com.myorg.myapp/ui5.yaml b/exercises/ex1/com.myorg.myapp/ui5.yaml index a489dac..397ea4e 100644 --- a/exercises/ex1/com.myorg.myapp/ui5.yaml +++ b/exercises/ex1/com.myorg.myapp/ui5.yaml @@ -4,7 +4,7 @@ metadata: type: application framework: name: OpenUI5 - version: "1.115.1" + version: "1.131.1" libraries: - name: sap.m - name: sap.ui.core diff --git a/exercises/ex1/com.myorg.myapp/webapp/test/Test.qunit.html b/exercises/ex1/com.myorg.myapp/webapp/test/Test.qunit.html new file mode 100644 index 0000000..6c14f72 --- /dev/null +++ b/exercises/ex1/com.myorg.myapp/webapp/test/Test.qunit.html @@ -0,0 +1,16 @@ + + + + + + + +
+
+ + diff --git a/exercises/ex1/com.myorg.myapp/webapp/test/integration/opaTests.qunit.html b/exercises/ex1/com.myorg.myapp/webapp/test/integration/opaTests.qunit.html deleted file mode 100644 index 539a621..0000000 --- a/exercises/ex1/com.myorg.myapp/webapp/test/integration/opaTests.qunit.html +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - Integration tests for the UI5 Application: com.myorg.myapp - - - - - - -
-
- - diff --git a/exercises/ex1/com.myorg.myapp/webapp/test/integration/opaTests.qunit.ts b/exercises/ex1/com.myorg.myapp/webapp/test/integration/opaTests.qunit.ts index c7eec8f..217ce2c 100644 --- a/exercises/ex1/com.myorg.myapp/webapp/test/integration/opaTests.qunit.ts +++ b/exercises/ex1/com.myorg.myapp/webapp/test/integration/opaTests.qunit.ts @@ -1,7 +1 @@ -// https://api.qunitjs.com/config/autostart/ -QUnit.config.autostart = false; - -// import all your OPA journeys here -void Promise.all([import("integration/HelloJourney")]).then(() => { - QUnit.start(); -}); +import "./HelloJourney"; diff --git a/exercises/ex1/com.myorg.myapp/webapp/test/testsuite.qunit.html b/exercises/ex1/com.myorg.myapp/webapp/test/testsuite.qunit.html index 31d8a7e..25e229e 100644 --- a/exercises/ex1/com.myorg.myapp/webapp/test/testsuite.qunit.html +++ b/exercises/ex1/com.myorg.myapp/webapp/test/testsuite.qunit.html @@ -1,13 +1,15 @@ - - - - - - QUnit test suite for the UI5 Application: com.myorg.myapp - - - - + + + + + + diff --git a/exercises/ex1/com.myorg.myapp/webapp/test/testsuite.qunit.ts b/exercises/ex1/com.myorg.myapp/webapp/test/testsuite.qunit.ts index a95d2e6..6521a1c 100644 --- a/exercises/ex1/com.myorg.myapp/webapp/test/testsuite.qunit.ts +++ b/exercises/ex1/com.myorg.myapp/webapp/test/testsuite.qunit.ts @@ -1,9 +1,25 @@ -/* eslint-disable */ -// @ts-nocheck -window.suite = function () { - const suite = new parent.jsUnitTestSuite(); - const sContextPath = location.pathname.match(/(.*\/)(?:[^/]+)/)?.[1]; - suite.addTestPage(sContextPath + "unit/unitTests.qunit.html"); - suite.addTestPage(sContextPath + "integration/opaTests.qunit.html"); - return suite; +export default { + name: "Unit test suite for the UI5 Application: com.myorg.myapp", + defaults: { + page: "ui5://test-resources/com/myorg/myapp/Test.qunit.html?testsuite={suite}&test={name}", + qunit: { + version: 2 + }, + ui5: { + theme: "sap_horizon" + }, + loader: { + paths: { + "com/myorg/myapp": "../" + } + } + }, + tests: { + "unit/unitTests": { + title: "Unit tests for the UI5 Application: com.myorg.myapp" + }, + "integration/opaTests": { + title: "Integration tests for the UI5 Application: com.myorg.myapp" + } + } }; diff --git a/exercises/ex1/com.myorg.myapp/webapp/test/unit/unitTests.qunit.html b/exercises/ex1/com.myorg.myapp/webapp/test/unit/unitTests.qunit.html deleted file mode 100644 index 3ac98fa..0000000 --- a/exercises/ex1/com.myorg.myapp/webapp/test/unit/unitTests.qunit.html +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - Unit tests for the UI5 Application: com.myorg.myapp - - - - - - - - - -
-
- - diff --git a/exercises/ex1/com.myorg.myapp/webapp/test/unit/unitTests.qunit.ts b/exercises/ex1/com.myorg.myapp/webapp/test/unit/unitTests.qunit.ts index 592d987..2975400 100644 --- a/exercises/ex1/com.myorg.myapp/webapp/test/unit/unitTests.qunit.ts +++ b/exercises/ex1/com.myorg.myapp/webapp/test/unit/unitTests.qunit.ts @@ -1,7 +1 @@ -// https://api.qunitjs.com/config/autostart/ -QUnit.config.autostart = false; - -// import all your QUnit tests here -void Promise.all([import("unit/controller/Main.qunit")]).then(() => { - QUnit.start(); -}); +import "./controller/Main.qunit"; diff --git a/exercises/ex2/com.myorg.myapp/package.json b/exercises/ex2/com.myorg.myapp/package.json index dc49b17..55f62ff 100644 --- a/exercises/ex2/com.myorg.myapp/package.json +++ b/exercises/ex2/com.myorg.myapp/package.json @@ -20,10 +20,10 @@ "test": "npm run lint && npm run karma-ci-cov" }, "devDependencies": { - "@openui5/types": "1.115.1", + "@openui5/types": "1.131.1", "@typescript-eslint/eslint-plugin": "^5.61.0", "@typescript-eslint/parser": "^5.61.0", - "@ui5/cli": "^3.3.1", + "@ui5/cli": "^4.0.11", "eslint": "^8.44.0", "karma": "^6.4.2", "karma-chrome-launcher": "^3.2.0", diff --git a/exercises/ex2/com.myorg.myapp/ui5-dist.yaml b/exercises/ex2/com.myorg.myapp/ui5-dist.yaml index 791a2b2..a1da094 100644 --- a/exercises/ex2/com.myorg.myapp/ui5-dist.yaml +++ b/exercises/ex2/com.myorg.myapp/ui5-dist.yaml @@ -8,7 +8,7 @@ resources: webapp: dist framework: name: OpenUI5 - version: "1.115.1" + version: "1.131.1" libraries: - name: sap.m - name: sap.ui.core diff --git a/exercises/ex2/com.myorg.myapp/ui5.yaml b/exercises/ex2/com.myorg.myapp/ui5.yaml index b7cf513..ff5606e 100644 --- a/exercises/ex2/com.myorg.myapp/ui5.yaml +++ b/exercises/ex2/com.myorg.myapp/ui5.yaml @@ -4,7 +4,7 @@ metadata: type: application framework: name: OpenUI5 - version: "1.115.1" + version: "1.131.1" libraries: - name: sap.m - name: sap.ui.core diff --git a/exercises/ex2/com.myorg.myapp/webapp/test/Test.qunit.html b/exercises/ex2/com.myorg.myapp/webapp/test/Test.qunit.html new file mode 100644 index 0000000..6c14f72 --- /dev/null +++ b/exercises/ex2/com.myorg.myapp/webapp/test/Test.qunit.html @@ -0,0 +1,16 @@ + + + + + + + +
+
+ + diff --git a/exercises/ex2/com.myorg.myapp/webapp/test/integration/opaTests.qunit.html b/exercises/ex2/com.myorg.myapp/webapp/test/integration/opaTests.qunit.html deleted file mode 100644 index 539a621..0000000 --- a/exercises/ex2/com.myorg.myapp/webapp/test/integration/opaTests.qunit.html +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - Integration tests for the UI5 Application: com.myorg.myapp - - - - - - -
-
- - diff --git a/exercises/ex2/com.myorg.myapp/webapp/test/integration/opaTests.qunit.ts b/exercises/ex2/com.myorg.myapp/webapp/test/integration/opaTests.qunit.ts index c7eec8f..217ce2c 100644 --- a/exercises/ex2/com.myorg.myapp/webapp/test/integration/opaTests.qunit.ts +++ b/exercises/ex2/com.myorg.myapp/webapp/test/integration/opaTests.qunit.ts @@ -1,7 +1 @@ -// https://api.qunitjs.com/config/autostart/ -QUnit.config.autostart = false; - -// import all your OPA journeys here -void Promise.all([import("integration/HelloJourney")]).then(() => { - QUnit.start(); -}); +import "./HelloJourney"; diff --git a/exercises/ex2/com.myorg.myapp/webapp/test/testsuite.qunit.html b/exercises/ex2/com.myorg.myapp/webapp/test/testsuite.qunit.html index 31d8a7e..86113b2 100644 --- a/exercises/ex2/com.myorg.myapp/webapp/test/testsuite.qunit.html +++ b/exercises/ex2/com.myorg.myapp/webapp/test/testsuite.qunit.html @@ -1,13 +1,15 @@ - - - - - QUnit test suite for the UI5 Application: com.myorg.myapp - - + + - + + diff --git a/exercises/ex2/com.myorg.myapp/webapp/test/testsuite.qunit.ts b/exercises/ex2/com.myorg.myapp/webapp/test/testsuite.qunit.ts index a95d2e6..6521a1c 100644 --- a/exercises/ex2/com.myorg.myapp/webapp/test/testsuite.qunit.ts +++ b/exercises/ex2/com.myorg.myapp/webapp/test/testsuite.qunit.ts @@ -1,9 +1,25 @@ -/* eslint-disable */ -// @ts-nocheck -window.suite = function () { - const suite = new parent.jsUnitTestSuite(); - const sContextPath = location.pathname.match(/(.*\/)(?:[^/]+)/)?.[1]; - suite.addTestPage(sContextPath + "unit/unitTests.qunit.html"); - suite.addTestPage(sContextPath + "integration/opaTests.qunit.html"); - return suite; +export default { + name: "Unit test suite for the UI5 Application: com.myorg.myapp", + defaults: { + page: "ui5://test-resources/com/myorg/myapp/Test.qunit.html?testsuite={suite}&test={name}", + qunit: { + version: 2 + }, + ui5: { + theme: "sap_horizon" + }, + loader: { + paths: { + "com/myorg/myapp": "../" + } + } + }, + tests: { + "unit/unitTests": { + title: "Unit tests for the UI5 Application: com.myorg.myapp" + }, + "integration/opaTests": { + title: "Integration tests for the UI5 Application: com.myorg.myapp" + } + } }; diff --git a/exercises/ex2/com.myorg.myapp/webapp/test/unit/unitTests.qunit.html b/exercises/ex2/com.myorg.myapp/webapp/test/unit/unitTests.qunit.html deleted file mode 100644 index 3ac98fa..0000000 --- a/exercises/ex2/com.myorg.myapp/webapp/test/unit/unitTests.qunit.html +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - Unit tests for the UI5 Application: com.myorg.myapp - - - - - - - - - -
-
- - diff --git a/exercises/ex2/com.myorg.myapp/webapp/test/unit/unitTests.qunit.ts b/exercises/ex2/com.myorg.myapp/webapp/test/unit/unitTests.qunit.ts index 592d987..2975400 100644 --- a/exercises/ex2/com.myorg.myapp/webapp/test/unit/unitTests.qunit.ts +++ b/exercises/ex2/com.myorg.myapp/webapp/test/unit/unitTests.qunit.ts @@ -1,7 +1 @@ -// https://api.qunitjs.com/config/autostart/ -QUnit.config.autostart = false; - -// import all your QUnit tests here -void Promise.all([import("unit/controller/Main.qunit")]).then(() => { - QUnit.start(); -}); +import "./controller/Main.qunit"; diff --git a/exercises/ex3/com.myorg.myapp/package.json b/exercises/ex3/com.myorg.myapp/package.json index dc49b17..1c1c9ae 100644 --- a/exercises/ex3/com.myorg.myapp/package.json +++ b/exercises/ex3/com.myorg.myapp/package.json @@ -23,7 +23,7 @@ "@openui5/types": "1.115.1", "@typescript-eslint/eslint-plugin": "^5.61.0", "@typescript-eslint/parser": "^5.61.0", - "@ui5/cli": "^3.3.1", + "@ui5/cli": "^4.0.11", "eslint": "^8.44.0", "karma": "^6.4.2", "karma-chrome-launcher": "^3.2.0", diff --git a/exercises/ex3/com.myorg.myapp/ui5-dist.yaml b/exercises/ex3/com.myorg.myapp/ui5-dist.yaml index 791a2b2..a1da094 100644 --- a/exercises/ex3/com.myorg.myapp/ui5-dist.yaml +++ b/exercises/ex3/com.myorg.myapp/ui5-dist.yaml @@ -8,7 +8,7 @@ resources: webapp: dist framework: name: OpenUI5 - version: "1.115.1" + version: "1.131.1" libraries: - name: sap.m - name: sap.ui.core diff --git a/exercises/ex3/com.myorg.myapp/ui5.yaml b/exercises/ex3/com.myorg.myapp/ui5.yaml index b7cf513..ff5606e 100644 --- a/exercises/ex3/com.myorg.myapp/ui5.yaml +++ b/exercises/ex3/com.myorg.myapp/ui5.yaml @@ -4,7 +4,7 @@ metadata: type: application framework: name: OpenUI5 - version: "1.115.1" + version: "1.131.1" libraries: - name: sap.m - name: sap.ui.core diff --git a/exercises/ex3/com.myorg.myapp/webapp/test/Test.qunit.html b/exercises/ex3/com.myorg.myapp/webapp/test/Test.qunit.html new file mode 100644 index 0000000..6c14f72 --- /dev/null +++ b/exercises/ex3/com.myorg.myapp/webapp/test/Test.qunit.html @@ -0,0 +1,16 @@ + + + + + + + +
+
+ + diff --git a/exercises/ex3/com.myorg.myapp/webapp/test/integration/opaTests.qunit.html b/exercises/ex3/com.myorg.myapp/webapp/test/integration/opaTests.qunit.html deleted file mode 100644 index 539a621..0000000 --- a/exercises/ex3/com.myorg.myapp/webapp/test/integration/opaTests.qunit.html +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - Integration tests for the UI5 Application: com.myorg.myapp - - - - - - -
-
- - diff --git a/exercises/ex3/com.myorg.myapp/webapp/test/integration/opaTests.qunit.ts b/exercises/ex3/com.myorg.myapp/webapp/test/integration/opaTests.qunit.ts index c7eec8f..217ce2c 100644 --- a/exercises/ex3/com.myorg.myapp/webapp/test/integration/opaTests.qunit.ts +++ b/exercises/ex3/com.myorg.myapp/webapp/test/integration/opaTests.qunit.ts @@ -1,7 +1 @@ -// https://api.qunitjs.com/config/autostart/ -QUnit.config.autostart = false; - -// import all your OPA journeys here -void Promise.all([import("integration/HelloJourney")]).then(() => { - QUnit.start(); -}); +import "./HelloJourney"; diff --git a/exercises/ex3/com.myorg.myapp/webapp/test/testsuite.qunit.html b/exercises/ex3/com.myorg.myapp/webapp/test/testsuite.qunit.html index 31d8a7e..86113b2 100644 --- a/exercises/ex3/com.myorg.myapp/webapp/test/testsuite.qunit.html +++ b/exercises/ex3/com.myorg.myapp/webapp/test/testsuite.qunit.html @@ -1,13 +1,15 @@ - - - - - QUnit test suite for the UI5 Application: com.myorg.myapp - - + + - + + diff --git a/exercises/ex3/com.myorg.myapp/webapp/test/testsuite.qunit.ts b/exercises/ex3/com.myorg.myapp/webapp/test/testsuite.qunit.ts index a95d2e6..6521a1c 100644 --- a/exercises/ex3/com.myorg.myapp/webapp/test/testsuite.qunit.ts +++ b/exercises/ex3/com.myorg.myapp/webapp/test/testsuite.qunit.ts @@ -1,9 +1,25 @@ -/* eslint-disable */ -// @ts-nocheck -window.suite = function () { - const suite = new parent.jsUnitTestSuite(); - const sContextPath = location.pathname.match(/(.*\/)(?:[^/]+)/)?.[1]; - suite.addTestPage(sContextPath + "unit/unitTests.qunit.html"); - suite.addTestPage(sContextPath + "integration/opaTests.qunit.html"); - return suite; +export default { + name: "Unit test suite for the UI5 Application: com.myorg.myapp", + defaults: { + page: "ui5://test-resources/com/myorg/myapp/Test.qunit.html?testsuite={suite}&test={name}", + qunit: { + version: 2 + }, + ui5: { + theme: "sap_horizon" + }, + loader: { + paths: { + "com/myorg/myapp": "../" + } + } + }, + tests: { + "unit/unitTests": { + title: "Unit tests for the UI5 Application: com.myorg.myapp" + }, + "integration/opaTests": { + title: "Integration tests for the UI5 Application: com.myorg.myapp" + } + } }; diff --git a/exercises/ex3/com.myorg.myapp/webapp/test/unit/unitTests.qunit.html b/exercises/ex3/com.myorg.myapp/webapp/test/unit/unitTests.qunit.html deleted file mode 100644 index 3ac98fa..0000000 --- a/exercises/ex3/com.myorg.myapp/webapp/test/unit/unitTests.qunit.html +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - Unit tests for the UI5 Application: com.myorg.myapp - - - - - - - - - -
-
- - diff --git a/exercises/ex3/com.myorg.myapp/webapp/test/unit/unitTests.qunit.ts b/exercises/ex3/com.myorg.myapp/webapp/test/unit/unitTests.qunit.ts index 592d987..2975400 100644 --- a/exercises/ex3/com.myorg.myapp/webapp/test/unit/unitTests.qunit.ts +++ b/exercises/ex3/com.myorg.myapp/webapp/test/unit/unitTests.qunit.ts @@ -1,7 +1 @@ -// https://api.qunitjs.com/config/autostart/ -QUnit.config.autostart = false; - -// import all your QUnit tests here -void Promise.all([import("unit/controller/Main.qunit")]).then(() => { - QUnit.start(); -}); +import "./controller/Main.qunit"; diff --git a/exercises/ex4/README.md b/exercises/ex4/README.md index 04bbebf..0059a60 100644 --- a/exercises/ex4/README.md +++ b/exercises/ex4/README.md @@ -28,7 +28,7 @@ Afterwards, you need to enhance the `ui5.yaml` file and add the `ui5-tooling-mod > Make absolutely sure the indentation is correct! It needs to be like for the previous items! ```yaml - specVersion: '2.0' + specVersion: "3.0" […] builder: customTasks: diff --git a/exercises/ex4/com.myorg.myapp/package.json b/exercises/ex4/com.myorg.myapp/package.json index 9eb7eaa..3355526 100644 --- a/exercises/ex4/com.myorg.myapp/package.json +++ b/exercises/ex4/com.myorg.myapp/package.json @@ -20,10 +20,10 @@ "test": "npm run lint && npm run karma-ci-cov" }, "devDependencies": { - "@openui5/types": "1.115.1", + "@openui5/types": "1.131.1", "@typescript-eslint/eslint-plugin": "^5.61.0", "@typescript-eslint/parser": "^5.61.0", - "@ui5/cli": "^3.3.1", + "@ui5/cli": "^4.0.11", "eslint": "^8.44.0", "karma": "^6.4.2", "karma-chrome-launcher": "^3.2.0", diff --git a/exercises/ex4/com.myorg.myapp/ui5-dist.yaml b/exercises/ex4/com.myorg.myapp/ui5-dist.yaml index 791a2b2..a1da094 100644 --- a/exercises/ex4/com.myorg.myapp/ui5-dist.yaml +++ b/exercises/ex4/com.myorg.myapp/ui5-dist.yaml @@ -8,7 +8,7 @@ resources: webapp: dist framework: name: OpenUI5 - version: "1.115.1" + version: "1.131.1" libraries: - name: sap.m - name: sap.ui.core diff --git a/exercises/ex4/com.myorg.myapp/ui5.yaml b/exercises/ex4/com.myorg.myapp/ui5.yaml index fcaff66..9482ea6 100644 --- a/exercises/ex4/com.myorg.myapp/ui5.yaml +++ b/exercises/ex4/com.myorg.myapp/ui5.yaml @@ -4,7 +4,7 @@ metadata: type: application framework: name: OpenUI5 - version: "1.115.1" + version: "1.131.1" libraries: - name: sap.m - name: sap.ui.core diff --git a/exercises/ex4/com.myorg.myapp/webapp/test/Test.qunit.html b/exercises/ex4/com.myorg.myapp/webapp/test/Test.qunit.html new file mode 100644 index 0000000..6c14f72 --- /dev/null +++ b/exercises/ex4/com.myorg.myapp/webapp/test/Test.qunit.html @@ -0,0 +1,16 @@ + + + + + + + +
+
+ + diff --git a/exercises/ex4/com.myorg.myapp/webapp/test/integration/opaTests.qunit.html b/exercises/ex4/com.myorg.myapp/webapp/test/integration/opaTests.qunit.html deleted file mode 100644 index 539a621..0000000 --- a/exercises/ex4/com.myorg.myapp/webapp/test/integration/opaTests.qunit.html +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - Integration tests for the UI5 Application: com.myorg.myapp - - - - - - -
-
- - diff --git a/exercises/ex4/com.myorg.myapp/webapp/test/integration/opaTests.qunit.ts b/exercises/ex4/com.myorg.myapp/webapp/test/integration/opaTests.qunit.ts index c7eec8f..217ce2c 100644 --- a/exercises/ex4/com.myorg.myapp/webapp/test/integration/opaTests.qunit.ts +++ b/exercises/ex4/com.myorg.myapp/webapp/test/integration/opaTests.qunit.ts @@ -1,7 +1 @@ -// https://api.qunitjs.com/config/autostart/ -QUnit.config.autostart = false; - -// import all your OPA journeys here -void Promise.all([import("integration/HelloJourney")]).then(() => { - QUnit.start(); -}); +import "./HelloJourney"; diff --git a/exercises/ex4/com.myorg.myapp/webapp/test/testsuite.qunit.html b/exercises/ex4/com.myorg.myapp/webapp/test/testsuite.qunit.html index 31d8a7e..86113b2 100644 --- a/exercises/ex4/com.myorg.myapp/webapp/test/testsuite.qunit.html +++ b/exercises/ex4/com.myorg.myapp/webapp/test/testsuite.qunit.html @@ -1,13 +1,15 @@ - - - - - QUnit test suite for the UI5 Application: com.myorg.myapp - - + + - + + diff --git a/exercises/ex4/com.myorg.myapp/webapp/test/testsuite.qunit.ts b/exercises/ex4/com.myorg.myapp/webapp/test/testsuite.qunit.ts index a95d2e6..6521a1c 100644 --- a/exercises/ex4/com.myorg.myapp/webapp/test/testsuite.qunit.ts +++ b/exercises/ex4/com.myorg.myapp/webapp/test/testsuite.qunit.ts @@ -1,9 +1,25 @@ -/* eslint-disable */ -// @ts-nocheck -window.suite = function () { - const suite = new parent.jsUnitTestSuite(); - const sContextPath = location.pathname.match(/(.*\/)(?:[^/]+)/)?.[1]; - suite.addTestPage(sContextPath + "unit/unitTests.qunit.html"); - suite.addTestPage(sContextPath + "integration/opaTests.qunit.html"); - return suite; +export default { + name: "Unit test suite for the UI5 Application: com.myorg.myapp", + defaults: { + page: "ui5://test-resources/com/myorg/myapp/Test.qunit.html?testsuite={suite}&test={name}", + qunit: { + version: 2 + }, + ui5: { + theme: "sap_horizon" + }, + loader: { + paths: { + "com/myorg/myapp": "../" + } + } + }, + tests: { + "unit/unitTests": { + title: "Unit tests for the UI5 Application: com.myorg.myapp" + }, + "integration/opaTests": { + title: "Integration tests for the UI5 Application: com.myorg.myapp" + } + } }; diff --git a/exercises/ex4/com.myorg.myapp/webapp/test/unit/unitTests.qunit.html b/exercises/ex4/com.myorg.myapp/webapp/test/unit/unitTests.qunit.html deleted file mode 100644 index 3ac98fa..0000000 --- a/exercises/ex4/com.myorg.myapp/webapp/test/unit/unitTests.qunit.html +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - Unit tests for the UI5 Application: com.myorg.myapp - - - - - - - - - -
-
- - diff --git a/exercises/ex4/com.myorg.myapp/webapp/test/unit/unitTests.qunit.ts b/exercises/ex4/com.myorg.myapp/webapp/test/unit/unitTests.qunit.ts index 592d987..2975400 100644 --- a/exercises/ex4/com.myorg.myapp/webapp/test/unit/unitTests.qunit.ts +++ b/exercises/ex4/com.myorg.myapp/webapp/test/unit/unitTests.qunit.ts @@ -1,7 +1 @@ -// https://api.qunitjs.com/config/autostart/ -QUnit.config.autostart = false; - -// import all your QUnit tests here -void Promise.all([import("unit/controller/Main.qunit")]).then(() => { - QUnit.start(); -}); +import "./controller/Main.qunit"; diff --git a/exercises/ex5/com.myorg.myapp/package.json b/exercises/ex5/com.myorg.myapp/package.json index f45769d..9c5489c 100644 --- a/exercises/ex5/com.myorg.myapp/package.json +++ b/exercises/ex5/com.myorg.myapp/package.json @@ -20,10 +20,10 @@ "test": "npm run lint && npm run karma-ci-cov" }, "devDependencies": { - "@openui5/types": "1.115.1", + "@openui5/types": "1.131.1", "@typescript-eslint/eslint-plugin": "^5.61.0", "@typescript-eslint/parser": "^5.61.0", - "@ui5/cli": "^3.3.1", + "@ui5/cli": "^4.0.11", "@ui5/ts-interface-generator": "^0.7.0", "eslint": "^8.44.0", "karma": "^6.4.2", diff --git a/exercises/ex5/com.myorg.myapp/ui5-dist.yaml b/exercises/ex5/com.myorg.myapp/ui5-dist.yaml index 791a2b2..a1da094 100644 --- a/exercises/ex5/com.myorg.myapp/ui5-dist.yaml +++ b/exercises/ex5/com.myorg.myapp/ui5-dist.yaml @@ -8,7 +8,7 @@ resources: webapp: dist framework: name: OpenUI5 - version: "1.115.1" + version: "1.131.1" libraries: - name: sap.m - name: sap.ui.core diff --git a/exercises/ex5/com.myorg.myapp/ui5.yaml b/exercises/ex5/com.myorg.myapp/ui5.yaml index fcaff66..9482ea6 100644 --- a/exercises/ex5/com.myorg.myapp/ui5.yaml +++ b/exercises/ex5/com.myorg.myapp/ui5.yaml @@ -4,7 +4,7 @@ metadata: type: application framework: name: OpenUI5 - version: "1.115.1" + version: "1.131.1" libraries: - name: sap.m - name: sap.ui.core diff --git a/exercises/ex5/com.myorg.myapp/webapp/test/Test.qunit.html b/exercises/ex5/com.myorg.myapp/webapp/test/Test.qunit.html new file mode 100644 index 0000000..6c14f72 --- /dev/null +++ b/exercises/ex5/com.myorg.myapp/webapp/test/Test.qunit.html @@ -0,0 +1,16 @@ + + + + + + + +
+
+ + diff --git a/exercises/ex5/com.myorg.myapp/webapp/test/integration/opaTests.qunit.html b/exercises/ex5/com.myorg.myapp/webapp/test/integration/opaTests.qunit.html deleted file mode 100644 index 539a621..0000000 --- a/exercises/ex5/com.myorg.myapp/webapp/test/integration/opaTests.qunit.html +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - Integration tests for the UI5 Application: com.myorg.myapp - - - - - - -
-
- - diff --git a/exercises/ex5/com.myorg.myapp/webapp/test/integration/opaTests.qunit.ts b/exercises/ex5/com.myorg.myapp/webapp/test/integration/opaTests.qunit.ts index c7eec8f..217ce2c 100644 --- a/exercises/ex5/com.myorg.myapp/webapp/test/integration/opaTests.qunit.ts +++ b/exercises/ex5/com.myorg.myapp/webapp/test/integration/opaTests.qunit.ts @@ -1,7 +1 @@ -// https://api.qunitjs.com/config/autostart/ -QUnit.config.autostart = false; - -// import all your OPA journeys here -void Promise.all([import("integration/HelloJourney")]).then(() => { - QUnit.start(); -}); +import "./HelloJourney"; diff --git a/exercises/ex5/com.myorg.myapp/webapp/test/testsuite.qunit.html b/exercises/ex5/com.myorg.myapp/webapp/test/testsuite.qunit.html index 31d8a7e..86113b2 100644 --- a/exercises/ex5/com.myorg.myapp/webapp/test/testsuite.qunit.html +++ b/exercises/ex5/com.myorg.myapp/webapp/test/testsuite.qunit.html @@ -1,13 +1,15 @@ - - - - - QUnit test suite for the UI5 Application: com.myorg.myapp - - + + - + + diff --git a/exercises/ex5/com.myorg.myapp/webapp/test/testsuite.qunit.ts b/exercises/ex5/com.myorg.myapp/webapp/test/testsuite.qunit.ts index a95d2e6..6521a1c 100644 --- a/exercises/ex5/com.myorg.myapp/webapp/test/testsuite.qunit.ts +++ b/exercises/ex5/com.myorg.myapp/webapp/test/testsuite.qunit.ts @@ -1,9 +1,25 @@ -/* eslint-disable */ -// @ts-nocheck -window.suite = function () { - const suite = new parent.jsUnitTestSuite(); - const sContextPath = location.pathname.match(/(.*\/)(?:[^/]+)/)?.[1]; - suite.addTestPage(sContextPath + "unit/unitTests.qunit.html"); - suite.addTestPage(sContextPath + "integration/opaTests.qunit.html"); - return suite; +export default { + name: "Unit test suite for the UI5 Application: com.myorg.myapp", + defaults: { + page: "ui5://test-resources/com/myorg/myapp/Test.qunit.html?testsuite={suite}&test={name}", + qunit: { + version: 2 + }, + ui5: { + theme: "sap_horizon" + }, + loader: { + paths: { + "com/myorg/myapp": "../" + } + } + }, + tests: { + "unit/unitTests": { + title: "Unit tests for the UI5 Application: com.myorg.myapp" + }, + "integration/opaTests": { + title: "Integration tests for the UI5 Application: com.myorg.myapp" + } + } }; diff --git a/exercises/ex5/com.myorg.myapp/webapp/test/unit/unitTests.qunit.html b/exercises/ex5/com.myorg.myapp/webapp/test/unit/unitTests.qunit.html deleted file mode 100644 index 3ac98fa..0000000 --- a/exercises/ex5/com.myorg.myapp/webapp/test/unit/unitTests.qunit.html +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - Unit tests for the UI5 Application: com.myorg.myapp - - - - - - - - - -
-
- - diff --git a/exercises/ex5/com.myorg.myapp/webapp/test/unit/unitTests.qunit.ts b/exercises/ex5/com.myorg.myapp/webapp/test/unit/unitTests.qunit.ts index 592d987..2975400 100644 --- a/exercises/ex5/com.myorg.myapp/webapp/test/unit/unitTests.qunit.ts +++ b/exercises/ex5/com.myorg.myapp/webapp/test/unit/unitTests.qunit.ts @@ -1,7 +1 @@ -// https://api.qunitjs.com/config/autostart/ -QUnit.config.autostart = false; - -// import all your QUnit tests here -void Promise.all([import("unit/controller/Main.qunit")]).then(() => { - QUnit.start(); -}); +import "./controller/Main.qunit"; diff --git a/exercises/ex6/README.md b/exercises/ex6/README.md index 874763f..bc66e39 100644 --- a/exercises/ex6/README.md +++ b/exercises/ex6/README.md @@ -10,18 +10,17 @@ webapp/test | ├── pages // user defined test pages folder | | └── MainPage.ts // - OPA5 test page for the Main view | ├── HelloJourney.ts // the OPA5 test journey -| ├── opaTests.qunit.html // the OPA5 testsuite html page | └── opaTests.qunit.ts // the OPA5 testsuite ├── unit | ├── controller // user defined QUnit tests folder | | └── Main.qunit.ts // - QUnit test for the Main controller -| ├── unitTests.qunit.html // the QUnit testsuite html page | └── unitTests.qunit.ts // the QUnit testsuite +├── Test.qunit.html // the generic test page ├── testsuite.qunit.html // the general testsuite html page └── testsuite.qunit.ts // the general testsuite ``` -The entry point of the test code is the `testsuite.qunit.html` which loads the `testsuite.qunit.ts`. Here the QUnit testsuite `unit/unitTest.qunit.html` and the OPA5 testsuite `integration/opaTests.qunit.html` are registered. The QUnit testsuite registers all QUnit test in the `unit/unitTest.qunit.ts` and the OPA5 testsuite in the `integration/opaTests.qunit.ts`. +The entry point of the test code is the `testsuite.qunit.html` which loads the `testsuite.qunit.ts`. Here the QUnit testsuite `unit/unitTest.qunit.ts` and the OPA5 testsuite `integration/opaTests.qunit.ts` are registered. These testsuites register all QUnit tests in the `unit/unitTest.qunit.ts` and all OPA5 tests in the `integration/opaTests.qunit.ts`. To make TypeScript aware about the additional module paths for the `unit` and the `integration` test code, we need to extend the paths information of the `tsconfig.json` with the following entries: @@ -56,7 +55,7 @@ QUnit.test("The Main controller class has all custom methods", function (assert) 2. You can also add more asserts, e.g. you want you add an assert for the availability of the `loadWeatherData` function. -Now you can validate whether the test execution works properly by starting the development server and the QUnit test with the following command: `npm start -- -o test/unit/unitTests.qunit.html`. +Now you can validate whether the test execution works properly by starting the development server and the general test html page with the following command: `npm start -- -o test/testsuite.qunit.html`. By clicking on the field `unit/unitTests` you will reach the generic test page for unit tests. > :tada: **NEW**: This exercise shows how you can benefit from code completion for your QUnit test code. @@ -131,7 +130,7 @@ opaTest("Should show location Heidelberg", function () { With the journey above, the application is started and the location *Heidelberg* is entered to the location input and then verifies whether the location `Heidelberg` has been loaded properly. -Now you can validate whether the test execution works properly by starting the development server and the QUnit test with the following command: `npm start -- -o test/integration/opaTests.qunit.html`. +Now you can validate whether the test execution works properly by starting the development server and the general test html page with the following command: `npm start -- -o test/testsuite.qunit.html`. By clicking on the field `integration/opaTests` you will reach the generic test page for integration tests. > :tada: **NEW**: This exercise shows how you can define you page object with TypeScript and benefit from code completion for your OPA5 journey using the OPA5 test code and your page object. @@ -246,7 +245,7 @@ void Promise.all([ }); ``` -Now you can validate whether the test execution works properly by starting the development server and the QUnit test with the following command: `npm start -- -o test/unit/unitTests.qunit.html`. +Now you can validate whether the test execution works properly by starting the development server and the general test html page with the following command: `npm start -- -o test/testsuite.qunit.html`. By clicking on the field `unit/unitTests` you will reach the generic test page for unit tests. > :tada: **NEW**: New QUnit or OPA tests need to be added to testsuites to include them into the automated execution. diff --git a/exercises/ex6/com.myorg.myapp/package.json b/exercises/ex6/com.myorg.myapp/package.json index f45769d..d9cad32 100644 --- a/exercises/ex6/com.myorg.myapp/package.json +++ b/exercises/ex6/com.myorg.myapp/package.json @@ -23,7 +23,7 @@ "@openui5/types": "1.115.1", "@typescript-eslint/eslint-plugin": "^5.61.0", "@typescript-eslint/parser": "^5.61.0", - "@ui5/cli": "^3.3.1", + "@ui5/cli": "^4.0.11", "@ui5/ts-interface-generator": "^0.7.0", "eslint": "^8.44.0", "karma": "^6.4.2", diff --git a/exercises/ex6/com.myorg.myapp/ui5-dist.yaml b/exercises/ex6/com.myorg.myapp/ui5-dist.yaml index 791a2b2..a1da094 100644 --- a/exercises/ex6/com.myorg.myapp/ui5-dist.yaml +++ b/exercises/ex6/com.myorg.myapp/ui5-dist.yaml @@ -8,7 +8,7 @@ resources: webapp: dist framework: name: OpenUI5 - version: "1.115.1" + version: "1.131.1" libraries: - name: sap.m - name: sap.ui.core diff --git a/exercises/ex6/com.myorg.myapp/ui5.yaml b/exercises/ex6/com.myorg.myapp/ui5.yaml index fcaff66..9482ea6 100644 --- a/exercises/ex6/com.myorg.myapp/ui5.yaml +++ b/exercises/ex6/com.myorg.myapp/ui5.yaml @@ -4,7 +4,7 @@ metadata: type: application framework: name: OpenUI5 - version: "1.115.1" + version: "1.131.1" libraries: - name: sap.m - name: sap.ui.core diff --git a/exercises/ex6/com.myorg.myapp/webapp/test/Test.qunit.html b/exercises/ex6/com.myorg.myapp/webapp/test/Test.qunit.html new file mode 100644 index 0000000..6c14f72 --- /dev/null +++ b/exercises/ex6/com.myorg.myapp/webapp/test/Test.qunit.html @@ -0,0 +1,16 @@ + + + + + + + +
+
+ + diff --git a/exercises/ex6/com.myorg.myapp/webapp/test/integration/opaTests.qunit.html b/exercises/ex6/com.myorg.myapp/webapp/test/integration/opaTests.qunit.html deleted file mode 100644 index 539a621..0000000 --- a/exercises/ex6/com.myorg.myapp/webapp/test/integration/opaTests.qunit.html +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - Integration tests for the UI5 Application: com.myorg.myapp - - - - - - -
-
- - diff --git a/exercises/ex6/com.myorg.myapp/webapp/test/integration/opaTests.qunit.ts b/exercises/ex6/com.myorg.myapp/webapp/test/integration/opaTests.qunit.ts index c7eec8f..217ce2c 100644 --- a/exercises/ex6/com.myorg.myapp/webapp/test/integration/opaTests.qunit.ts +++ b/exercises/ex6/com.myorg.myapp/webapp/test/integration/opaTests.qunit.ts @@ -1,7 +1 @@ -// https://api.qunitjs.com/config/autostart/ -QUnit.config.autostart = false; - -// import all your OPA journeys here -void Promise.all([import("integration/HelloJourney")]).then(() => { - QUnit.start(); -}); +import "./HelloJourney"; diff --git a/exercises/ex6/com.myorg.myapp/webapp/test/testsuite.qunit.html b/exercises/ex6/com.myorg.myapp/webapp/test/testsuite.qunit.html index 31d8a7e..86113b2 100644 --- a/exercises/ex6/com.myorg.myapp/webapp/test/testsuite.qunit.html +++ b/exercises/ex6/com.myorg.myapp/webapp/test/testsuite.qunit.html @@ -1,13 +1,15 @@ - - - - - QUnit test suite for the UI5 Application: com.myorg.myapp - - + + - + + diff --git a/exercises/ex6/com.myorg.myapp/webapp/test/testsuite.qunit.ts b/exercises/ex6/com.myorg.myapp/webapp/test/testsuite.qunit.ts index a95d2e6..6521a1c 100644 --- a/exercises/ex6/com.myorg.myapp/webapp/test/testsuite.qunit.ts +++ b/exercises/ex6/com.myorg.myapp/webapp/test/testsuite.qunit.ts @@ -1,9 +1,25 @@ -/* eslint-disable */ -// @ts-nocheck -window.suite = function () { - const suite = new parent.jsUnitTestSuite(); - const sContextPath = location.pathname.match(/(.*\/)(?:[^/]+)/)?.[1]; - suite.addTestPage(sContextPath + "unit/unitTests.qunit.html"); - suite.addTestPage(sContextPath + "integration/opaTests.qunit.html"); - return suite; +export default { + name: "Unit test suite for the UI5 Application: com.myorg.myapp", + defaults: { + page: "ui5://test-resources/com/myorg/myapp/Test.qunit.html?testsuite={suite}&test={name}", + qunit: { + version: 2 + }, + ui5: { + theme: "sap_horizon" + }, + loader: { + paths: { + "com/myorg/myapp": "../" + } + } + }, + tests: { + "unit/unitTests": { + title: "Unit tests for the UI5 Application: com.myorg.myapp" + }, + "integration/opaTests": { + title: "Integration tests for the UI5 Application: com.myorg.myapp" + } + } }; diff --git a/exercises/ex6/com.myorg.myapp/webapp/test/unit/unitTests.qunit.html b/exercises/ex6/com.myorg.myapp/webapp/test/unit/unitTests.qunit.html deleted file mode 100644 index 3ac98fa..0000000 --- a/exercises/ex6/com.myorg.myapp/webapp/test/unit/unitTests.qunit.html +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - Unit tests for the UI5 Application: com.myorg.myapp - - - - - - - - - -
-
- - diff --git a/exercises/ex6/com.myorg.myapp/webapp/test/unit/unitTests.qunit.ts b/exercises/ex6/com.myorg.myapp/webapp/test/unit/unitTests.qunit.ts index 57cab2c..89819d4 100644 --- a/exercises/ex6/com.myorg.myapp/webapp/test/unit/unitTests.qunit.ts +++ b/exercises/ex6/com.myorg.myapp/webapp/test/unit/unitTests.qunit.ts @@ -1,10 +1,2 @@ -// https://api.qunitjs.com/config/autostart/ -QUnit.config.autostart = false; - -// import all your QUnit tests here -void Promise.all([ - import("unit/controller/Main.qunit"), - import("unit/control/WindDirection.qunit"), -]).then(() => { - QUnit.start(); -}); +import "./controller/Main.qunit"; +import "./control/WindDirection.qunit"; diff --git a/generator/generators/app/templates/package.json b/generator/generators/app/templates/package.json index cb43d81..d076503 100644 --- a/generator/generators/app/templates/package.json +++ b/generator/generators/app/templates/package.json @@ -23,7 +23,7 @@ "<%= tstypes %>": "<%= tstypesVersion %>", "@typescript-eslint/eslint-plugin": "^5.61.0", "@typescript-eslint/parser": "^5.61.0", - "@ui5/cli": "^3.3.1", + "@ui5/cli": "^4.0.11", "eslint": "^8.44.0", "karma": "^6.4.2", "karma-chrome-launcher": "^3.2.0", diff --git a/generator/generators/app/templates/webapp/test/Test.qunit.html b/generator/generators/app/templates/webapp/test/Test.qunit.html new file mode 100644 index 0000000..b0903f1 --- /dev/null +++ b/generator/generators/app/templates/webapp/test/Test.qunit.html @@ -0,0 +1,16 @@ + + + + + + + +
+
+ + diff --git a/generator/generators/app/templates/webapp/test/integration/opaTests.qunit.html b/generator/generators/app/templates/webapp/test/integration/opaTests.qunit.html deleted file mode 100644 index 730f4ff..0000000 --- a/generator/generators/app/templates/webapp/test/integration/opaTests.qunit.html +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - Integration tests for the UI5 Application: <%= namespace %> - - - - - - -
-
- - diff --git a/generator/generators/app/templates/webapp/test/integration/opaTests.qunit.ts b/generator/generators/app/templates/webapp/test/integration/opaTests.qunit.ts index c7eec8f..217ce2c 100644 --- a/generator/generators/app/templates/webapp/test/integration/opaTests.qunit.ts +++ b/generator/generators/app/templates/webapp/test/integration/opaTests.qunit.ts @@ -1,7 +1 @@ -// https://api.qunitjs.com/config/autostart/ -QUnit.config.autostart = false; - -// import all your OPA journeys here -void Promise.all([import("integration/HelloJourney")]).then(() => { - QUnit.start(); -}); +import "./HelloJourney"; diff --git a/generator/generators/app/templates/webapp/test/testsuite.qunit.html b/generator/generators/app/templates/webapp/test/testsuite.qunit.html index a145166..a72848e 100644 --- a/generator/generators/app/templates/webapp/test/testsuite.qunit.html +++ b/generator/generators/app/templates/webapp/test/testsuite.qunit.html @@ -1,13 +1,12 @@ - - - - - - - - QUnit test suite for the UI5 Application: <%= namespace %> - - - - - + + + + + + diff --git a/generator/generators/app/templates/webapp/test/testsuite.qunit.ts b/generator/generators/app/templates/webapp/test/testsuite.qunit.ts index a95d2e6..f61833a 100644 --- a/generator/generators/app/templates/webapp/test/testsuite.qunit.ts +++ b/generator/generators/app/templates/webapp/test/testsuite.qunit.ts @@ -1,9 +1,25 @@ -/* eslint-disable */ -// @ts-nocheck -window.suite = function () { - const suite = new parent.jsUnitTestSuite(); - const sContextPath = location.pathname.match(/(.*\/)(?:[^/]+)/)?.[1]; - suite.addTestPage(sContextPath + "unit/unitTests.qunit.html"); - suite.addTestPage(sContextPath + "integration/opaTests.qunit.html"); - return suite; +export default { + name: "Unit test suite for the UI5 Application: <%= appId %>", + defaults: { + page: "ui5://test-resources/<%= appURI %>/Test.qunit.html?testsuite={suite}&test={name}", + qunit: { + version: 2 + }, + ui5: { + theme: "<%= defaultTheme %>" + }, + loader: { + paths: { + "<%= appURI %>": "../" + } + } + }, + tests: { + "unit/unitTests": { + title: "Unit tests for the UI5 Application: <%= appId %>" + }, + "integration/opaTests": { + title: "Integration tests for the UI5 Application: <%= appId %>" + } + } }; diff --git a/generator/generators/app/templates/webapp/test/unit/unitTests.qunit.html b/generator/generators/app/templates/webapp/test/unit/unitTests.qunit.html deleted file mode 100644 index ed753aa..0000000 --- a/generator/generators/app/templates/webapp/test/unit/unitTests.qunit.html +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - Unit tests for the UI5 Application: <%= namespace %> - - - - - - - - - -
-
- - diff --git a/generator/generators/app/templates/webapp/test/unit/unitTests.qunit.ts b/generator/generators/app/templates/webapp/test/unit/unitTests.qunit.ts index 592d987..2975400 100644 --- a/generator/generators/app/templates/webapp/test/unit/unitTests.qunit.ts +++ b/generator/generators/app/templates/webapp/test/unit/unitTests.qunit.ts @@ -1,7 +1 @@ -// https://api.qunitjs.com/config/autostart/ -QUnit.config.autostart = false; - -// import all your QUnit tests here -void Promise.all([import("unit/controller/Main.qunit")]).then(() => { - QUnit.start(); -}); +import "./controller/Main.qunit";