test: Add e2e-tests#1355
Conversation
* 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"
|
@UI5/ui5-team-cor-fnd These tests are not included in any CI pipeline yet. It's up for debate if we want to include them. |
d3xter666
left a comment
There was a problem hiding this comment.
There's also an e2e test setup in packages/cli.
Can we leverage and consolidate the setup from there?
Or simply clean it up if it's redundant an too complex anymore?
c12b05a to
1e7aace
Compare
c3d2478 to
deacdaf
Compare
|
Tests are now included in Github Actions via a separate workflow ( |
deacdaf to
de4fb7c
Compare
| describe("ui5 version", () => { | ||
| test("output the version of the UI5 CLI", ({assert}) => { | ||
| const ui5Path = path.resolve(__dirname, "../../../packages/cli/bin/ui5.cjs"); | ||
| execFile("node", [ui5Path, "--version"], (error, stdout, stderr) => { |
There was a problem hiding this comment.
I think this test is identical to
cli/packages/cli/test/lib/cli/base.js
Line 40 in 40afbdf
Do we need both?
| // Install node_modules | ||
| await this._installNodeModules(); | ||
| // Setup environment | ||
| process.env.UI5_DATA_DIR = `${this.dotUi5Path}`; |
There was a problem hiding this comment.
| process.env.UI5_DATA_DIR = `${this.dotUi5Path}`; | |
| process.env.UI5_DATA_DIR = this.dotUi5Path; |
| // -------------------------------------------------------------------------------------------- | ||
|
|
||
| // Modify source files | ||
| await fixtureHelper.prepareForNextRun(); |
There was a problem hiding this comment.
Why is this (deletion and fresh copy of sources) necessary here? From what I can see, the source files have not been changed?
| @@ -0,0 +1,10 @@ | |||
| { | |||
There was a problem hiding this comment.
We should have a package-lock.json next to every package.json. Then we can also use ranges for the dependencies
| // #2 Build | ||
| await fixtureHelper.build(assert, ui5YamlName); | ||
|
|
||
| // Test: the dist contains the new controller and the third party import |
There was a problem hiding this comment.
Can we also check whether the thirdparty itself is present in the build result? (unless it's already without the import)
| `sap.ui.define([], () => { | ||
| return Controller.extend("application.a.controller.New",{ | ||
| onInit() { | ||
| console.log(\${PLACEHOLDER_TEXT}); |
There was a problem hiding this comment.
I think this is not a good example because the result is not valid JavaScript:
console.log(\"INSERTED_TEXT\")There was a problem hiding this comment.
Just ran the test and checked the dist output of controller/New.controller.js:
sap.ui.define([],()=>Controller.extend("application.a.controller.New",{onInit(){console.log("INSERTED_TEXT")}})); //# sourceMappingURL=New.controller.js.map
Looks fine to me. Or do you mean something different?
| "test-watch": "node --test --watch 'test/**/*.js'" | ||
| }, | ||
| "dependencies": { | ||
| "adm-zip": "0.5.17" |
There was a problem hiding this comment.
Dependency is locked via the root package-lock.json, so we can use a range here:
| "adm-zip": "0.5.17" | |
| "adm-zip": "^0.5.17" |
| @@ -0,0 +1,10 @@ | |||
| { | |||
| "name": "application.a.ts", | |||
There was a problem hiding this comment.
Use a prefix like @ui5-internal for test packages
| second: string | ||
| } | ||
|
|
||
| export default class Main { |
There was a problem hiding this comment.
Should we use a proper UI5 controller that extends sap/ui/core/mvc/Controller like in https://github.com/SAP-samples/ui5-typescript-tutorial/blob/main/exercises/ex4/com.myorg.myapp/webapp/controller/BaseController.ts#L13 ?
* Remove version.js ("ui5 --version" test)
* Cleanup code (remove template lit.)
* Remove FixtureHelper.prepareForNextRun() and its usages
* Add package-lock.json to every fixture
* ui5-tooling-modules test: Add check for thirdparty module itself (ChartJS)
* Add version ranges to every relevant package.json
* Prefix fixture packages with "@ui5-internal"
* Replace test controller with more realistic code (modified copy of ui5-typescript-tutorial)
Outsourced of Incremental Build PR #1267:
All tests are currently passing (April 8th).