patrol icon indicating copy to clipboard operation
patrol copied to clipboard

Can't reopen the app after run the app in the background in the BrowserStack using Patrol pressHome function

Open AntoniKwok opened this issue 10 months ago • 8 comments

Hi Patrol Team, when I use pressHome() function from native interaction, the test will be stopped once I reopen the test (the previous will be stopped and it will rerun the same test case again)

AntoniKwok avatar Feb 12 '25 07:02 AntoniKwok

Hi, on iOS automation is blocked after moving app to background (probably because of security reasons). Regarding Android, could you try to create a test file with steps similar to snippet below?

await $.pumpWidget(yourApp);

await $.native.pressHome();
await $.native.openApp();

await Future<void>.delayed(const Duration(seconds: 5));
await $(someWidget).waitUntilVisible();

fylyppo avatar Feb 12 '25 16:02 fylyppo

Hi @fylyppo , does this mean we can't simulate run app in the background on iOS in BrowserStack?

AntoniKwok avatar Feb 13 '25 00:02 AntoniKwok

@AntoniKwok it's possible to move app to background for IIRC max 2 seconds, within this time you need to move app again to foreground so as to be not blocked by BS

fylyppo avatar Feb 13 '25 12:02 fylyppo

@AntoniKwok , take a look at this case: #2382

valtbarbos avatar Feb 13 '25 12:02 valtbarbos

@valtbarbos , I can't open the issue

AntoniKwok avatar Feb 13 '25 15:02 AntoniKwok

I just use this methods

await $.native.pressHome(); await $.native.openApp();

but it's not working on iOS

AntoniKwok avatar Feb 13 '25 15:02 AntoniKwok

@AntoniKwok is there any exception thrown or patrol says that steps are completed but nothing is visible on the screen? Could you provide your device logs here and device and OS combination?

fylyppo avatar Feb 16 '25 11:02 fylyppo

FYI @fylyppo IDK how it goes in BS (tests running on Android emulator?) - but in my case I faced "test stuck" on Android emulator during native actions (pressHome, openApp) as on our GitLab runner (own MacMini) and locally (I'm using Mac). Seems like the root cause is the latest emulator version Android Emulator (35.3.12) Stable. So I switched back to Android Emulator (35.3.11) Stable - no such problems so far.

ivan-horchakov avatar Mar 05 '25 15:03 ivan-horchakov