-
-
Notifications
You must be signed in to change notification settings - Fork 764
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
add finger print command to android Driver #473
Conversation
@alizelzele can you please add tests? |
@saikrishna321 +1 |
@TikhomirovSergey @alizelzele what is the use-case for this PR? |
@saikrishna321 This is why I'm asking for tests. |
@saikrishna321 @TikhomirovSergey since android 6.0 there is a finger print sensor installed on some devices for security + some applications already started supporting fingerprint instead of their login method. I am a bit busy now, will try to add test for it ASAP. |
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.
By Saying fingerprintID,
Are you sure it is finger number from 1 to 10? If so how can a device or a emulator knows finger 1 to 10 prints of owner?
AFIK it should be the saved fingerprint's (counts) on your device/emulator to access it in security settings.Also i don't think any device that supports 10 prints to be stored. Please update enough information in this PR or could be links to clarify these q's.
@SrinivasanTarget this function is only for emulators. Android 6 support fingerprint , and emulator supports that behavior by allowing you to use 10 predefined fingerprints. You just select which finger id you want to touch the sensor and it will touch it for you :-). |
@alizelzele Ok Thanks for your clarification. Few remarks, 1)Adding tests as mentioned above.
|
@alizelzele Did you got a chance to look into this? |
c3131e6
to
0473a25
Compare
p.s: sorry for the big delay. I were busy at work since it was close to national holiday in china, and after that it was (obviously) national holidays. (and more obvious, I am working in china 😄 ) |
@alizelzele Cool will review it soon. |
Nice Catch @codacy-bot. @alizelzele Can you please fix this? |
/** | ||
* add a new finger print to security. | ||
*/ | ||
@Test public void pressKeyCodeTest() throws Exception { |
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 the code is suppose to throw exception if the test fails. I add try catch to whole test body and assert fail on failing :-)
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.
use the @Test(expected = MyException.class)
syntax for such case
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.
@mykola-mokhnach throwing exception is not the expected behavior. if it throws any that means it failed. try catch is there to prevent throwing exception on test fail (as asked by @SrinivasanTarget )
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.
ok, perhaps it makes sense to add some nice description to the fail
method in such case
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.
Done
service.start(); | ||
|
||
if (service == null || !service.isRunning()) { | ||
throw new RuntimeException("An appium server node is not started!"); |
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 This part of code is duplicate of io.appium.java_client.android.BaseAndroidTest
. I will use another RuntimeException to throw, Don't think adding a new Exception class is required
0473a25
to
ec18611
Compare
capabilities.setCapability("appPackage", "com.android.settings"); | ||
capabilities.setCapability("appActivity", activity); | ||
return (AndroidDriver) new AndroidDriver<AndroidElement>(service.getUrl(), capabilities); | ||
// return (AndroidDriver) new AndroidDriver<AndroidElement>(new URL("http://localhost:4723/wd/hub"), capabilities); |
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.
Comment should be removed here.
@alizelzele Can you sign CLA? |
@@ -16,6 +16,7 @@ | |||
|
|||
package io.appium.java_client.android; | |||
|
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.
AndroidDeviceActionShortcuts
API is deprecated.
@SrinivasanTarget I believe i already signed the cla ( maybe with another email). |
ec18611
to
3f07e40
Compare
@alizelzele Above is the link now. But still there are some work left for you to complete. |
@alizelzele Please refer this: #509 |
@SrinivasanTarget signed it. It was new! I guess I mistake it with Selion CLI :-) |
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.
@alizelzele I think that the FingerPrintTest
may be more simle. Also there are merge conflicts.
|
||
import java.util.concurrent.TimeUnit; | ||
|
||
public class FingerPrintTest { |
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.
@alizelzele Why don't you like to extend the BaseAndroidTest
?
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.
@TikhomirovSergey because test needs access to service created in BaseAndroidTest which is private.
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.
The FingerPrintTest needs to be improved. Also it needs to resolve conflicts.
DesiredCapabilities capabilities = new DesiredCapabilities(); | ||
capabilities.setCapability(MobileCapabilityType.DEVICE_NAME, "Android Emulator"); | ||
capabilities.setCapability("appPackage", "com.android.settings"); | ||
capabilities.setCapability("appActivity", activity); |
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.
@alizelzele Maybe ApiDemos has convenient functionality. Have you tried to play with it?
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.
@TikhomirovSergey searched it. did not find anything fingerprint related to use.
@TikhomirovSergey this feature is part of Android base driver server from version 2.0.16 |
What's the current state of this feature / PR? Does it need to be redone or just have the comments addressed? |
Sorry guys, I did not find any time to reply and fix the issues. the test needs to enable lock on device and make sure it is unlocked after the test, which added a bit of complexity to code. I was going to update appium-unlock to support sending passKey when unlocking to make things more clear and easier to handle. I am rebasing and fixing merge issues now. but if I remember correctly the xpath in test were not valid anymore. will give it a shot |
3f07e40
to
5dab23d
Compare
Stupid github (me), I push without committing my changes first, and github automatically closed the PR. 🤦♂️ |
update the code and fixed merge conflicts. test run correctly and successfully on this avd:
which emulator config you are using that the test in failing on? since test is written using xpath and it is also running system applications, it is a bit (very) fragile. did not find any other way to do it though. |
@alizelzele Thanks for changes. we will review it soon today. |
01fe970
to
f981200
Compare
I have started to review it again. I am going to provide the feedback ASAP
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.
Hi @alizelzele Thank you very much for update
I was trying to run the test on different emulators with different API levels. The result was the same NoSuchElementException
. could you provide some information to make the test running green or please make some improvements
@TikhomirovSergey It works on my system 😀 😁 😁 |
f981200
to
5ecaa95
Compare
5ecaa95
to
c8946c1
Compare
@TikhomirovSergey likely on Windows emulator there is another additional step when you want to enable security! I updated the test, add more comment and test it. one issue on my system is that for some reason following command and thus appium was not able to trigger fingerprint:
but I test the code using debugger and it is working also on windows too. hope you won't have the issue with SDK. |
@alizelzele ok. I have started to check it again.
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.
@alizelzele I can approve this PR. But I want to propese some additional changes at the additional PR. I am going to propose it ASAP
Hey guys, other environment details: Please let me know if you have any information regarding the issue. |
Additional changes of the #473
Change list
added finger print function to android driver. defined the command url and helper method, and created an Action shortcut to use it.
Types of changes
What types of changes are you proposing/introducing to Java client?
Put an
x
in the boxes that applyDetails
it is a simple function to activate emulators fingerprint sensor. the command is like
driver.fingerPrint(x)
where x is the finger number (1 to 10). this command is created based on add finger print to route