@testplane/webdriverio
Version:
Next-gen browser and mobile automation test framework for Node.js
32 lines (31 loc) • 1.61 kB
TypeScript
import type { PinchAndZoomOptions } from '../../types.js';
/**
*
* Performs a zoom gesture on the given element on the screen.
*
* :::info
*
* Zooming is done based on native mobile gestures. It is only supported for the following drivers:
* - [appium-uiautomator2-driver](https://github.com/appium/appium-uiautomator2-driver/blob/master/docs/android-mobile-gestures.md#mobile-pinchopengesture) for Android
* - [appium-xcuitest-driver](https://appium.github.io/appium-xcuitest-driver/latest/reference/execute-methods/#mobile-pinch) for iOS
*
* :::
*
* <example>
:zoom.js
it('should demonstrate a zoom on Google maps', async () => {
const mapsElement = $('//*[@resource-id="com.google.android.apps.maps:id/map_frame"]')
// Zoom with the default duration scale
await mapsElement.zoom()
// Zoom with a custom duration and scale
await mapsElement.zoom({ duration: 4000, scale: 0.9 })
})
* </example>
*
* @alias element.zoom
* @param {PinchAndZoomOptions=} options Zoom options (optional)
* @param {number=} options.duration The duration in millisecond of how fast the zoom should be executed, minimal is 500 ms and max is 10000 ms. The default is 1500 ms (1.5 seconds) (optional)
* @param {number=} options.scale The scale of how big the zoom should be according to the screen. Valid values must be float numbers in range 0..1, where 1.0 is 100% (optional)
* @mobileElement
*/
export declare function zoom(this: WebdriverIO.Element, options?: Partial<PinchAndZoomOptions>): Promise<unknown>;