How to use performTouch method in Appium Base Driver

Best JavaScript code snippet using appium-base-driver

image-element-specs.js

Source:image-element-specs.js Github

copy

Full Screen

1import _ from 'lodash';2import chai from 'chai';3import chaiAsPromised from 'chai-as-promised';4import BaseDriver, { ImageElement } from '../..';5import { makeImageElementCache, getImgElFromArgs } from '../../lib/basedriver/image-element';6import { IMAGE_ELEMENT_PREFIX } from '../../lib/constants';7import sinon from 'sinon';8chai.should();9chai.use(chaiAsPromised);10const defRect = {x: 100, y: 110, width: 50, height: 25};11const defTemplate = 'iVBORasdf';12describe('ImageElement', function () {13 const driver = new BaseDriver();14 describe('.size', function () {15 it('should return the width and height of the image el', function () {16 const el = new ImageElement(defTemplate, defRect);17 el.size.should.eql({width: defRect.width, height: defRect.height});18 });19 });20 describe('.location', function () {21 it('should return the location of the image el', function () {22 const el = new ImageElement(defTemplate, defRect);23 el.location.should.eql({x: defRect.x, y: defRect.y});24 });25 });26 describe('.center', function () {27 it('should return the center location of the image el', function () {28 const el = new ImageElement(defTemplate, defRect);29 el.center.should.eql({30 x: defRect.x + defRect.width / 2,31 y: defRect.y + defRect.height / 232 });33 });34 });35 describe('.asElement', function () {36 it('should get the webdriver object representation of the element', function () {37 const el = new ImageElement(defTemplate, defRect);38 el.asElement('ELEMENT').ELEMENT.should.match(/^appium-image-el/);39 });40 });41 describe('.equals', function () {42 it('should say two image elements with same rect are equal', function () {43 const el1 = new ImageElement('foo', defRect);44 const el2 = new ImageElement('bar', defRect);45 el1.equals(el2).should.be.true;46 el2.equals(el1).should.be.true;47 });48 it('should say two image elements with different rect are not equal', function () {49 const el1 = new ImageElement(defTemplate, {...defRect, x: 0});50 const el2 = new ImageElement(defTemplate, defRect);51 el1.equals(el2).should.be.false;52 el2.equals(el1).should.be.false;53 });54 });55 describe('.click', function () {56 it('should reject an invalid tap strategy', async function () {57 const d = new BaseDriver();58 const el = new ImageElement(defTemplate, defRect);59 await d.settings.update({imageElementTapStrategy: 'bad'});60 await el.click(d).should.eventually.be.rejectedWith(/Incorrect imageElementTapStrategy/);61 });62 it('should try to check for image element staleness, and throw if stale', async function () {63 const d = new BaseDriver();64 sinon.stub(d, 'findByImage').throws();65 const el = new ImageElement(defTemplate, defRect);66 // we need to check for staleness if explicitly requested to do so67 await d.settings.update({68 checkForImageElementStaleness: true,69 autoUpdateImageElementPosition: false70 });71 await el.click(d).should.eventually.be.rejectedWith(/no longer attached/);72 // and also if we are updating the element position73 await d.settings.update({74 checkForImageElementStaleness: false,75 autoUpdateImageElementPosition: true76 });77 await el.click(d).should.eventually.be.rejectedWith(/no longer attached/);78 });79 it('should auto-update element position if requested', async function () {80 const d = new BaseDriver();81 d.performActions = _.noop;82 sinon.stub(d, 'performActions');83 const el = new ImageElement(defTemplate, defRect);84 const newRect = {...defRect, x: defRect.x + 10, y: defRect.y + 5};85 const elPos2 = new ImageElement(defTemplate, newRect);86 sinon.stub(d, 'findByImage').returns(elPos2);87 await d.settings.update({88 autoUpdateImageElementPosition: true,89 });90 el.rect.should.not.eql(newRect);91 await el.click(d);92 el.rect.should.eql(newRect);93 });94 it('should tap the center of an element using w3c actions by default', async function () {95 const d = new BaseDriver();96 d.performActions = _.noop;97 const actionStub = sinon.stub(d, 'performActions');98 const el = new ImageElement(defTemplate, defRect);99 // skip the staleness check for this test100 await d.settings.update({101 checkForImageElementStaleness: false,102 });103 await el.click(d);104 const pointerMoveAction = actionStub.args[0][0][0].actions[0];105 pointerMoveAction.x.should.equal(el.center.x);106 pointerMoveAction.y.should.equal(el.center.y);107 });108 it('should fall back to touchactions if w3c actions do not exist on driver', async function () {109 const d = new BaseDriver();110 d.performTouch = _.noop;111 const actionStub = sinon.stub(d, 'performTouch');112 const el = new ImageElement(defTemplate, defRect);113 // skip the staleness check for this test114 await d.settings.update({115 checkForImageElementStaleness: false,116 });117 await el.click(d);118 const action = actionStub.args[0][0][0].options;119 action.x.should.equal(el.center.x);120 action.y.should.equal(el.center.y);121 });122 it('should use touchactions if requested', async function () {123 const d = new BaseDriver();124 d.performActions = _.noop;125 const w3cStub = sinon.stub(d, 'performActions');126 d.performTouch = _.noop;127 const touchStub = sinon.stub(d, 'performTouch');128 const el = new ImageElement(defTemplate, defRect);129 // skip the staleness check for this test130 await d.settings.update({131 checkForImageElementStaleness: false,132 imageElementTapStrategy: 'touchActions',133 });134 await el.click(d);135 const action = touchStub.args[0][0][0].options;136 action.x.should.equal(el.center.x);137 action.y.should.equal(el.center.y);138 w3cStub.callCount.should.eql(0);139 });140 it('should throw if driver does not implement any type of action', async function () {141 const d = new BaseDriver();142 const el = new ImageElement(defTemplate, defRect);143 // skip the staleness check for this test144 await d.settings.update({145 checkForImageElementStaleness: false,146 });147 await el.click(d).should.eventually.be.rejectedWith(/did not implement/);148 });149 });150 describe('#execute', function () {151 // aGFwcHkgdGVzdGluZw== is 'happy testing'152 const imgEl = new ImageElement(defTemplate, defRect, 0, 'aGFwcHkgdGVzdGluZw==');153 const clickStub = sinon.stub(imgEl, 'click');154 before(function () {155 driver._imgElCache.set(imgEl.id, imgEl);156 clickStub.returns(true);157 });158 after(function () {159 driver._imgElCache.reset();160 clickStub.restore();161 });162 it('should reject executions on elements not in the cache', async function () {163 await ImageElement.execute(driver, 'click', 'appium-image-element-foo')164 .should.eventually.be.rejectedWith(/element could not be located/);165 });166 it('should reject executions for unsupported commands', async function () {167 await ImageElement.execute(driver, 'foobar', imgEl.id)168 .should.eventually.be.rejectedWith(/not yet been implemented/);169 });170 it('should get displayed status of element', async function () {171 await ImageElement.execute(driver, 'elementDisplayed', imgEl.id)172 .should.eventually.be.true;173 });174 it('should get size of element', async function () {175 await ImageElement.execute(driver, 'getSize', imgEl.id)176 .should.eventually.eql({width: defRect.width, height: defRect.height});177 });178 it('should get location of element', async function () {179 await ImageElement.execute(driver, 'getLocation', imgEl.id)180 .should.eventually.eql({x: defRect.x, y: defRect.y});181 });182 it('should get location in view of element', async function () {183 await ImageElement.execute(driver, 'getLocation', imgEl.id)184 .should.eventually.eql({x: defRect.x, y: defRect.y});185 });186 it('should get rect of element', async function () {187 await ImageElement.execute(driver, 'getElementRect', imgEl.id)188 .should.eventually.eql(defRect);189 });190 it('should get score of element', async function () {191 await ImageElement.execute(driver, 'getAttribute', imgEl.id, 'score')192 .should.eventually.eql(0);193 });194 it('should get visual of element', async function () {195 await ImageElement.execute(driver, 'getAttribute', imgEl.id, 'visual')196 .should.eventually.eql('aGFwcHkgdGVzdGluZw==');197 });198 it('should get null as visual of element by default', async function () {199 const imgElement = new ImageElement(defTemplate, defRect);200 driver._imgElCache.set(imgElement.id, imgElement);201 await ImageElement.execute(driver, 'getAttribute', imgElement.id, 'visual')202 .should.eventually.eql(null);203 });204 it('should not get other attribute', async function () {205 await ImageElement.execute(driver, 'getAttribute', imgEl.id, 'content-desc')206 .should.eventually.rejectedWith('Method has not yet been implemented');207 });208 it('should click element', async function () {209 await ImageElement.execute(driver, 'click', imgEl.id)210 .should.eventually.be.true;211 });212 });213});214describe('image element LRU cache', function () {215 it('should accept and cache image elements', function () {216 const el1 = new ImageElement(defTemplate, defRect);217 const el2 = new ImageElement(defTemplate, defRect);218 const cache = makeImageElementCache();219 cache.set(el1.id, el1);220 el1.equals(cache.get(el1.id)).should.be.true;221 _.isUndefined(cache.get(el2.id)).should.be.true;222 cache.has(el1.id).should.be.true;223 cache.has(el2.id).should.be.false;224 });225 it('once cache reaches max size, should eject image elements', function () {226 const el1 = new ImageElement(defTemplate, defRect);227 const el2 = new ImageElement(defTemplate, defRect);228 const cache = makeImageElementCache(defTemplate.length + 1);229 cache.set(el1.id, el1);230 cache.has(el1.id).should.be.true;231 cache.set(el2.id, el2);232 cache.has(el2.id).should.be.true;233 cache.has(el1.id).should.be.false;234 });235});236describe('getImgElFromArgs', function () {237 it('should return the image element id from json obj in args', function () {238 const imgEl = `${IMAGE_ELEMENT_PREFIX}foo`;239 const args = [1, 'foo', imgEl];240 getImgElFromArgs(args).should.eql(imgEl);241 });242 it('should not return anything if image element id not in args', function () {243 const args = [1, 'foo'];244 _.isUndefined(getImgElFromArgs(args)).should.be.true;245 });246 it('should not find image element id in anything but prefix', function () {247 const notImgEl = `foo${IMAGE_ELEMENT_PREFIX}`;248 const args = [1, 'foo', notImgEl];249 _.isUndefined(getImgElFromArgs(args)).should.be.true;250 });...

Full Screen

Full Screen

image-element.js

Source:image-element.js Github

copy

Full Screen

...181 action: 'tap',182 options: {x, y}183 };184 if (driver.performTouch) {185 return await driver.performTouch([action]);186 }187 throw new Error("Driver did not implement the 'performTouch' command. " +188 'For drivers to support finding image elements, they ' +189 "should support 'performTouch' and 'performActions'");190 }191 /**192 * Handle various Appium commands that involve an image element193 *194 * @param {BaseDriver} driver - the driver to use for commands195 * @param {string} cmd - the name of the driver command196 * @param {string} imgElId - the id of the ImageElement to work with197 * @param {Array} args - Rest of arguments for executeScripts198 *199 * @returns {Object} - the result of running a command...

Full Screen

Full Screen

touch-specs.js

Source:touch-specs.js Github

copy

Full Screen

...13 } catch (ign) {}14 if (!map) {15 let buttons = await driver.findElements('class name', 'UIAButton');16 let gestures = [{action: 'tap', options: {element: buttons[5].ELEMENT}}];17 await driver.performTouch(gestures);18 await B.delay(500);19 await okIfAlert(driver);20 await B.delay(500);21 }22 }23 describe('tap', function () {24 it('should tap on a specified element', async function () {25 let buttons = await driver.findElements('class name', 'UIAButton');26 let gestures = [{action: 'tap', options: { element: buttons[1].ELEMENT}}];27 await driver.performTouch(gestures);28 await B.delay(1000);29 await okIfAlert(driver);30 });31 });32 describe('wait', function () {33 it('should move the page and wait a bit', async function () {34 await goToMap();35 let map = await driver.findElement('xpath', '//UIAMapView');36 let gestures = [37 {action: 'press', options: {element: map.ELEMENT}},38 {action: 'moveTo', options: {element: map.ELEMENT, x: 0, y: 100}},39 {action: 'wait', options: {ms: 5000}},40 {action: 'moveTo', options: {element: map.ELEMENT, x: 0, y: 0}},41 {action: 'release'}42 ];43 await driver.performTouch(gestures);44 });45 });46 describe('pinch', function () {47 it('should do some pinching', async function () {48 await goToMap();49 let map = await driver.findElement('xpath', '//UIAMapView');50 let actions = [51 [52 {action: 'press', options: {element: map.ELEMENT}},53 {action: 'moveTo', options: {element: map.ELEMENT, x: 0, y: 0}},54 {action: 'release'}55 ],56 [57 {action: 'press', options: {element: map.ELEMENT}},58 {action: 'moveTo', options: {element: map.ELEMENT, x: 100, y: 100}},59 {action: 'release'}60 ],61 ];62 await driver.performMultiAction(actions);63 await B.delay(1000);64 });65 it('should do more involved pinching in and out', async function () {66 await goToMap();67 let map = await driver.findElement('xpath', '//UIAMapView');68 let actions = [69 [70 {action: 'press', options: {element: map.ELEMENT}},71 {action: 'moveTo', options: {element: map.ELEMENT, x: 25, y: 25}},72 {action: 'wait', options: {ms: 3000}},73 {action: 'moveTo', options: {element: map.ELEMENT, x: 100, y: 100}},74 {action: 'release'}75 ],76 [77 {action: 'press', options: {element: map.ELEMENT}},78 {action: 'moveTo', options: {element: map.ELEMENT, x: 100, y: 0}},79 {action: 'wait', options: {ms: 3000}},80 {action: 'moveTo', options: {element: map.ELEMENT, x: 0, y: 0}},81 {action: 'release'}82 ],83 ];84 await driver.performMultiAction(actions);85 await B.delay(1000);86 });87 });88});89describe('testapp - swipe actions', function () {90 let session = setup(this, desired);91 let driver = session.driver;92 describe('swipe', function () {93 let slider, target, loc;94 let leftPos = { x: 0, y: 0 },95 rightPos = { x: 0, y: 0 },96 centerPos = { x: 0, y: 0 };97 let getNumericValue = function (pctVal) {98 pctVal = pctVal.replace('%', '');99 pctVal = parseInt(pctVal, 10);100 return pctVal;101 };102 let testSliderValueNot0or100 = function (value) {103 value = getNumericValue(value);104 // should be ~50105 value.should.be.above(15);106 value.should.be.below(85);107 };108 let getSliderValue = async function () {109 return await driver.getAttribute('value', slider);110 };111 before(async function () {112 slider = await driver.findElement('class name', 'UIASlider');113 loc = await driver.getLocation(slider);114 let size = await driver.getSize(slider);115 leftPos.x = loc.x - 5;116 centerPos.x = loc.x + (size.width * 0.5);117 rightPos.x = loc.x + size.width + 5;118 leftPos.y = rightPos.y = centerPos.y = loc.y + (size.height * 0.5);119 target = await driver.findElement('accessibility id', "Access'ibility");120 testSliderValueNot0or100(await getSliderValue());121 });122 // TODO: For some reason it does not swipe to 100% in ci env, investigate123 it('should work with: press {element}, moveTo {destEl} @skip-ci', async function () {124 let origValue = await getSliderValue();125 let gestures = [126 {action: 'press', options: {element: slider.ELEMENT}},127 {action: 'wait', options: {ms: 500}},128 {action: 'moveTo', options: {element: target.ELEMENT}},129 {action: 'release'}130 ];131 await driver.performTouch(gestures);132 (await getSliderValue()).should.not.equal(origValue);133 await B.delay(1000);134 // TODO: in ios84 the destEl is in a weird place, so we don't test value135 //(await getSliderValue()).should.equal("100%")136 });137 it('should work with: press {element, x, y}, moveTo {element, x, y}', async function () {138 let gestures = [139 {action: 'press', options: {element: slider.ELEMENT, x: 0.8665, y: 0.5}},140 {action: 'wait', options: {ms: 500}},141 {action: 'moveTo', options: {element: slider.ELEMENT, x: 0.5, y: 0.5}},142 {action: 'release'}143 ];144 await driver.performTouch(gestures);145 testSliderValueNot0or100(await getSliderValue());146 await B.delay(1000);147 });148 it('should work with: press {x, y}, moveTo {x, y}', async function () {149 let gestures = [150 {action: 'press', options: {x: centerPos.x, y: centerPos.y}},151 {action: 'wait', options: {ms: 500}},152 {action: 'moveTo', options: {x: leftPos.x - centerPos.x, y: leftPos.y - centerPos.y}},153 {action: 'release'}154 ];155 await driver.performTouch(gestures);156 (await getSliderValue()).should.equal('0%');157 });158 it('should work with: {element, x, y}, moveTo {destEl, x, y} @skip-ci', async function () {159 let gestures = [160 {action: 'press', options: {element: slider.ELEMENT, x: 0, y: 0.5}},161 {action: 'wait', options: {ms: 500}},162 {action: 'moveTo', options: {element: target.ELEMENT, x: 50, y: 0.5}},163 {action: 'release'}164 ];165 await driver.performTouch(gestures);166 testSliderValueNot0or100(await getSliderValue());167 });168 // TODO: Crashes in ci env, investigate169 // TODO: For some reason it does not swipe to 100% in ci env, investigate170 it('should work with press {x, y}, moveTo {destEl} @skip-ci', async function () {171 let origValue = await getSliderValue();172 let gestures = [173 {action: 'press', options: {x: centerPos.x, y: centerPos.y}},174 {action: 'wait', options: {ms: 500}},175 {action: 'moveTo', options: {element: target.ELEMENT}},176 {action: 'release'}177 ];178 await driver.performTouch(gestures);179 (await getSliderValue()).should.not.equal(origValue);180 // TODO: weird element position in iOS 8.4 so not checking exact value.181 //.then(getSliderValue).should.become("100%")182 });183 });...

Full Screen

Full Screen

drag-e2e-specs.js

Source:drag-e2e-specs.js Github

copy

Full Screen

...55 {action: 'longPress', options: {element: startEle.ELEMENT}},56 {action: 'moveTo', options: {element: endEle.ELEMENT}},57 {action: 'release', options: {}}58 ];59 await driver.performTouch(gestures);60 let resultEle = await driver.findElement('id', 'io.appium.android.apis:id/drag_result_text');61 await driver.getText(resultEle.ELEMENT).should.eventually.equal('Dropped!');62 });63 it('should drag by element by offset', async function () {64 let startEle = await driver.findElement('id', 'io.appium.android.apis:id/drag_dot_3');65 let endEle = await driver.findElement('id', 'io.appium.android.apis:id/drag_dot_2');66 let gestures = [67 {action: 'longPress', options: {element: startEle.ELEMENT, x: 5, y: 5}},68 {action: 'moveTo', options: {element: endEle.ELEMENT, x: 5, y: 5}},69 {action: 'release', options: {}}70 ];71 await driver.performTouch(gestures);72 await retryInterval(3, 500, async () => {73 const el = await driver.findElement('id', 'io.appium.android.apis:id/drag_result_text');74 (await driver.getText(el.ELEMENT)).should.eql('Dropped!');75 });76 });77 it('should drag by absolute position', async function () {78 let startEle = await driver.findElement('id', 'io.appium.android.apis:id/drag_dot_3');79 let startLoc = await driver.getLocationInView(startEle.ELEMENT);80 let startSize = await driver.getSize(startEle.ELEMENT);81 let endEle = await driver.findElement('id', 'io.appium.android.apis:id/drag_dot_2');82 let endLoc = await driver.getLocationInView(endEle.ELEMENT);83 let endSize = await driver.getSize(endEle.ELEMENT);84 let gestures = [85 {action: 'longPress', options: {86 x: startLoc.x + (startSize.width / 2),87 y: startLoc.y + (startSize.height / 2)88 }},89 {action: 'moveTo', options: {90 x: endLoc.x + (endSize.width / 2),91 y: endLoc.y + (endSize.height / 2)92 }},93 {action: 'release', options: {}}94 ];95 await driver.performTouch(gestures);96 let resultEle = await driver.findElement('id', 'io.appium.android.apis:id/drag_result_text');97 await driver.getText(resultEle.ELEMENT).should.eventually.equal('Dropped!');98 });99 });...

Full Screen

Full Screen

shock.js

Source:shock.js Github

copy

Full Screen

...88 cb.addArgument(targeter);89 cb.start();90}9192function performTouch(game, targeter) {93 var spell = targeter.getSlot().getAbility();94 var parent = targeter.getParent();95 var target = targeter.getSelectedCreature();96 var casterLevel = parent.stats.getCasterLevel();97 98 var damage = game.dice().d8(2) + casterLevel;99 100 if (game.meleeTouchAttack(parent, target)) {101 // create the callback that will apply damage partway through the animation102 var callback = spell.createDelayedCallback("applyDamage");103 callback.setDelay(0.2);104 callback.addArguments([parent, target, damage, targeter]);105 106 // create the animation ...

Full Screen

Full Screen

curse.js

Source:curse.js Github

copy

Full Screen

...56 cb.start();57 }58}5960function performTouch(game, targeter, duration) {61 var parent = targeter.getParent();62 var target = targeter.getSelectedCreature();63 64 if (!game.meleeTouchAttack(parent, target)) return;65 66 applyCurse(game, targeter, target, duration);67 68 if (parent.abilities.has("Drain"))69 bolsterAlly(game, targeter, parent, duration);70}7172function bolsterAlly(game, targeter, target, duration) {73 var spell = targeter.getSlot().getAbility();74 var parent = targeter.getParent(); ...

Full Screen

Full Screen

gesture-specs.js

Source:gesture-specs.js Github

copy

Full Screen

...10 it('should send POST request to /tap on WDA when no element is given', async () => {11 let actions = [12 {action: 'tap'}13 ];14 await driver.performTouch(actions);15 proxySpy.calledOnce.should.be.true;16 proxySpy.firstCall.args[0].should.eql('/tap/0');17 proxySpy.firstCall.args[1].should.eql('POST');18 });19 it('should send POST request to /tap/element on WDA', async () => {20 let actions = [21 {action: 'tap', options: {element: 42}}22 ];23 await driver.performTouch(actions);24 proxySpy.calledOnce.should.be.true;25 proxySpy.firstCall.args[0].should.eql('/tap/42');26 proxySpy.firstCall.args[1].should.eql('POST');27 });28 it('should send POST request to /tap/element with offset on WDA', async () => {29 let actions = [30 {action: 'tap', options: {element: 42, x: 1, y: 2}}31 ];32 await driver.performTouch(actions);33 proxySpy.calledOnce.should.be.true;34 proxySpy.firstCall.args[0].should.eql('/tap/42');35 proxySpy.firstCall.args[1].should.eql('POST');36 });37 });38 describe('mobile methods', () => {39 describe('anything other than scroll', () => {40 it('should throw an error', async () => {41 await driver.execute('mobile: somesuch').should.be.rejected;42 });43 });44 describe('scroll', () => {45 it('should throw an error if no scroll type is specified', async () => {46 await driver.execute('mobile: scroll', {element: 4})...

Full Screen

Full Screen

touch.js

Source:touch.js Github

copy

Full Screen

1import log from '../logger';2import B from 'bluebird';3import { errors, isErrorType } from 'appium-base-driver';4let commands = {}, helpers = {}, extensions = {};5let x = 1, y = 1;6commands.doTouchAction = async function (action, opts) {7 let result;8 switch (action) {9 case 'tap':10 return await this.tap(opts.element, opts.x, opts.y, opts.count);11 case 'press':12 x = opts.x;13 y = opts.y;14 return await this.touchDown(opts.x, opts.y, opts.element);15 case 'release':16 if (!opts.x) {17 opts.x = x;18 }19 if (!opts.y) {20 opts.y = y;21 }22 return await this.touchUp(opts.x, opts.y, opts.element);23 case 'moveTo':24 result = await this.touchMove(x, y, opts.x, opts.y, opts.steps, opts.element);25 x = opts.x;26 y = opts.y;27 return result;28 case 'wait':29 return await B.delay(opts.ms);30 case 'longPress':31 if (typeof opts.duration === 'undefined' || !opts.duration) {32 opts.duration = 2000;33 }34 return await this.touchLongClick(opts.element, opts.x, opts.y, opts.duration);35 default:36 log.errorAndThrow(`unknown action ${action}`);37 }38};39commands.performGesture = async function (gesture) {40 try {41 return await this.doTouchAction(gesture.action, gesture.options || {});42 } catch (e) {43 // sometime the element is not available when releasing, retry without it44 if (isErrorType(e, errors.NoSuchElementError) && gesture.action === 'release' &&45 gesture.options.element) {46 delete gesture.options.element;47 log.debug(`retrying release without element opts: ${gesture.options}.`);48 return await this.doTouchAction(gesture.action, gesture.options || {});49 }50 throw e;51 }52};53commands.performTouch = async function (gestures) {54 let result = true;55 for (let g of gestures) {56 if (!(await this.performGesture(g))) {57 result = false;58 }59 }60 return result;61};62Object.assign(extensions, commands, helpers);63export { commands, helpers };...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1var wd = require('wd');2driver.init({3}).then(function () {4 var action = new wd.TouchAction(driver);5 action.press({x: 100, y: 200})6 .wait(2000)7 .moveTo({x: 100, y: 400})8 .release()9 .perform();10});11var wd = require('wd');12driver.init({13}).then(function () {14 var action = new wd.TouchAction(driver);15 action.press({x: 100, y: 200})16 .wait(2000)17 .moveTo({x: 100, y: 400})18 .release()19 .perform();20});21var wd = require('wd');22driver.init({23}).then(function () {24 var action = new wd.TouchAction(driver);25 action.press({x: 100, y: 200})26 .wait(2000)27 .moveTo({x: 100, y: 400})28 .release()29 .perform();30});31var wd = require('wd');32driver.init({33}).then(function () {

Full Screen

Using AI Code Generation

copy

Full Screen

1var wd = require('wd');2var assert = require('assert');3var serverConfig = {4};5var desiredCaps = {6};7var driver = wd.promiseChainRemote(serverConfig);8 .init(desiredCaps)9 .sleep(3000)10 .performTouch('tap', { x: 100, y: 100 })11 .sleep(3000)12 .quit();13var wd = require('wd');14var assert = require('assert');15var serverConfig = {16};17var desiredCaps = {18};19var driver = wd.promiseChainRemote(serverConfig);20 .init(desiredCaps)21 .sleep(3000)22 .performTouch('tap', { x: 100, y: 100 })23 .sleep(3000)24 .quit();25var wd = require('wd');26var assert = require('assert');27var serverConfig = {28};29var desiredCaps = {30};31var driver = wd.promiseChainRemote(serverConfig);32 .init(desiredCaps)33 .sleep(3000)34 .performTouch('tap', { x: 100, y: 100 })35 .sleep(3000)36 .quit();37var wd = require('wd');38var assert = require('assert');39var serverConfig = {

Full Screen

Using AI Code Generation

copy

Full Screen

1var webdriver = require('selenium-webdriver');2var driver = new webdriver.Builder()3 .usingServer(url)4 .withCapabilities({5 })6 .build();7 .performTouchAction({8 options: {9 }10 })11 .then(function() {12 driver.quit();13 });14 .performTouchAction({15 options: {16 }17 })18 .then(function() {19 driver.quit();20 });21 .performTouchAction({22 options: {23 }24 })25 .then(function() {26 driver.quit();27 });28 .performTouchAction({29 options: {30 }31 })32 .then(function() {33 driver.quit();34 });35 .performTouchAction({36 options: {37 }38 })39 .then(function() {40 driver.quit();41 });42 .performTouchAction({43 options: {44 }45 })46 .then(function() {47 driver.quit();48 });49 .performTouchAction({

Full Screen

Using AI Code Generation

copy

Full Screen

1driver.performTouch({2 options: {3 }4});5driver.performTouch({6 options: {7 }8});9driver.performTouch({10 options: {11 }12});13driver.performTouch({14 options: {15 }16});17driver.performTouch({18 options: {19 }20});21driver.performTouch({22 options: {23 }24});25driver.performTouch({26 options: {

Full Screen

Using AI Code Generation

copy

Full Screen

1var appium = require('appium-base-driver');2var driver = new appium.AppiumDriver();3driver.performTouch('tap', {element: 'id', id: 'id'});4var appium = require('appium-base-driver');5var driver = new appium.AppiumDriver();6driver.performTouch('tap', {element: 'id', id: 'id'});7var appium = require('appium-base-driver');8var driver = new appium.AppiumDriver();9driver.performTouch('tap', {element: 'id', id: 'id'});10var appium = require('appium-base-driver');11var driver = new appium.AppiumDriver();12driver.performTouch('tap', {element: 'id', id: 'id'});13var appium = require('appium-base-driver');14var driver = new appium.AppiumDriver();15driver.performTouch('tap', {element: 'id', id: 'id'});16var appium = require('appium-base-driver');17var driver = new appium.AppiumDriver();18driver.performTouch('tap', {element: 'id', id: 'id'});19var appium = require('appium-base-driver');20var driver = new appium.AppiumDriver();21driver.performTouch('tap', {element: 'id', id: 'id'});22var appium = require('appium-base-driver');23var driver = new appium.AppiumDriver();24driver.performTouch('tap', {element: 'id', id: 'id'});25var appium = require('appium-base-driver');26var driver = new appium.AppiumDriver();27driver.performTouch('tap', {element: 'id', id: 'id'});28var appium = require('appium-base-driver');29var driver = new appium.AppiumDriver();30driver.performTouch('tap', {element:

Full Screen

Using AI Code Generation

copy

Full Screen

1this.performTouch({2 options: {3 }4 });5driver.performTouch({6 options: {7 }8 });9browser.performTouch({10 options: {11 }12 });13client.performTouch({14 options: {15 }16 });17element.performTouch({18 options: {19 }20 });

Full Screen

Using AI Code Generation

copy

Full Screen

1var desiredCaps = {2};3var driver = wd.promiseChainRemote("localhost", 4723);4driver.init(desiredCaps).then(function () {5 return driver.performTouch('tap', {element: '4'});6}).then(function () {7 console.log('Tapped on the element');8}).fin(function() { driver.quit(); });9driver.performTouch('tap', {x: 100, y: 200});10driver.performTouch('tap', {x: 100, y: 200, element: 4});11driver.performTouch('tap', {x: 100, y: 200, element: '4'});12driver.performTouch('tap', {x: 100, y: 200, element: '4', count: 2});13driver.performTouch('tap', {x: 100, y: 200, element: '4', count: 2, duration: 1});14driver.performTouch('tap', {x: 100, y: 200, element: '4', count: 2, duration: 1, touchCount: 1});15driver.performTouch('tap', {x: 100, y: 200, element: '4', count: 2, duration: 1, touchCount: 1, pressure: 1});16driver.performTouch('tap', {x: 100, y: 200, element: '4', count: 2, duration: 1, touchCount: 1, pressure: 1, size: 1});17driver.performTouch('tap', {x: 100, y: 200, element: '4', count: 2, duration: 1, touchCount: 1, pressure: 1, size: 1, gesture: 'press'});18driver.performTouch('tap', {x: 100, y: 200, element: '4', count: 2, duration: 1, touchCount: 1, pressure: 1, size: 1, gesture: 'press', fingers: 1});19driver.performTouch('tap', {x: 100, y: 200, element: '4', count: 2, duration: 1

Full Screen

Using AI Code Generation

copy

Full Screen

1var wd = require('wd');2var assert = require('assert');3var desired = {4};5var browser = wd.remote("localhost", 4723);6browser.init(desired, function() {7 browser.elementByAccessibilityId('Tap Me', function(err, el) {8 browser.performTouch('tap', {element: el}, function(err, res) {9 browser.quit();10 });11 });12});13var wd = require('wd');14var assert = require('assert');15var desired = {16};17var browser = wd.remote("localhost", 4723);18browser.init(desired, function() {19 browser.elementByAccessibilityId('Tap Me', function(err, el) {20 browser.performTouch('tap', {element: el}, function(err, res) {21 browser.quit();22 });23 });24});25var wd = require('wd');26var assert = require('assert');27var desired = {28};29var browser = wd.remote("localhost", 4723);30browser.init(desired, function() {31 browser.elementByAccessibilityId('Tap Me', function(err, el) {32 browser.performTouch('tap', {element: el}, function(err, res) {33 browser.quit();34 });35 });36});37var wd = require('wd');38var assert = require('assert

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run Appium Base Driver automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful