-
-
Notifications
You must be signed in to change notification settings - Fork 759
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
Alert API Implementation for iOS #459
Alert API Implementation for iOS #459
Conversation
@SrinivasanTarget public class IOSDriver<T extends WebElement>
extends AppiumDriver<T>
implements IOSDeviceActionShortcuts,
FindsByIosUIAutomation<T> {
...
@Override public TargetLocator switchTo() {
return new InnerTargetLocator();
}
private class InnerTargetLocator extends RemoteTargetLocator {
@Override public Alert alert() {
return new IOSAlert(super.alert());
}
}
class IOSAlert implements Alert {
private final Alert alert;
IOSAlert(Alert alert) {
this.alert = alert;
}
@Override
public void dismiss() {
alert.dismiss();
}
@Override
public void accept() {
alert.accept();
}
@Override
public String getText() {
Response response = execute(DriverCommand.GET_ALERT_TEXT);
return response.getValue().toString();
}
@Override
public void sendKeys(String keysToSend) {
execute(DriverCommand.SET_ALERT_VALUE, prepareArguments("value", keysToSend));
}
@Override
public void setCredentials(Credentials credentials) {
alert.setCredentials(credentials);
}
@Override
public void authenticateUsing(Credentials credentials) {
alert.authenticateUsing(credentials);
}
}
} |
There are new checkstyle issues: @SrinivasanTarget Please get it fixed |
.IosUIAutomation(".elements().withName(\"show alert\")")).click(); | ||
WebDriverWait wating = new WebDriverWait(driver, 10000); | ||
wating.until(alertIsPresent()); | ||
assertNotNull(driver.switchTo().alert().getText()); |
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.
@SrinivasanTarget
I would like to advive you to
assertTrue(!StringUtils.isBlank(driver.switchTo().alert().getText()));
What if the empty string would be returned? :)
@TikhomirovSergey Thanks.I have incorporated the changes now and squashed the commits. |
Implementation changes Fixed Checkstyle issues Fixed Checkstyle issues
Change list
Alert Handling for iOS.Added below methods,
API is here: https://github.com/appium/appium-base-driver/blob/master/lib/mjsonwp/routes.js#L403
API's were not implemented for Android Driver on server side.We can port it to android driver on client side post server implementation.
New W3C API's here: https://github.com/appium/appium-base-driver/blob/master/lib/mjsonwp/routes.js#L414 are not been adapted by Appium (Legacy drivers on server) yet.
Types of changes
What types of changes are you proposing/introducing to Java client?
Put an
x
in the boxes that apply@TikhomirovSergey please review