Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BTP IdP Authentication not detecting two-step sequence #647

Open
gssales opened this issue Oct 25, 2024 · 2 comments
Open

BTP IdP Authentication not detecting two-step sequence #647

gssales opened this issue Oct 25, 2024 · 2 comments
Labels

Comments

@gssales
Copy link

gssales commented Oct 25, 2024

Describe the bug
I have enabled the default BTP IdP authentication in WDI5, but when the tests runs the authentication fail because it can't find the #j_password element.

Expected behavior
The authentication should be in a two-step sequence, when in the first step the test can only find the #j_username field, it should fill it and proceed to the second step, with the #j_password field.

Logs/Console Output

[2024-10-25T19:56:45.748Z] info  npmExecuteScripts - run-script wdi5
[2024-10-25T19:56:45.748Z] info  npmExecuteScripts - running command: npm run wdi5 -- --headless --auth
[2024-10-25T19:56:46.008Z] info  npmExecuteScripts - 
[2024-10-25T19:56:46.008Z] info  npmExecuteScripts - > [email protected] wdi5
[2024-10-25T19:56:46.008Z] info  npmExecuteScripts - > rimraf allure-results && wdio run ./webapp/test/e2e/wdio.conf.ts --headless --auth
[2024-10-25T19:56:46.009Z] info  npmExecuteScripts - 
[2024-10-25T19:56:52.583Z] info  npmExecuteScripts - 
[2024-10-25T19:56:52.583Z] info  npmExecuteScripts - Execution of 1 workers started at 2024-10-25T19:56:51.977Z
[2024-10-25T19:56:52.583Z] info  npmExecuteScripts - 
[2024-10-25T19:56:59.161Z] info  npmExecuteScripts - [0-0] RUNNING in chrome - file:///webapp/test/e2e/sample.test.ts
[2024-10-25T19:57:14.048Z] error npmExecuteScripts - [0-0] 2024-10-25T19:57:12.618Z ERROR @wdio/utils:shim: Error: Can't call setValue on element with selector "#j_password" because element wasn't found
[2024-10-25T19:57:14.048Z] info  npmExecuteScripts - [0-0]     at implicitWait (file:///home/jenkins/agent/workspace/_hcc-monitor-ui_ci_release-stage/node_modules/webdriverio/build/utils/implicitWait.js:29:19)
[2024-10-25T19:57:14.049Z] info  npmExecuteScripts - [0-0]     at async Element.elementErrorHandlerCallbackFn (file:///home/jenkins/agent/workspace/_hcc-monitor-ui_ci_release-stage/node_modules/webdriverio/build/middlewares.js:15:29)
[2024-10-25T19:57:14.049Z] info  npmExecuteScripts - [0-0]     at async Element.wrapCommandFn (file:///home/jenkins/agent/workspace/_hcc-monitor-ui_ci_release-stage/node_modules/@wdio/utils/build/shim.js:90:29)
[2024-10-25T19:57:14.049Z] info  npmExecuteScripts - [0-0]     at async BTPAuthenticator.login (file:///home/jenkins/agent/workspace/_hcc-monitor-ui_ci_release-stage/node_modules/wdio-ui5-service/src/lib/authentication/BTPAuthenticator.ts:48:17)
[2024-10-25T19:57:14.049Z] info  npmExecuteScripts - [0-0]     at async authenticate (file:///home/jenkins/agent/workspace/_hcc-monitor-ui_ci_release-stage/node_modules/wdio-ui5-service/src/lib/wdi5-bridge.ts:180:13)
[2024-10-25T19:57:14.049Z] info  npmExecuteScripts - [0-0]     at async Service.before (file:///home/jenkins/agent/workspace/_hcc-monitor-ui_ci_release-stage/node_modules/wdio-ui5-service/src/service.ts:47:17)
[2024-10-25T19:57:14.049Z] info  npmExecuteScripts - [0-0]     at async Promise.all (index 0)
[2024-10-25T19:57:14.049Z] info  npmExecuteScripts - [0-0]     at async executeHooksWithArgs (file:///home/jenkins/agent/workspace/_hcc-monitor-ui_ci_release-stage/node_modules/@wdio/utils/build/shim.js:68:20)
[2024-10-25T19:57:14.049Z] info  npmExecuteScripts - [0-0]     at async Runner.run (file:///home/jenkins/agent/workspace/_hcc-monitor-ui_ci_release-stage/node_modules/@wdio/runner/build/index.js:99:9)
[2024-10-25T19:57:14.049Z] info  npmExecuteScripts - [0-0] �[0m[wdi5]�[0m hello world!
[2024-10-25T19:57:14.309Z] error npmExecuteScripts - [0-0] 2024-10-25T19:57:14.180Z ERROR webdriver: Request failed with status 500 due to javascript error: javascript error: Cannot read properties of undefined (reading 'waitForUI5Options')
[2024-10-25T19:57:14.309Z] info  npmExecuteScripts - [0-0] JavaScript stack:
[2024-10-25T19:57:14.309Z] info  npmExecuteScripts - [0-0] TypeError: Cannot read properties of undefined (reading 'waitForUI5Options')
[2024-10-25T19:57:14.309Z] info  npmExecuteScripts - [0-0]     at eval (eval at <anonymous> (:437:26), <anonymous>:4:65)
[2024-10-25T19:57:14.309Z] info  npmExecuteScripts - [0-0]     at eval (eval at <anonymous> (:437:26), <anonymous>:33:8)
[2024-10-25T19:57:14.309Z] info  npmExecuteScripts - [0-0]     at eval (eval at <anonymous> (:437:26), <anonymous>:33:33)
[2024-10-25T19:57:14.309Z] info  npmExecuteScripts - [0-0]     at <anonymous>:437:47
[2024-10-25T19:57:14.309Z] info  npmExecuteScripts - [0-0]     at new Promise (<anonymous>)
[2024-10-25T19:57:14.309Z] info  npmExecuteScripts - [0-0]     at executeAsyncScript (<anonymous>:431:17)
[2024-10-25T19:57:14.309Z] info  npmExecuteScripts - [0-0]     at apply.selector.controlType (<anonymous>:461:29)
[2024-10-25T19:57:14.309Z] info  npmExecuteScripts - [0-0]     at callFunction (<anonymous>:366:22)
[2024-10-25T19:57:14.309Z] info  npmExecuteScripts - [0-0]     at <anonymous>:380:23
[2024-10-25T19:57:14.309Z] info  npmExecuteScripts - [0-0]     at <anonymous>:381:3
[2024-10-25T19:57:14.309Z] info  npmExecuteScripts - [0-0]   (Session info: chrome=129.0.6668.100)
[2024-10-25T19:57:14.309Z] info  npmExecuteScripts - [0-0] javascript error in "samples.should retrieve a UI5 control"
[2024-10-25T19:57:14.309Z] info  npmExecuteScripts - javascript error: javascript error: Cannot read properties of undefined (reading 'waitForUI5Options')
[2024-10-25T19:57:14.309Z] info  npmExecuteScripts - JavaScript stack:
[2024-10-25T19:57:14.309Z] info  npmExecuteScripts - TypeError: Cannot read properties of undefined (reading 'waitForUI5Options')
[2024-10-25T19:57:14.309Z] info  npmExecuteScripts -     at eval (eval at <anonymous> (:437:26), <anonymous>:4:65)
[2024-10-25T19:57:14.309Z] info  npmExecuteScripts -     at eval (eval at <anonymous> (:437:26), <anonymous>:33:8)
[2024-10-25T19:57:14.310Z] info  npmExecuteScripts -     at eval (eval at <anonymous> (:437:26), <anonymous>:33:33)
[2024-10-25T19:57:14.310Z] info  npmExecuteScripts -     at <anonymous>:437:47
[2024-10-25T19:57:14.310Z] info  npmExecuteScripts -     at new Promise (<anonymous>)
[2024-10-25T19:57:14.310Z] info  npmExecuteScripts -     at executeAsyncScript (<anonymous>:431:17)
[2024-10-25T19:57:14.310Z] info  npmExecuteScripts -     at apply.selector.controlType (<anonymous>:461:29)
[2024-10-25T19:57:14.310Z] info  npmExecuteScripts -     at callFunction (<anonymous>:366:22)
[2024-10-25T19:57:14.310Z] info  npmExecuteScripts -     at <anonymous>:380:23
[2024-10-25T19:57:14.310Z] info  npmExecuteScripts -     at <anonymous>:381:3
[2024-10-25T19:57:14.310Z] info  npmExecuteScripts -   (Session info: chrome=129.0.6668.100)
[2024-10-25T19:57:14.310Z] info  npmExecuteScripts -     at async clientSide_getControl (/home/jenkins/agent/workspace/_hcc-monitor-ui_ci_release-stage/node_modules/wdio-ui5-service/client-side-js/getControl.cjs:3:12)
[2024-10-25T19:57:14.310Z] info  npmExecuteScripts -     at async WDI5Control._getControl (file:///home/jenkins/agent/workspace/_hcc-monitor-ui_ci_release-stage/node_modules/wdio-ui5-service/src/lib/wdi5-control.ts:668:26)
[2024-10-25T19:57:14.310Z] info  npmExecuteScripts -     at async WDI5Control.init (file:///home/jenkins/agent/workspace/_hcc-monitor-ui_ci_release-stage/node_modules/wdio-ui5-service/src/lib/wdi5-control.ts:78:31)
[2024-10-25T19:57:14.310Z] info  npmExecuteScripts -     at async Browser.<anonymous> (file:///home/jenkins/agent/workspace/_hcc-monitor-ui_ci_release-stage/node_modules/wdio-ui5-service/src/lib/wdi5-bridge.ts:263:33)
[2024-10-25T19:57:14.573Z] info  npmExecuteScripts - [0-0] FAILED in chrome - file:///webapp/test/e2e/sample.test.ts
[2024-10-25T19:57:14.573Z] info  npmExecuteScripts - 
[2024-10-25T19:57:14.573Z] info  npmExecuteScripts -  "spec" Reporter:
[2024-10-25T19:57:14.573Z] info  npmExecuteScripts - ------------------------------------------------------------------
[2024-10-25T19:57:14.573Z] info  npmExecuteScripts - [chrome 129.0.6668.100 linux #0-0] Running: chrome (v129.0.6668.100) on linux
[2024-10-25T19:57:14.573Z] info  npmExecuteScripts - [chrome 129.0.6668.100 linux #0-0] Session ID: b64f4d6cffd3a9cd6531c31d0f9243be
[2024-10-25T19:57:14.573Z] info  npmExecuteScripts - [chrome 129.0.6668.100 linux #0-0]
[2024-10-25T19:57:14.573Z] info  npmExecuteScripts - [chrome 129.0.6668.100 linux #0-0] » /webapp/test/e2e/sample.test.ts
[2024-10-25T19:57:14.573Z] info  npmExecuteScripts - [chrome 129.0.6668.100 linux #0-0] samples
[2024-10-25T19:57:14.573Z] info  npmExecuteScripts - [chrome 129.0.6668.100 linux #0-0]    ✓ should log
[2024-10-25T19:57:14.573Z] info  npmExecuteScripts - [chrome 129.0.6668.100 linux #0-0]    ✖ should retrieve a UI5 control
[2024-10-25T19:57:14.573Z] info  npmExecuteScripts - [chrome 129.0.6668.100 linux #0-0]
[2024-10-25T19:57:14.573Z] info  npmExecuteScripts - [chrome 129.0.6668.100 linux #0-0] 1 passing (1.7s)
[2024-10-25T19:57:14.573Z] info  npmExecuteScripts - [chrome 129.0.6668.100 linux #0-0] 1 failing
[2024-10-25T19:57:14.573Z] info  npmExecuteScripts - [chrome 129.0.6668.100 linux #0-0]
[2024-10-25T19:57:14.573Z] info  npmExecuteScripts - [chrome 129.0.6668.100 linux #0-0] 1) samples should retrieve a UI5 control
[2024-10-25T19:57:14.574Z] info  npmExecuteScripts - [chrome 129.0.6668.100 linux #0-0] javascript error: Cannot read properties of undefined (reading 'waitForUI5Options')
[2024-10-25T19:57:14.574Z] info  npmExecuteScripts - JavaScript stack:
[2024-10-25T19:57:14.574Z] info  npmExecuteScripts - TypeError: Cannot read properties of undefined (reading 'waitForUI5Options')
[2024-10-25T19:57:14.574Z] info  npmExecuteScripts -     at eval (eval at <anonymous> (:437:26), <anonymous>:4:65)
[2024-10-25T19:57:14.574Z] info  npmExecuteScripts -     at eval (eval at <anonymous> (:437:26), <anonymous>:33:8)
[2024-10-25T19:57:14.574Z] info  npmExecuteScripts -     at eval (eval at <anonymous> (:437:26), <anonymous>:33:33)
[2024-10-25T19:57:14.574Z] info  npmExecuteScripts -     at <anonymous>:437:47
[2024-10-25T19:57:14.574Z] info  npmExecuteScripts -     at new Promise (<anonymous>)
[2024-10-25T19:57:14.574Z] info  npmExecuteScripts -     at executeAsyncScript (<anonymous>:431:17)
[2024-10-25T19:57:14.574Z] info  npmExecuteScripts -     at apply.selector.controlType (<anonymous>:461:29)
[2024-10-25T19:57:14.574Z] info  npmExecuteScripts -     at callFunction (<anonymous>:366:22)
[2024-10-25T19:57:14.574Z] info  npmExecuteScripts -     at <anonymous>:380:23
[2024-10-25T19:57:14.574Z] info  npmExecuteScripts -     at <anonymous>:381:3
[2024-10-25T19:57:14.574Z] info  npmExecuteScripts -   (Session info: chrome=129.0.6668.100)
[2024-10-25T19:57:14.574Z] info  npmExecuteScripts - [chrome 129.0.6668.100 linux #0-0] javascript error: javascript error: Cannot read properties of undefined (reading 'waitForUI5Options')
[2024-10-25T19:57:14.574Z] info  npmExecuteScripts - [chrome 129.0.6668.100 linux #0-0] JavaScript stack:
[2024-10-25T19:57:14.574Z] info  npmExecuteScripts - [chrome 129.0.6668.100 linux #0-0] TypeError: Cannot read properties of undefined (reading 'waitForUI5Options')
[2024-10-25T19:57:14.574Z] info  npmExecuteScripts - [chrome 129.0.6668.100 linux #0-0]     at eval (eval at <anonymous> (:437:26), <anonymous>:4:65)
[2024-10-25T19:57:14.574Z] info  npmExecuteScripts - [chrome 129.0.6668.100 linux #0-0]     at eval (eval at <anonymous> (:437:26), <anonymous>:33:8)
[2024-10-25T19:57:14.574Z] info  npmExecuteScripts - [chrome 129.0.6668.100 linux #0-0]     at eval (eval at <anonymous> (:437:26), <anonymous>:33:33)
[2024-10-25T19:57:14.574Z] info  npmExecuteScripts - [chrome 129.0.6668.100 linux #0-0]     at <anonymous>:437:47
[2024-10-25T19:57:14.574Z] info  npmExecuteScripts - [chrome 129.0.6668.100 linux #0-0]     at new Promise (<anonymous>)
[2024-10-25T19:57:14.574Z] info  npmExecuteScripts - [chrome 129.0.6668.100 linux #0-0]     at executeAsyncScript (<anonymous>:431:17)
[2024-10-25T19:57:14.574Z] info  npmExecuteScripts - [chrome 129.0.6668.100 linux #0-0]     at apply.selector.controlType (<anonymous>:461:29)
[2024-10-25T19:57:14.575Z] info  npmExecuteScripts - [chrome 129.0.6668.100 linux #0-0]     at callFunction (<anonymous>:366:22)
[2024-10-25T19:57:14.575Z] info  npmExecuteScripts - [chrome 129.0.6668.100 linux #0-0]     at <anonymous>:380:23
[2024-10-25T19:57:14.575Z] info  npmExecuteScripts - [chrome 129.0.6668.100 linux #0-0]     at <anonymous>:381:3
[2024-10-25T19:57:14.575Z] info  npmExecuteScripts - [chrome 129.0.6668.100 linux #0-0]   (Session info: chrome=129.0.6668.100)
[2024-10-25T19:57:14.575Z] info  npmExecuteScripts - [chrome 129.0.6668.100 linux #0-0]     at async clientSide_getControl (/home/jenkins/agent/workspace/_hcc-monitor-ui_ci_release-stage/node_modules/wdio-ui5-service/client-side-js/getControl.cjs:3:12)
[2024-10-25T19:57:14.575Z] info  npmExecuteScripts - [chrome 129.0.6668.100 linux #0-0]     at async WDI5Control._getControl (file:///home/jenkins/agent/workspace/_hcc-monitor-ui_ci_release-stage/node_modules/wdio-ui5-service/src/lib/wdi5-control.ts:668:26)
[2024-10-25T19:57:14.575Z] info  npmExecuteScripts - [chrome 129.0.6668.100 linux #0-0]     at async WDI5Control.init (file:///home/jenkins/agent/workspace/_hcc-monitor-ui_ci_release-stage/node_modules/wdio-ui5-service/src/lib/wdi5-control.ts:78:31)
[2024-10-25T19:57:14.575Z] info  npmExecuteScripts - [chrome 129.0.6668.100 linux #0-0]     at async Browser.<anonymous> (file:///home/jenkins/agent/workspace/_hcc-monitor-ui_ci_release-stage/node_modules/wdio-ui5-service/src/lib/wdi5-bridge.ts:263:33)
[2024-10-25T19:57:14.575Z] info  npmExecuteScripts - 
[2024-10-25T19:57:14.575Z] info  npmExecuteScripts - 
[2024-10-25T19:57:14.575Z] info  npmExecuteScripts - Spec Files:	 0 passed, 1 failed, 1 total (100% completed) in 00:00:22  
[2024-10-25T19:57:14.575Z] info  npmExecuteScripts - 

Screenshots

Image

Runtime Env (please complete the following information):

  • wdi5/wdio-ui5-service-version: 2.0.10
  • UI5 version: v1.129.0
  • wdio-version: v8.40.5
  • node-version: v18.20.4
  • OS: [e.g. Linux openSuSE]
  • chrome 129.0.6668.100

Additional context

I am running these tests on a jenkins pipeline, extending the Acceptance Stage from project piper:

Acceptance.groovy

void call(Map params) {

  echo "Before Acceptance Stage"
	
  withCredentials([
    usernamePassword(
      credentialsId: 'btp-cf-credentials', 
      usernameVariable: 'wdi5_username', 
      passwordVariable: 'wdi5_password')]) 
  {
    params.originalStage()
  }
}
return this

Partial config.yml

# ...
stages:
  Central Build:
    hadolintExecute: false
  Acceptance:
    cloudFoundryDeploy: true
    npmExecuteScripts: true
    healthExecuteCheck: false
  Post:
    sapReportPipelineStatus: true
steps:

  cloudFoundryDeploy:
    apiEndpoint: "****"
    org: "******"
    space: "****"
    cfCredentialsId: "btp-cf-credentials"
    mtaPath: "archive.mtar"
    mtaDeployParameters: "-f --version-rule ALL"

  npmExecuteScripts:
    dockerImage:  ppiper/node-browsers:18-bookworm
    runScripts:
      - wdi5
    scriptOptions:
      - --headless
      - --auth

  mtaBuild:
    mtaBuildTool: cloudMbt
    mtarGroup: 'com.sap.hyperspace'
    dockerImage: devxci/mbtci-java17-node20

  executeBuild:
    buildType: stage

# ...
@vobu
Copy link
Contributor

vobu commented Oct 26, 2024

before looking into this more, let me just kudo you for running wdi5 from Groovy. That's a first :)

Copy link

hey 👋 - silence for 30 days 🤐 ... anybody? 😀

@github-actions github-actions bot added the stale label Nov 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants