Skip to content

#835 added handlers for toggle_wifi,data and airplane mode #837

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

Merged
merged 6 commits into from
Feb 20, 2018
Merged

#835 added handlers for toggle_wifi,data and airplane mode #837

merged 6 commits into from
Feb 20, 2018

Conversation

saikrishna321
Copy link
Member

Types of changes

What types of changes are you proposing/introducing to Java client?
Put an x in the boxes that apply

  • No changes in production code.
  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

@@ -238,6 +244,9 @@
commandRepository.put(NETWORK_SPEED, postC("/session/:sessionId/appium/device/network_speed"));
commandRepository.put(POWER_CAPACITY, postC("/session/:sessionId/appium/device/power_capacity"));
commandRepository.put(POWER_AC_STATE, postC("/session/:sessionId/appium/device/power_ac"));
commandRepository.put(TOGGLE_WIFI, postC("/session/:sessionId/appium/device/toggle_wifi"));
commandRepository.put(TOGGLE_WIFI, postC("/session/:sessionId/appium/device/toggle_airplane_mode"));
commandRepository.put(TOGGLE_WIFI, postC("/session/:sessionId/appium/device/toggle_data"));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TOGGLE_AIRPLANE_MODE

@@ -176,4 +179,16 @@ public void openNotifications() {
public void toggleLocationServices() {
CommandExecutionHelper.execute(this, toggleLocationServicesCommand());
}

public void toggleWifi() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This might be useful to have these methods in the separate SupportsNetworkStateManagement interface

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay i will do that :) cheers

CommandExecutionHelper.execute(this, toggleWifiCommand());
}

public void toggleAirplaneMode() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

docstrings are missing. BTW, this method works for Android only. Also, it foes not work since Android 7+

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In such case, what to do ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

apply the interface to Android driver only. Also, describe the limitations in the docstring

Copy link
Contributor

@mykola-mokhnach mykola-mokhnach Feb 19, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we move it inside SupportsSpecialEmulatorCommands

not needed. As you said Appium will anyway throw an exception if the command didn't work. Although, it might be useful to describe what is supported in the docstring

CommandExecutionHelper.execute(this, toggleAirplaneCommand());
}

public void toggleData() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This only works on Android. Also, the device should be rooted

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't the server thrown exception in this case ?


/**
* Toggle Airplane mode and this works on OS 6.0
* and does not work on OS 7.0 and greater
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

6.0 and lesser

@appium appium deleted a comment Feb 19, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants