MCPcopy
hub / github.com/codeceptjs/CodeceptJS / performSwipe

Method performSwipe

lib/helper/Appium.js:1144–1183  ·  view source on GitHub ↗

* Perform a swipe on the screen. * * ```js * I.performSwipe({ x: 300, y: 100 }, { x: 200, y: 100 }); * ``` * * @param {object} from * @param {object} to * * Appium: support Android and iOS

(from, to)

Source from the content-addressed store, hash-verified

1142 * Appium: support Android and iOS
1143 */
1144 async performSwipe(from, to) {
1145 await this.browser.performActions([
1146 {
1147 id: uuidv4(),
1148 type: 'pointer',
1149 parameters: {
1150 pointerType: 'touch',
1151 },
1152 actions: [
1153 {
1154 duration: 0,
1155 x: from.x,
1156 y: from.y,
1157 type: 'pointerMove',
1158 origin: 'viewport',
1159 },
1160 {
1161 button: 1,
1162 type: 'pointerDown',
1163 },
1164 {
1165 duration: 200,
1166 type: 'pause',
1167 },
1168 {
1169 duration: 600,
1170 x: to.x,
1171 y: to.y,
1172 type: 'pointerMove',
1173 origin: 'viewport',
1174 },
1175 {
1176 button: 1,
1177 type: 'pointerUp',
1178 },
1179 ],
1180 },
1181 ])
1182 await this.browser.pause(2000)
1183 }
1184
1185 /**
1186 * Perform a swipe down on an element.

Callers 3

swipeMethod · 0.95
AppiumTs.types.tsFile · 0.80
Appium.types.tsFile · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected