You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
With latest api (31-33…) tests are much more flaky.
I wanted to share the way I get around this. Maybe this could be added to your script.
The idea is to close any anr that may appear on screen and also to wait until device is idle. This is detected by checking cpu usage. When below 0.9 (chosen arbitrarily), we consider it is idle
Below my script in ruby and uses fastlane's functions
desc"Wait until device is considered idle"lane:wait_for_idledostart_time=Time.nowload_threshold=0.9puts"Start waiting until device is idle (" + Time.now.to_s + ")"command='shell uptime | cut -d , -f 3 | cut -f 2 -d :'load=retry_adb_command(command).strip.to_fend_time=start_time + 1800whileload > load_threshold && Time.now < end_timedoifload < 4adb(command: 'shell dumpsys window | grep -E "mCurrentFocus.*Application Not Responding" || echo ')anr_package=adb(command: 'shell dumpsys window | grep -E "mCurrentFocus.*Application Not Responding" | cut -f 2 -d : | sed -e "s/}//" -e "s/^ *//" ').stripifanr_package != ""puts"ANR on screen for: " + anr_package + ". Restarting it."# Some suggest that restarting the service with 'am startservice' should restart it,# but it doesn't seem to work. So using killall.# We additionally restart it, but with killall, system UI is restarted automaticallybegin# Killingadb(command: 'shell su 0 killall ' + anr_package)rescue=>exUI.error(ex)# Fallback to click if kill didn't work. This location is for a 1080x1920 screenadb(command: 'shell input tap 540 935 || echo')end# Starting Serviceifanr_package == "com.android.systemui"adb(command: 'shell am start-service -n com.android.systemui/.SystemUIService || echo')end#cmd = 'shell pm dump ' + anr_package + ' | grep Services: -A1 | tail -n 1 | sed -e "s/.*{.* .* \(.*\)}.*/\1/"'#anr_package_service1 = adb(command: cmd).strip#adb(command: 'shell am start-service -a ' + anr_package_service1 + ' || echo')endendsleep15load=retry_adb_command(command).strip.to_fendifload > load_thresholdputs"Reached timeout before device is idle."endputs"Waited until device is idle for " + (Time.now - start_time).to_i.to_s + " seconds."end
The text was updated successfully, but these errors were encountered:
With latest api (31-33…) tests are much more flaky.
I wanted to share the way I get around this. Maybe this could be added to your script.
The idea is to close any anr that may appear on screen and also to wait until device is idle. This is detected by checking cpu usage. When below 0.9 (chosen arbitrarily), we consider it is idle
Below my script in ruby and uses fastlane's functions
The text was updated successfully, but these errors were encountered: