Skip to content

Commit

Permalink
Migrate tutorial and generator template to use Test Starter setup (#19)
Browse files Browse the repository at this point in the history
  • Loading branch information
maxreichmann authored Dec 9, 2024
1 parent 20757d0 commit 2565b2c
Show file tree
Hide file tree
Showing 72 changed files with 400 additions and 672 deletions.
2 changes: 1 addition & 1 deletion exercises/ex0/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)!<br>
Expand Down
2 changes: 1 addition & 1 deletion exercises/ex1/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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? <Your Name>
? 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
Expand Down
4 changes: 2 additions & 2 deletions exercises/ex1/com.myorg.myapp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion exercises/ex1/com.myorg.myapp/ui5-dist.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion exercises/ex1/com.myorg.myapp/ui5.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
16 changes: 16 additions & 0 deletions exercises/ex1/com.myorg.myapp/webapp/test/Test.qunit.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<script
src="../resources/sap/ui/test/starter/runTest.js"
data-sap-ui-resource-roots='{
"test-resources.com.myorg.myapp": "./"
}'
></script>
</head>
<body class="sapUiBody">
<div id="qunit"></div>
<div id="qunit-fixture"></div>
</body>
</html>

This file was deleted.

Original file line number Diff line number Diff line change
@@ -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";
22 changes: 12 additions & 10 deletions exercises/ex1/com.myorg.myapp/webapp/test/testsuite.qunit.html
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Cache-control" content="no-cache, no-store, must-revalidate" />
<meta http-equiv="Pragma" content="no-cache" />
<meta http-equiv="expires" content="0" />
<meta charset="utf-8" />
<title>QUnit test suite for the UI5 Application: com.myorg.myapp</title>
<script src="../resources/sap/ui/qunit/qunit-redirect.js"></script>
<script src="testsuite.qunit.js" data-sap-ui-testsuite></script>
</head>
<body></body>
<head>
<meta charset="utf-8">
<script
src="../resources/sap/ui/test/starter/createSuite.js"
data-sap-ui-testsuite="test-resources/com/myorg/myapp/testsuite.qunit"
data-sap-ui-resource-roots='{
"test-resources.com.myorg.myapp": "./"
}'
></script>
</head>
<body>
</body>
</html>
32 changes: 24 additions & 8 deletions exercises/ex1/com.myorg.myapp/webapp/test/testsuite.qunit.ts
Original file line number Diff line number Diff line change
@@ -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"
}
}
};

This file was deleted.

Original file line number Diff line number Diff line change
@@ -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";
4 changes: 2 additions & 2 deletions exercises/ex2/com.myorg.myapp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion exercises/ex2/com.myorg.myapp/ui5-dist.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion exercises/ex2/com.myorg.myapp/ui5.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
16 changes: 16 additions & 0 deletions exercises/ex2/com.myorg.myapp/webapp/test/Test.qunit.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<script
src="../resources/sap/ui/test/starter/runTest.js"
data-sap-ui-resource-roots='{
"test-resources.com.myorg.myapp": "./"
}'
></script>
</head>
<body class="sapUiBody">
<div id="qunit"></div>
<div id="qunit-fixture"></div>
</body>
</html>

This file was deleted.

Original file line number Diff line number Diff line change
@@ -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";
18 changes: 10 additions & 8 deletions exercises/ex2/com.myorg.myapp/webapp/test/testsuite.qunit.html
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Cache-control" content="no-cache, no-store, must-revalidate" />
<meta http-equiv="Pragma" content="no-cache" />
<meta http-equiv="expires" content="0" />
<meta charset="utf-8" />
<title>QUnit test suite for the UI5 Application: com.myorg.myapp</title>
<script src="../resources/sap/ui/qunit/qunit-redirect.js"></script>
<script src="testsuite.qunit.js" data-sap-ui-testsuite></script>
<meta charset="utf-8">
<script
src="../resources/sap/ui/test/starter/createSuite.js"
data-sap-ui-testsuite="test-resources/com/myorg/myapp/testsuite.qunit"
data-sap-ui-resource-roots='{
"test-resources.com.myorg.myapp": "./"
}'
></script>
</head>
<body></body>
<body>
</body>
</html>
32 changes: 24 additions & 8 deletions exercises/ex2/com.myorg.myapp/webapp/test/testsuite.qunit.ts
Original file line number Diff line number Diff line change
@@ -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"
}
}
};

This file was deleted.

Original file line number Diff line number Diff line change
@@ -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";
Loading

0 comments on commit 2565b2c

Please sign in to comment.