Skip to content

Commit

Permalink
Merge pull request #89 from ArnaudBuchholz/reserve2
Browse files Browse the repository at this point in the history
feat(reserve2): migration to reserve 2
  • Loading branch information
ArnaudBuchholz authored Jun 7, 2024
2 parents 67b71b9 + 8693b72 commit 467f62e
Show file tree
Hide file tree
Showing 22 changed files with 2,041 additions and 2,039 deletions.
23 changes: 15 additions & 8 deletions docs/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ It is also possible to preset parameters by creating a JSON file named `ui5-test
> The property names match the [option names](usage.md), converted to [lowerCamelCase](https://wiki.c2.com/?LowerCamelCase).
> Files written for v1 may **not** by compatible with v2, check [mapping](mapping_v1_v2.md).

The file is applied **before** parsing the command line parameters, hence some parameters might be **overridden**.

If you want the parameters to be **forced** *(and not be overridden by the command line)*, prefix the parameter name with `!`.
Expand All @@ -21,17 +20,25 @@ For example :

> The `pageTimeout` setting cannot be overridden by the command line parameters
**NOTE** : the `libs` parameters must be converted to an array of pairs associating `relative` URL and `source` path.
**NOTE** : The parameters accepting multiple values (denoted with ... as in `'--libs <lib...>`) may be converted to an array of values in the configuration file.

For instance, `libs` parameter can be :

```json
{
"libs": "my/namespace/lib/=../my.namespace.lib/src/my/namespace/lib/"
}
```

For instance :
> Structure of the `libs` parameter when only one value is specified
```json
{
"libs": [{
"relative": "my/namespace/feature/lib/",
"source": "../my.namespace.feature.project.lib/src/my/namespace/feature/lib/"
}]
"libs": [
"my/namespace/lib/=../my.namespace.lib/src/my/namespace/lib/",
"my/namespace/lib2/=../my.namespace.lib2/src/my/namespace/lib2/"
]
}
```

> Structure of the `libs` parameter
> Structure of the `libs` parameter when multiple values are specified
40 changes: 40 additions & 0 deletions docs/coverage.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,3 +143,43 @@ Example :
ui5-test-runner --url https://ui5.sap.com/test-resources/sap/m/demokit/orderbrowser/webapp/test/testsuite.qunit.html --coverage --coverage-proxy --coverage-proxy-include webapp/* --coverage-proxy-exclude webapp/test --disable-ui5
```

## Aggregate coverage for several projects

It is possible to execute `ui5-test-runner` on several projects and **aggregate** all coverage results to generate a **single** report.

There are several requirements :

* Projects have a **common base folder** (referenced as `<BASE_FOLDER>`)

* Projects use the **same language** *(JavaScript or TypeScript)*

* Coverage extraction must be done the **same way** *(legacy or remote)*

### Setup

* A folder is needed to store the merged coverage, it is referenced as `<MERGE_COVERAGE_FOLDER>` *(must be an **absolute** path)*. It must be **cleared** before the round of execution.

* A JSON configuration file is needed with the following content *(replace `<BASE_FOLDER>` with the actual value)*, its path is referenced as `<NYC_CONFIG_FILE>` *(must be an **absolute** path)*.

```json
{
"all": true,
"sourceMap": false,
"cwd": "<BASE_FOLDER>"
}
```

> Content of the configuration file

* [`nyc`](https://www.npmjs.com/package/nyc) is installed and available when running `npx nyc --help`

### Steps

* For each project (referenced as `<PROJECT_NAME>`) :
* `ui5-test-runner` with coverage extraction
* By default, coverage information is stored in the project root under `.nyc_output\merged\coverage.json`
* **after** `ui5-test-runner` successful execution, copy `.nyc_output\merged\coverage.json` to `<MERGE_COVERAGE_FOLDER>/<PROJECT_NAME>.json`

* Once all projects are executed and coverage files copied, execute `npx nyc merge <MERGE_COVERAGE_FOLDER> <MERGE_COVERAGE_FOLDER>/overall/coverage.json`

* Then, execute `npx nyc report --reporter=lcov --reporter=cobertura --temp-dir <MERGE_COVERAGE_FOLDER>/overall --report-dir <MERGE_COVERAGE_FOLDER>/coverage --nycrc-path <NYC_CONFIG_FILE>`
13 changes: 10 additions & 3 deletions docs/jsdom.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

## Capabilities

| `--browser` | `$/selenium-webdriver.js` |
| `--browser` | `$/jsdom.js` |
|---|---|
| Module | [jsdom](https://github.com/jsdom/jsdom/) |
| Screenshots ||
| Scripts | ✔️ |
| Traces | `console`, `network` |
| Traces | `multiplex` 1️⃣ |

## Options
```text
Expand All @@ -16,5 +16,12 @@

## Implementation notes

* ⛔ This browser instantiation command is provided to demonstrate a different kind of integration. Yet, for performance and compatibility reasons *(see below)*, it is **not** recommended to use it.

* ⚠️ Despite being actively maintained, the `jsdom` project suffers from different implementation problems. `ui5-test-runner` implements a [compatibility](https://github.com/ArnaudBuchholz/ui5-test-runner/blob/main/src/defaults/jsdom/compatibility.js) layer to compensate some of them *(the ones that are detected during compatibility tests)*. It happens that UI5 and / or `jsdom` changes break this layer.

* `jsdom` does not renders HTML pages, it **cannot** take screenshots
* Because no rendering is done, the `visible` OPA5 matcher is overridden to *'simulate'* visibility testing. This may generate invalid results during OPA tests.

* Because no rendering is done, the `visible` OPA5 matcher is overridden to *'simulate'* visibility testing. This may generate invalid results during OPA tests.

* 1️⃣ Because `jsdom` simulates HTML rendering inside Node.js, any exception immediately interrupts the process. This makes the usual console and network CSV writers unreliable. Instead, all the traces are sent through the standard output and the result `stdout.txt` is a mix of text and JSON output.
27 changes: 27 additions & 0 deletions jest.config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"testTimeout": 15000,
"setupFilesAfterEnv": [
"./test/setup.js"
],
"testPathIgnorePatterns": [
"/node_modules/",
"/capabilities/"
],
"collectCoverage": true,
"collectCoverageFrom": [
"src/*.js"
],
"coveragePathIgnorePatterns": [
"\\.spec\\.js",
"output\\.js",
"b\\capabilities\\b"
],
"coverageThreshold": {
"global": {
"branches": 80,
"functions": 80,
"lines": 80,
"statements": 80
}
}
}
Loading

0 comments on commit 467f62e

Please sign in to comment.