feat: Add locator types supported by flutter integration driver#2201
feat: Add locator types supported by flutter integration driver#2201mykola-mokhnach merged 9 commits intoappium:masterfrom
Conversation
| return String.format("%s.%s: %s", AppiumBy.class.getSimpleName(), locatorName, remoteParameters.value()); | ||
| } | ||
|
|
||
| public Map<String, Object> toJson() { |
There was a problem hiding this comment.
not sure this method is needed
There was a problem hiding this comment.
Currently flutter driver supports custom commands like scrollTillVisble, waitForVisible, waitForVisible etc, which accepts raw locator info(By) as arguments. So users can directly pass the locator info by calling toJson() method instead of constructing the JsonMap manually.
There was a problem hiding this comment.
I can observe that Remotable.Parameters class already contains toJson method. It's private though. Lets add it to the list in SeleniumHQ/selenium#13949 and leave a TODO there.
Also consider using Map.of() factory instead.
There was a problem hiding this comment.
Could you also provide an example of any of the above calls where toJson method may be used?
There was a problem hiding this comment.
One such example is using flutter: scrollTillVisible method.
- Without toJson()
driver.executeScript("flutter: scrollTillVisible", Map.of("finder", Map.of("using", "-flutter key", "value", "login_button")));
- With toJson()
driver.executeScript("flutter: scrollTillVisible", Map.of("finder", AppiumBy.flutterKey("login_button").toJson());
There was a problem hiding this comment.
It would probably make sense to create FlutterIosDriver and FlutterAndroidDriver inherited from iOSDriver and AndroidDriver, so the above extensions may be implemented as first-class methods, e.g.
flutter. scrollTillVisible(AppiumBy.flutterKey("login_button"))
There was a problem hiding this comment.
We initially had a similar idea. After reviewing the implementation, we found that the logic is consistent for both iOS and Android drivers, so we decided to maintain this approach.
There was a problem hiding this comment.
@sudharsan-selvaraj Agree we wanted to make it consistent but nothing is stopping us implementing the initial approach if everyone is fine. It gets easier to implement the tests.
cc: @mykola-mokhnach
There was a problem hiding this comment.
@saikrishna321 @mykola-mokhnach That sounds good! Let's proceed by creating separate Flutter-specific driver classes to abstract the underlying commands. I'll prepare a patch with the changes and tag for the review.
src/main/java/io/appium/java_client/flutter/FlutterAndroidDriver.java
Outdated
Show resolved
Hide resolved
src/main/java/io/appium/java_client/flutter/FlutterAndroidDriver.java
Outdated
Show resolved
Hide resolved
src/main/java/io/appium/java_client/flutter/FlutterAndroidDriver.java
Outdated
Show resolved
Hide resolved
|
@mykola-mokhnach @SrinivasanTarget I have updated the PR to just include the changes related to locators. I'll create separate PR for driver implementation along with the e2e tests. |
|
Hi @sudharsan-selvaraj, congrats, the Appium project wants to compensate you for this (and perhaps other) contribution(s) this month! Please reply to this comment mentioning me and sharing your OpenCollective account name, so that we can initiate payment! Or let me know if you decline to receive compensation via OpenCollective. Thank you! |
|
Hey @jlipps , I would like to express my gratitude to the Appium team for the recognition and I'm pleased to be a part of the project. For the fund transfers, please use the OpenCollective account associated with https://opencollective.com/appium-device-farm. If you need any additional information, please let me know. |
|
Does this support annotation (eg @AndroidFindBy & @iOSXCUITFindBy) to create common element ? |
Change list
Please provide briefly described change list which are you going to propose.
Types of changes
What types of changes are you proposing/introducing to Java client?
Put an
xin the boxes that applyDetails
Please provide more details about changes if it is necessary. If there are new features you can provide code samples which show the way they
work and possible use cases. Also you can create gists with pasted java code samples or put them here using markdown.
About markdown please read Mastering markdown and Writing on GitHub