Skip to content

Commit

Permalink
feat: make FE Test Library recognize Timeout Setting (#411)
Browse files Browse the repository at this point in the history
* feat: add timeout to testLib

* docs: add hint for session script timeout

* Update docs/configuration.md
  • Loading branch information
Siolto committed Jan 30, 2023
1 parent 333eaaa commit 9d84414
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
6 changes: 6 additions & 0 deletions client-side-js/testLibrary.js
Expand Up @@ -10,7 +10,13 @@ async function initOPA(pageObjectConfig, browserInstance) {
pageConfig[pageKey] = new window.fe_bridge[className](options)
})
})

sap.ui.test.Opa5.createPageObjects(pageConfig)
// use the same timouts and intervals that wdi5 uses
sap.ui.test.Opa.extendConfig({
timeout: new Date(window.wdi5.waitForUI5Options.timeout).getSeconds(), // convert milliseconds to seconds
pollingInterval: window.wdi5.waitForUI5Options.interval
})

// mock the generic OK handler in order to support assertions
sap.ui.test.Opa5.assert = {
Expand Down
10 changes: 6 additions & 4 deletions docs/configuration.md
Expand Up @@ -4,7 +4,7 @@

## `wdi5`

All options go into a top-level `wdi5` object in `wdio.conf.(j|t)s`,
All options go into a top-level `wdi5` object in `wdio.conf.(j|t)s`,
with the exception of the `baseUrl` pointing to the `index.html` of your UI5 app.

?> Do not account for redirects etc. (think application router), `wdi5` wants to be pointed directly to where UI5 is being bootstrapped.
Expand All @@ -29,7 +29,7 @@ exports.config = {

### `screenshotPath`

A string pointing to a directory, relative to the location of the `wdio.conf.(j|t)s` configuration file.
A string pointing to a directory, relative to the location of the `wdio.conf.(j|t)s` configuration file.
In case your UI5 app lives in `/app` with a files system structure similar to ...

```shell
Expand All @@ -54,8 +54,8 @@ Boolean (default: `false`) to turn screenshotting on or off, e.g. in a local dev

### `logLevel`

Any of `"verbose"`, `"error"` or `"silent"`. Default: `verbose`.
`wdi5` comes with its own minimal console-logger. It helps in monitoring what the "ui5" service is currently executing in the WebdriverIO context.
Any of `"verbose"`, `"error"` or `"silent"`. Default: `verbose`.
`wdi5` comes with its own minimal console-logger. It helps in monitoring what the "ui5" service is currently executing in the WebdriverIO context.
Additionally, it can be used in tests via a static `getter` on the `wdi5`-object provided by `wdio-ui5-service`:

```javascript
Expand Down Expand Up @@ -119,6 +119,8 @@ See <https://github.com/ui5-community/wdi5/tree/main/examples/ui5-js-app/webapp/

Number in milliseconds (default: `15000`) to wait for UI5-related operations within a UI5 app. This is the equivalent to OPA5's [`waitFor()` option `timeout`](https://ui5.sap.com/sdk/#/api/sap.ui.test.Opa5/methods/waitFor).

?> Setting this timeout to 30 seconds or higher requires the [session script timeout](https://webdriver.io/docs/timeouts/#session-script-timeout) to be increased as well.

## `package.json`

Not required, but as a convention, put a `test` or `wdi5` script into your UI5.app's `package.json` to start `wdi5/wdio`.
Expand Down
2 changes: 1 addition & 1 deletion docs/recipes.md
Expand Up @@ -267,7 +267,7 @@ The `interaction` can be any one of: `root`, `focus`, `press`, `auto` (default),

Located element for each case:

- **`root`**: the root DOM element of the control.
- **`root`**: the root DOM element of the control.
Use this with many controls having an `items` aggregation (such as `sap.m.List`) in order to select the List itself, not the first element of the control.
See the `listSelector` in `examples/ui5-js-app/webapp/test/e2e/generated-methods.test.js` for an example:

Expand Down

0 comments on commit 9d84414

Please sign in to comment.