Performing Pinch to Zoom In Action

This tutorial is to test the Pinch To Zoom In action in the mobile app. The app used for this demonstration can be downloaded here. We will be using Android O.S for this tutorial, so please make sure that your Android device API is greater than 18.

Scenario:

In the screenshot below, we want to zoom into “Hello World” and verify the zoom-in action.

Performing Pinch to Zoom In in automation test

Manual Mode:

  • Step 1: Select Start Application from mobile keyword and click on Input it will open a window, where for appFile select Value Type as Variable and in Value, pass the variable name as path and click OK.

Performing Pinch to Zoom In in automation test

  • Step 2: Add a Wait For Element Present item for API Demos to show up.
  • Step 3: Call Scroll To Text from mobile keyword, pass Views as Input. Scroll To Text accepts String type parameter (Text of the element to scroll to)

Performing Pinch to Zoom In in automation test

  • Step 4: Call Tap method and pass the object of Views.
  • Step 5: Select Scroll To Text keyword and pass the Tabs text.

Performing Pinch to Zoom In in automation test

  • Step 6: Call Tap method and pass the object of WebView
  • Step 7: Add wait commands to wait for ‘Hello world‘ link to be visible.
  • Step 8: Call ‘Get Element Height‘ method and capture the of “Hello World” height to store it in a variable named ‘ele_Height‘.
  • Step 9: Call ‘Get Element Width‘ method and capture the of “Hello World” element width to store it in ‘ele_Width‘.   
  • Step 10: Add ‘Pinch To Zoom In At Position‘ method from mobile keyword list and pass the following values in: ele_Height, ele_Width, Offset value.

Performing Pinch to Zoom In in automation test

  • Step 11: After zooming in, we need to verify that element has been zoomed. Thus, we need to re-capture the element Height and Width.
  • Step 12: After zooming the element height and width should be greater than the existing height and width in the test. By using ‘Verify Greater Than‘ method, we can validate the element height and width.

Performing Pinch to Zoom In in automation test

As you can see from the step-by-step guide above, there are repeated steps that will be easier to create in Script Mode. Thus, we suggest the users to utilize this feature where one can quickly automate the test scenario and easily manage test scripts.

Script Mode:

The source code is available here. For further instructions and help, please refer to Pinch To Zoom In At Position guide and join us on Katalon Forum.

83% people found this helpful
Related testing tools
Katalon Studio
Best automation solution for software testing team. Completely free!
Katalon Recorder
Ultimate Selenium IDE to record, play, and debug app. Fast and extensible!
Katalon Analytics
Bring you to the next level of test execution reports. Smart and seamless solution!
Scroll up