Skip to content

Commit f084bc1

Browse files
committed
test: Add e2e-tests
* Add "e2e-tests" dir under "internal/" * Add tests for following community custom tasks: - ui5-tooling-transpile - ui5-task-zipper - ui5-tooling-modules - ui5-tooling-stringreplace * Add test for "ui5 --version"
1 parent d913c56 commit f084bc1

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+1093
-0
lines changed

internal/e2e-tests/README.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# E2E Tests for UI5 CLI
2+
3+
End-to-end test environment for the UI5 CLI containing realistic user scenarios.
4+
5+
## Usage
6+
7+
```bash
8+
npm install
9+
npm run unit
10+
```
11+
12+
## How It Works
13+
14+
Tests are run with the **Node.js built-in test runner**. Each test:
15+
16+
1. Copies a fixture project to a temporary directory (`./tmp`)
17+
2. Runs `npm install` there (child process)
18+
3. Runs `ui5 build` with varying configurations (child process)
19+
20+
The UI5 CLI executables are sourced directly from this repository at `packages/cli/bin/ui5.cjs`.
21+
22+
Some scenarios include multiple sequential builds with file modifications in between to simulate real-world development workflows. Node modules are getting installed on the fly for the first build and reused for subsequent builds (no reinstall).
23+
24+
25+
26+
27+
## Fixtures
28+
29+
Located under `./fixtures/`:
30+
31+
| Fixture | Description |
32+
|---|---|
33+
| `application.a` | Sample JavaScript project (controller + `manifest.json`) |
34+
| `application.a.ts` | Sample TypeScript project (based on [generator-ui5-ts-app](https://github.com/ui5-community/generator-ui5-ts-app)) |
35+
36+
> **Note:** These tests are not yet included in any CI pipeline.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"name": "application.a.ts",
3+
"version": "1.0.0",
4+
"description": "UI5 Application: application.a.ts",
5+
"license": "Apache-2.0",
6+
"devDependencies": {
7+
"@openui5/types": "1.115.1",
8+
"ui5-tooling-transpile": "3.11.0"
9+
}
10+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"compilerOptions": {
3+
"target": "es2022",
4+
"module": "es2022",
5+
"moduleResolution": "node",
6+
"skipLibCheck": true,
7+
"allowJs": true,
8+
"strict": true,
9+
"strictNullChecks": false,
10+
"strictPropertyInitialization": false,
11+
"rootDir": "./webapp",
12+
"types": ["@openui5/types", "@types/qunit"],
13+
"paths": {
14+
"application/a/ts/*": ["./webapp/*"],
15+
"unit/*": ["./webapp/test/unit/*"],
16+
"integration/*": ["./webapp/test/integration/*"]
17+
}
18+
},
19+
"include": ["./webapp/**/*"],
20+
"exclude": ["./webapp/coverage/**/*"]
21+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
specVersion: "5.0"
2+
metadata:
3+
name: application.a.ts
4+
type: application
5+
builder:
6+
customTasks:
7+
- name: ui5-tooling-transpile-task
8+
afterTask: replaceVersion
9+
server:
10+
customMiddleware:
11+
- name: ui5-tooling-transpile-middleware
12+
afterMiddleware: compression
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
type randomTSType = {
2+
first: {
3+
a: number,
4+
b: number,
5+
c: number
6+
},
7+
second: string
8+
}
9+
10+
export default class Main {
11+
onInit(): void {
12+
const z : randomTSType = {
13+
first: {
14+
a: 1,
15+
b: 2,
16+
c: 3
17+
},
18+
second: "test"
19+
};
20+
console.log(z.first.a);
21+
}
22+
}
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
{
2+
"_version": "1.12.0",
3+
"sap.app": {
4+
"id": "application.a.ts",
5+
"type": "application",
6+
"i18n": "i18n/i18n.properties",
7+
"title": "{{appTitle}}",
8+
"description": "{{appDescription}}",
9+
"applicationVersion": {
10+
"version": "1.0.0"
11+
}
12+
},
13+
"sap.ui": {
14+
"technology": "UI5",
15+
"icons": {},
16+
"deviceTypes": {
17+
"desktop": true,
18+
"tablet": true,
19+
"phone": true
20+
}
21+
},
22+
"sap.ui5": {
23+
"rootView": {
24+
"viewName": "application.a.ts.view.App",
25+
"type": "XML",
26+
"async": true,
27+
"id": "app"
28+
},
29+
"handleValidation": true,
30+
"contentDensities": {
31+
"compact": true,
32+
"cozy": true
33+
},
34+
"models": {
35+
"i18n": {
36+
"type": "sap.ui.model.resource.ResourceModel",
37+
"settings": {
38+
"bundleName": "application.a.ts.i18n.i18n"
39+
}
40+
}
41+
},
42+
"routing": {
43+
"config": {
44+
"routerClass": "sap.m.routing.Router",
45+
"viewType": "XML",
46+
"viewPath": "application.a.ts.view",
47+
"controlId": "app",
48+
"controlAggregation": "pages",
49+
"async": true
50+
},
51+
"routes": [
52+
{
53+
"pattern": "",
54+
"name": "main",
55+
"target": "main"
56+
}
57+
],
58+
"targets": {
59+
"main": {
60+
"viewId": "main",
61+
"viewName": "Main"
62+
}
63+
}
64+
}
65+
}
66+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"name": "application.a",
3+
"version": "1.0.0",
4+
"description": "UI5 Application: application.a",
5+
"license": "Apache-2.0",
6+
"dependencies": {
7+
"chart.js": "4.5.1"
8+
},
9+
"devDependencies": {
10+
"@openui5/types": "1.115.1",
11+
"ui5-task-zipper": "3.6.0",
12+
"ui5-tooling-modules": "3.35.0",
13+
"ui5-tooling-stringreplace": "3.6.0"
14+
}
15+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
specVersion: "5.0"
2+
metadata:
3+
name: application.a
4+
type: application
5+
builder:
6+
customTasks:
7+
- name: ui5-task-zipper
8+
afterTask: generateVersionInfo
9+
configuration:
10+
archiveName: "webapp"
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
specVersion: "5.0"
2+
metadata:
3+
name: application.a
4+
type: application
5+
server:
6+
customMiddleware:
7+
- name: ui5-tooling-modules-middleware
8+
afterMiddleware: compression
9+
builder:
10+
customTasks:
11+
- name: ui5-tooling-modules-task
12+
afterTask: replaceVersion
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
specVersion: "5.0"
2+
metadata:
3+
name: application.a
4+
type: application
5+
builder:
6+
customTasks:
7+
- name: ui5-tooling-stringreplace-task
8+
afterTask: replaceVersion
9+
configuration:
10+
files:
11+
- "**/*.js"
12+
replace:
13+
- placeholder: ${PLACEHOLDER_TEXT}
14+
value: "'INSERTED_TEXT'"

0 commit comments

Comments
 (0)