Skip to content

Commit

Permalink
Bugfix: unlockDevice method would make the phone back to desktop (#519)
Browse files Browse the repository at this point in the history
* Bugfix: unlockDevice method would make the phone back to desktop when testing

* add some comments

* Update IOSDeviceDriver.java
  • Loading branch information
zhou9584 authored Jun 29, 2023
1 parent ec74dd3 commit 0887a69
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,9 @@ public Boolean isDriverAlive(AppiumDriver driver) {

public Boolean isDriverAlive(IOSDriver driver) {
try {
driver.unlockDevice();
// use getBatteryInfo to check if driver is alive
// getStatus would return from cache when session was closed and can't check if driver is alive
driver.getBatteryInfo();
return true;
} catch (WebDriverException e) {
return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@ public void screenCapture(@NotNull DeviceInfo deviceInfo, @NotNull String path,

@Override
public void wakeUpDevice(DeviceInfo deviceInfo, Logger logger) {
classLogger.info("Unlocking may not work as expected, please keep your device wake.");
getAppiumServerManager().getIOSDriver(deviceInfo, logger).unlockDevice();
// unlockDevice can wake up device, but sometimes it would make the phone go back to home which is not expected
classLogger.info("Nothing Implemented for iOS in " + currentMethodName());
}

@Override
Expand Down

0 comments on commit 0887a69

Please sign in to comment.