fix(ci): Android e2e flakes, shell Terminated sent before output (#3672)

* fix(ci): Android e2e flakes, shell `Terminated` sent before output

- close "isn't responding" system dialogs before each spec and hide error dialogs on the CI emulator:
  a launcher ANR dialog takes input focus from the app, and Android then denies clipboard reads
- retry switching to the webview context until it succeeds instead of running the spec in the
  native context when the first switch fails with "No such context found"
- save the focused window, a screenshot and logcat when an Android test fails
- shell: wait for the pipe readers to finish before emitting `Terminated`; the readers took their
  read lock on their own thread, so a child exiting quickly could have `close` emitted before
  its output

* Apply suggestion from @lucasfernog
This commit is contained in:
Lucas Fernandes Nogueira authored and GitHub committed 2026-10-07 13:51:35 -03:00
1 parent cbd691b651
commit 65ce65bdbb
4 files changed
+134 -51

No files matched your search

+7 -1
View File
@@ -159,7 +159,13 @@ jobs:
profile: pixel_6
emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
disable-animations: true
script: E2E_SKIP_BUILD=1 E2E_SPEC_RETRIES=1 pnpm test:api-e2e:android
# The slow emulator regularly has the launcher hit an ANR, and the "isn't responding"
# dialog takes input focus from the app under test (failing focus-gated APIs such as
# clipboard reads). With error dialogs hidden the system kills the unresponsive process
# instead; one that is already up is closed before each spec (see wdio.mobile.ts).
script: |
adb shell settings put global hide_error_dialogs 1
E2E_SKIP_BUILD=1 E2E_SPEC_RETRIES=1 pnpm test:api-e2e:android
- name: upload appium logs
if: failure()