mcdcorp / opentest

Open source test automation tool for web applications, mobile apps and APIs
https://getopentest.org
MIT License
446 stars 107 forks source link

Implicit wait not working till the app loads when running from circleCI pipeline #603

Open chaitrashekar21 opened 1 year ago

chaitrashekar21 commented 1 year ago

I am trying to run automated tests on android in circleCI. Looking at the logs and screenshots, looks like the app hasn't completely loaded by then the script starts executing. Its looking for login screen while its still in the splash screen. I added newCommandTimeout: 1000 , implicitlyWait: 300 to desired capabilities. But looking at the log it is completely ignoring the wait. Looking for ways to add implicit wait. `appium: [HTTP] <-- GET /wd/hub/session/6649333d-c650-45c7-b4d0-59b906e4627a 200 13 ms - 1155

appium: [HTTP]

appium: [HTTP] --> POST /wd/hub/session/6649333d-c650-45c7-b4d0-59b906e4627a/timeouts

appium: [HTTP] {"implicit":0}

appium: [debug] [W3C (6649333d)] Calling AppiumDriver.timeouts() with args: [null,null,null,null,0,"6649333d-c650-45c7-b4d0-59b906e4627a"]

appium: [debug] [BaseDriver] W3C timeout argument: {"implicit":0}}

appium: [debug] [BaseDriver] Set implicit wait to 0ms

appium: [debug] [W3C (6649333d)] Responding to client with driver.timeouts() result: null

appium: [HTTP] <-- POST /wd/hub/session/6649333d-c650-45c7-b4d0-59b906e4627a/timeouts 200 6 ms - 14 [HTTP] `

adrianth commented 1 year ago

It might be that the time it takes for the app to load is longer than the default wait time OpenTest uses when searching for UI elements. You could try to use the explicitWaitSec argument for the very first test action that operates with the login screen. For example:

- description: Look for login screen
  action: org.getopentest.appium.AssertElementVisible
  args:
    locator: { id: login }
    explicitWaitSec: 30

The explicitWaitSec argument is available in all test actions that interact with UI elements and it specifies the maximum time the test action will wait for the UI element to become available (the default is 10 seconds).

chaitrashekar21 commented 1 year ago

Thank you. But unfortunately it didnt work