-
-
Notifications
You must be signed in to change notification settings - Fork 755
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
Added Android device commands #518
Changes from 24 commits
b6aa487
d76bad8
1909222
b5bc4e6
ffbb4de
4ea6635
34a718b
e890280
4b87991
f799d34
f07ac6e
980b6a1
d832a19
f8ad455
2ba3652
5b9a7c0
f9a928e
da9064b
9ae8606
d42df2b
b63df4b
db74f17
b2b5c14
a3fdeda
20ba018
358bdce
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package io.appium.java_client; | ||
|
||
import static io.appium.java_client.MobileCommand.GET_DISPLAY_DENSITY; | ||
import static io.appium.java_client.MobileCommand.GET_SYSTEM_BARS; | ||
|
||
import java.util.Map; | ||
|
||
public interface HasDeviceDetails extends ExecutesMethod { | ||
/* | ||
Retrieve the display density of the Android device. | ||
*/ | ||
default Long getDisplayDensity() { | ||
return CommandExecutionHelper.execute(this, GET_DISPLAY_DENSITY); | ||
} | ||
|
||
/* | ||
Retrieve visibility and bounds information of the status and navigation bars. | ||
*/ | ||
default Map<String, String> getSystemBars() { | ||
return CommandExecutionHelper.execute(this, GET_SYSTEM_BARS); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package io.appium.java_client.android; | ||
|
||
import static io.appium.java_client.android.AndroidMobileCommandHelper.isKeyboardShownCommand; | ||
|
||
import io.appium.java_client.CommandExecutionHelper; | ||
import io.appium.java_client.ExecutesMethod; | ||
|
||
public interface IsKeyboardShown extends ExecutesMethod { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it has more sense to unite this interface with |
||
/** | ||
* Check if the keyboard is displayed. | ||
* | ||
* @return true if keyboard is displayed. False otherwise | ||
*/ | ||
default boolean isKeyboardShown() { | ||
return CommandExecutionHelper.execute(this, isKeyboardShownCommand()); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,6 +17,7 @@ | |
package io.appium.java_client.android; | ||
|
||
import static org.junit.Assert.assertEquals; | ||
import static org.junit.Assert.assertFalse; | ||
import static org.junit.Assert.assertNotEquals; | ||
import static org.junit.Assert.assertNotNull; | ||
|
||
|
@@ -25,6 +26,7 @@ | |
import org.junit.Before; | ||
import org.junit.Test; | ||
|
||
|
||
public class AndroidSearchingTest extends BaseAndroidTest { | ||
|
||
@Before | ||
|
@@ -63,4 +65,10 @@ public void setup() throws Exception { | |
+ "new UiSelector().text(\"Radio Group\"));"); | ||
assertNotNull(radioGroup.getLocation()); | ||
} | ||
|
||
@Test public void deviceDetailsAndKeyboardTest() { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why this method is here? Maybe it has more sense to move it to |
||
assertFalse(driver.isKeyboardShown()); | ||
assertNotNull(driver.getDisplayDensity()); | ||
assertNotEquals(0, driver.getSystemBars().size()); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems that methods that declared by this interface are Android-specific. Please take a look at
https://github.com/search?q=org%3Aappium+DISPLAY+DENSITY&type=Code
https://github.com/search?q=org%3Aappium+GET+SYSTEM+BARS&type=Code
I think it has more sense to move this interface to the
io.appium.java_client.android