I am trying to record a use case on our app which includes taking a picture with the iOS camera. I was able to record the scenario, but when I play it back it fails on the step where the shutter button should be tapped.
Error: View was found, but is not visible.
The class is identified as CUShutterButton, the exact class is checked, the index is zero.
I was unable to find the element in the DOM, I'm assuming the DOM only displays elements from the app itself. Since the camera is part of the native OS, it is not displayed here.
Has anybody tried to do this? Would I be able to make this a coded step? Not sure if I can integrate Selenium into the mobile coded steps.
Thanks.
8 Answers, 1 is accepted
Thank you for your interest in Test Studio Mobile.
I would like to have few more details please. Could you please confirm if there is a tap step recorded against the CUShutterButton element?
Have you tried to refresh the DOM tree in record mode and then try to locate the shutter button in the DOM?
Please let me know the above details to continue the investigation. Thanks!
Regards,
Elena Tsvetkova
Progress Telerik
Elena,
there is a step recorded. I can record the step again but I have the same issue. The details for the recorded element are:
class: CUShutterButton
exact class: checked
index: 0
I browsed all elements in the DOM but the shutter button was not highlighted. I can see highlights for all the elements of the app, hence why I'm assuming it doesn't show elements currently on the device. Whenever I click on refresh for the DOM, the device disconnects itself from the laptop (wireless connection).
I am using an iPad Air 2 with iOS 10.2.
Thank you for your cooperation.
It is actually quite weird that you are able to record a step against the shutter button since this is not a supported scenario in general. As per your initial suggestion the camera is part of the OS and Test Studio extension could not be implemented in it.
Thus I would like to have few more details to try to test that on our end. Please let me know what kind of application you are testing - is it a native or a hybrid one?
And the other important note is how is used the camera in the app - is there a custom class that interacts with the camera itself or the OS camera app is used?
As I mentioned above such scenario is not actually supported for iOS native app. In case the application is a Xamarin or NativeScript hybrid one similar scenario could be automated for Android. If it would be applicable for you.
I am looking forward to hearing from you!
Regards,
Elena Tsvetkova
Progress Telerik
Elena,
It's a native app. The developer is using the default camera class in the code to access the camera (native camera app).
Thank you for your cooperation. Please allow me some time to investigate on our end and I will get back to you once I have my observations. Thanks in advance for your understanding!
Regards,
Elena Tsvetkova
Progress Telerik
Thank you for your patience.
We managed to create a sample app using your directions and reproduce the reported behavior. What we found is that once the camera is opened there is an element with class PLCropOverlay overlaying all elements on screen. It actually prevents the successful execution of the recorded step.
To overcome that result you should first edit the the target element's query of the recorded step to point to that PLCropOverlay class in the iOS query section and to delete all properties. Then next step is to edit the recorded Tap step to tap AtLocation and provide the coordinates of shutter button. I have attached a screenshot displaying both modifications.
The listed coordinates (X = 700, Y = 500) corresponds to the shutter button for iPad devices with Retina displays. For an iPhone device and maybe iPad Pro you might need to adjust the coordinates.
Please give this a try and let me know if it works for you as well. In case of any further assistance required do not hesitate to drop me a message.
Thanks for your cooperation!
Regards,
Elena Tsvetkova
Progress Telerik
Elena,
Your suggestions worked, the test is now successful. Please let me know how you identified the PLCropOverlay class, that process will prove useful in the future as I create more tests.
Thanks.
I am glad to hear that worked for you as well.
This behavior that the DOM is not loaded when the camera app is running is actually not expected so we will fix that and it will be available in any of the upcoming updates.
Though until then if you run the application in Debug mode in xCode the DOM tree with all available elements on screen could be accessed. This is how the PLCropOverlay class was identified.
Thank you for your understanding and do not hesitate to contact us again in case of any further queries!
Regards,
Elena Tsvetkova
Progress Telerik