Authentification required does not appear

Hi,

I have an application to put in the background for more than 30 minutes and to bring it back to the foreground : an authenfitication request should appear (not logon page but a pop up contains username and password), but It does not.
Is it something related to appium, I mean does appium handles this?
Probably, the app (server side) sent the authentification required and appium does not unable this…
What is the answer for this issue?

Thank you in advance,
Salhi

  1. Appium has a timeout for applications. If the Appium server does not receive a command from a test client within the timeout, then Appium will request the app under test to be killed and stop the test. You have to periodically send commands to Appium through your test to reset the timeout (or increase your timeout to 30 minutes).

  2. Have you tried testing this particular case for your application manually?

1 Like

Thank you for your reply!

For the first point : I have defined a timeout like this : desiredCapabilities.setCapability(MobileCapabilityType.NEW_COMMAND_TIMEOUT, “2400000”);
is it correct?

For the second point : Yes I did and it works.

Can you post a code snippet on how you’re sending the app to the background? Can you also post your code for bringing the app back to the foreground?

When I was testing out some method calls, I found some method calls (like closeApp) will also kill the application.

 default void appBackground(Timeout timeout) {
    //        String adbExecutable = "path to adb in linux os";
    String adbExecutable = "path to adb in windows";

    FioriADBCommandExecutor.executeADBCommand(adbExecutable + " shell input keyevent 187", this);
    this.waitFor(timeout);
    FioriADBCommandExecutor.executeADBCommand(adbExecutable + " shell am start -n ..............", this);
}

the bring it to the foregroung : I just instantiated the launchpad, its like the main page of the app.

Hmm… is it possible that the am start ... call is starting a new activity rather than bringing forth a pre-existing activity? I would probably take a look at the allowed flags for launching activities. I’d probably try launching with the flag FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY.

I haven’t used adb to fire intents with flags before, but I’m guessing it’ll be something like

adb shell am start -n ... -f <integer value in decimal for the flags>

You should use a hex calculator to help you determine the decimal values you need to use for the -f argument. For example, the FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY flag might look like:

adb shell am start -n ... -f 1048576