wdi5 icon indicating copy to clipboard operation
wdi5 copied to clipboard

examples/ui5-js-app does not work out of the box

Open mats-stijlaart opened this issue 1 year ago • 1 comments

Describe the bug

Running the example setup in examples/ui5-js-app does not work out of the box. There exists a multiple issues in this setup

To Reproduce

Steps to reproduce the behavior:

  1. Clone the repository
  2. cd into <repo>/examples/ui5-js-app
  3. Run npm install
  4. Run npm run start
  5. Run npm run test in another console

Not all tests succeed

Expected behavior

All tests succeed

Logs/Console Output

Issue 1

When running step 3 the console outputs:

soerver: command not found

This is due to the fact that soerver is not listed in the devDependencies. The following script could fix this:

npm install --save-dev soerver

Expectation: soerver is listed in the devDependencies.

Issue 2 (after patching solution for issue 2)

When running step 4 the console outputs:

sh: run-s: command not found

This is due to the fact that npm-run-all is not listed in the devDependencies. The following script could fix this:

npm install --save-dev npm-run-all

Expectation: npm-run-all is listed in the devDependencies.

Issue 3 (after patching solution for issue 2)

Script for test:ui5tooling fails due to wrong url.

wdio-ui5tooling.conf.js uses port 8080 in its config. Other WDIO configs seem to point to port 8888 (on which the application is running from npm run start).

Related logs:

[0-0] RUNNING in chrome - /webapp/test/e2e/basic.test.js
[0-1] 2022-08-19T08:45:09.992Z ERROR webdriver: Request failed with status 500 due to unknown error: unknown error: net::ERR_CONNECTION_REFUSED
[0-1]   (Session info: chrome=104.0.5112.101)
[0-1] 2022-08-19T08:45:09.993Z ERROR @wdio/utils:shim: unknown error: unknown error: net::ERR_CONNECTION_REFUSED
[0-1]   (Session info: chrome=104.0.5112.101)
[0-1]     at getErrorFromResponseBody (/Users/matstijl/development/repositories/github/ui5-community/wdi5/examples/ui5-js-app/node_modules/webdriver/build/utils.js:198:12)
[0-1]     at NodeJSRequest._request (/Users/matstijl/development/repositories/github/ui5-community/wdi5/examples/ui5-js-app/node_modules/webdriver/build/request/index.js:166:60)
[0-1]     at processTicksAndRejections (node:internal/process/task_queues:96:5)
[0-1]     at async Browser.wrapCommandFn (/Users/matstijl/development/repositories/github/ui5-community/wdi5/examples/ui5-js-app/node_modules/@wdio/utils/build/shim.js:137:29)
[0-1]     at async Browser.wrapCommandFn (/Users/matstijl/development/repositories/github/ui5-community/wdi5/examples/ui5-js-app/node_modules/@wdio/utils/build/shim.js:137:29)
[0-1] [wdi5] deprecated signature: please use single parameter as nav target: wdi5.goTo(target)
[0-1] [wdi5] Navigating via UI5 router object: {"sComponentId":"container-Sample","sName":"RouteOther"}
[0-1] TypeError in "hash-based nav.should still nav correctly w/ deprecated goTo() signature"
TypeError: browserInstance.goTo is not a function
    at Function.<anonymous> (/Users/matstijl/development/repositories/github/ui5-community/wdi5/examples/ui5-js-app/node_modules/wdio-ui5-service/dist/wdi5.js:74:62)
    at step (/Users/matstijl/development/repositories/github/ui5-community/wdi5/examples/ui5-js-app/node_modules/wdio-ui5-service/dist/wdi5.js:33:23)
    at Object.next (/Users/matstijl/development/repositories/github/ui5-community/wdi5/examples/ui5-js-app/node_modules/wdio-ui5-service/dist/wdi5.js:14:53)
    at /Users/matstijl/development/repositories/github/ui5-community/wdi5/examples/ui5-js-app/node_modules/wdio-ui5-service/dist/wdi5.js:8:71
    at new Promise (<anonymous>)
    at __awaiter (/Users/matstijl/development/repositories/github/ui5-community/wdi5/examples/ui5-js-app/node_modules/wdio-ui5-service/dist/wdi5.js:4:12)
    at Function.wdi5.goTo (/Users/matstijl/development/repositories/github/ui5-community/wdi5/examples/ui5-js-app/node_modules/wdio-ui5-service/dist/wdi5.js:50:16)
    at Context.<anonymous> (/Users/matstijl/development/repositories/github/ui5-community/wdi5/examples/ui5-js-app/webapp/test/e2e/hash-nav.test.js:16:20)

Expectation the port is changed from 8080 into 8888.

Issue 4 (after patching solution for issue 3)

Tests fail with the following output:

[0-0] 2022-08-19T08:47:17.649Z ERROR webdriver: Request failed with status 500 due to javascript error: javascript error: Cannot read properties of undefined (reading 'waitForUI5Options')
[0-0] JavaScript stack:
[0-0] TypeError: Cannot read properties of undefined (reading 'waitForUI5Options')
[0-0]     at eval (eval at executeAsyncScript (:552:26), <anonymous>:4:65)
[0-0]     at eval (eval at executeAsyncScript (:552:26), <anonymous>:33:8)
[0-0]     at eval (eval at executeAsyncScript (:552:26), <anonymous>:33:33)
[0-0]     at executeAsyncScript (<anonymous>:552:47)
[0-0]     at apply.forceSelect (<anonymous>:567:29)
[0-0]     at callFunction (<anonymous>:446:22)
[0-0]     at <anonymous>:460:23
[0-0]     at <anonymous>:461:3
[0-0]   (Session info: chrome=104.0.5112.101)
[0-0] javascript error in "ui5 basic.method chaining without fluent api"
javascript error: javascript error: Cannot read properties of undefined (reading 'waitForUI5Options')
JavaScript stack:
TypeError: Cannot read properties of undefined (reading 'waitForUI5Options')
    at eval (eval at executeAsyncScript (:552:26), <anonymous>:4:65)
    at eval (eval at executeAsyncScript (:552:26), <anonymous>:33:8)
    at eval (eval at executeAsyncScript (:552:26), <anonymous>:33:33)
    at executeAsyncScript (<anonymous>:552:47)
    at apply.forceSelect (<anonymous>:567:29)
    at callFunction (<anonymous>:446:22)
    at <anonymous>:460:23
    at <anonymous>:461:3
  (Session info: chrome=104.0.5112.101)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async clientSide_getControl (/Users/matstijl/development/repositories/github/ui5-community/wdi5/examples/ui5-js-app/node_modules/wdio-ui5-service/client-side-js/getControl.js:3:12)
[0-0] FAILED in chrome - /webapp/test/e2e/basic.test.js

Screenshots if applicable, add screenshots to help explain your problem.

Runtime Env (please complete the following information):

  • wdi5/wdio-ui5-service-version: 0.9.10
  • UI5 version: unknown (not listed in dependencies)
  • wdio-version (output of wdio --version): 7.21.0
  • node-version (output of node --version): v16.16.0
  • OS: Mac OSX
  • Browser + Version [e.g. chrome 104.0.5112.101]

Additional context n/a

mats-stijlaart avatar Aug 19 '22 08:08 mats-stijlaart

Hi, thanks for checking in these many details and context 👍 We're using npm's workspaces feature (npm>=7) which installs all dependencies for all workspaces upon npm i on the root level → https://ui5-community.github.io/wdi5/#/contributing?id=prerequisites After doing that, all examples should work ootb, e.g.

(in terminal 1)

# start the sample js app
$> npm run _startApp:js

(in terminal 2)

$> npm run test:webserver -w examples/ui5-js-app

see also https://ui5-community.github.io/wdi5/#/contributing?id=work-on-a-test

hth, v.

vobu avatar Aug 24 '22 12:08 vobu