Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Switch the implementation of backgroundApp for iOS, so it's in sync with other platforms #1229

Merged
merged 3 commits into from
Sep 7, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions src/main/java/io/appium/java_client/InteractsWithApps.java
Original file line number Diff line number Diff line change
Expand Up @@ -95,13 +95,14 @@ default void resetApp() {

/**
* Runs the current app as a background app for the time
* requested. This is a synchronous method, it returns after the back has
* been returned to the foreground.
* requested. This is a synchronous method, it blocks while the
* application is in background.
*
* @param duration The time to run App in background. Minimum time resolution is one second
* @param duration The time to run App in background. Minimum time resolution is one millisecond.
* Passing zero or a negative value will switch to Home screen and return immediately.
*/
default void runAppInBackground(Duration duration) {
execute(RUN_APP_IN_BACKGROUND, ImmutableMap.of("seconds", duration.getSeconds()));
execute(RUN_APP_IN_BACKGROUND, ImmutableMap.of("seconds", duration.toMillis() / 1000.0));
}

/**
Expand Down
15 changes: 0 additions & 15 deletions src/main/java/io/appium/java_client/ios/IOSDriver.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

package io.appium.java_client.ios;

import static io.appium.java_client.MobileCommand.RUN_APP_IN_BACKGROUND;
import static io.appium.java_client.MobileCommand.prepareArguments;
import static org.openqa.selenium.remote.DriverCommand.EXECUTE_SCRIPT;

Expand All @@ -43,7 +42,6 @@
import org.openqa.selenium.remote.http.HttpClient;

import java.net.URL;
import java.time.Duration;
import java.util.Collections;
import java.util.Map;

Expand Down Expand Up @@ -169,19 +167,6 @@ public IOSDriver(Capabilities desiredCapabilities) {
super(updateDefaultPlatformName(desiredCapabilities, IOS_DEFAULT_PLATFORM));
}

/**
* Runs the current app as a background app for the number of seconds
* or minimizes the app.
*
* @param duration The time to run App in background.
*/
@Override public void runAppInBackground(Duration duration) {
// timeout parameter is expected to be in milliseconds
// float values are allowed
execute(RUN_APP_IN_BACKGROUND,
prepareArguments("seconds", prepareArguments("timeout", duration.toMillis())));
}

@Override public TargetLocator switchTo() {
return new InnerTargetLocator();
}
Expand Down