How to use driver.flick method in Appium Android Driver

Best JavaScript code snippet using appium-android-driver

gestures-specs.js

Source:gestures-specs.js Github

copy

Full Screen

1"use strict";2var env = require('../../../helpers/env')3  , setup = require("../../common/setup-base")4  , desired = require('./desired')5  , spinWait = require('../../../helpers/spin.js').spinWait6  , textBlock = "Now is the time for all good developers to come to serve their country.\n";7// sebv: had to cut down original textBlock, cause text retrieved depends on device size8// textBlock = "Now is the time for all good developers to come to serve their country.\n\nNow is the time for all good developers to come to serve their country.\n\nThis text view can also use attributed strings.";9var SLOW_DOWN_MS = 1000;10describe('uicatalog - gestures @skip-ios7', function () {11  describe('flick @skip-ios7', function () {12    var driver;13    setup(this, desired).then(function (d) { driver = d; });14    if (env.FAST_TESTS) {15      afterEach(function (done) {16        driver17          .flick(0, 100, false)18          .flick(0, 100, false)19          .sleep(SLOW_DOWN_MS)20          .nodeify(done);21      });22    }23    it('should work via webdriver method', function (done) {24      driver25        .elementByClassName('UIATableCell').getLocation()26        .then(function (location1) {27          return driver28            .flick(0, -100, false)29            .elementByClassName('UIATableCell').getLocation()30            .then(function (location2) {31              location2.x.should.equal(location1.x);32              location2.y.should.not.equal(location1.y);33            });34        }).nodeify(done);35    });36    it('should work via mobile only method', function (done) {37      driver38        .elementByClassName('UIATableCell').getLocation()39        .then(function (location1) {40          return driver41            .execute("mobile: flick", [{endX: 0, endY: 0}])42            .elementByClassName('UIATableCell').getLocation()43            .then(function (location2) {44              location2.x.should.equal(location1.x);45              location2.y.should.not.equal(location1.y);46            });47        }).nodeify(done);48    });49    it('should not complete instantaneously', function (done) {50      var start = Date.now();51      driver52        .execute("mobile: flick", [{endX: 0, endY: 0}])53        .then(function () { (Date.now() - start).should.be.above(2500); })54        .nodeify(done);55    });56    it('should work via mobile only method with percentage', function (done) {57      var opts = {startX: 0.75, startY: 0.75, endX: 0.25, endY: 0.25};58      driver59        .elementByClassName('UIATableCell').getLocation()60        .then(function (location1) {61          return driver62            .execute("mobile: flick", [opts])63            .elementByClassName('UIATableCell').getLocation()64            .then(function (location2) {65              location2.x.should.equal(location1.x);66              location2.y.should.not.equal(location1.y);67            });68        }).nodeify(done);69    });70  });71  describe('swipe gesture @skip-ios7', function () {72    var driver;73    setup(this, desired).then(function (d) { driver = d; });74    if (env.FAST_TESTS) {75      afterEach(function (done) {76        driver77          .flick(0, 70, false)78          .flick(0, 70, false)79          .sleep(SLOW_DOWN_MS)80          .nodeify(done);81      });82    }83    it('should work with wd function in pixels', function (done) {84      driver85        .elementByClassName('UIATableCell').getLocation()86        .then(function (location1) {87          return spinWait(function () {88            return driver89              .flick(0, -70, true)90              .elementByClassName('UIATableCell').getLocation()91              .then(function (location2) {92                ((location2.x === location1.x) &&93                  (location2.y !== location1.y)94                ).should.be.ok;95              });96          }, 5000);97        }).nodeify(done);98    });99    it('should work with wd function in percent', function (done) {100      driver101        .elementByClassName('UIATableCell').getLocation()102        .then(function (location1) {103          return driver104            .flick(0, -0.1, true) // flaky105            .flick(0, -0.1, true)106            .flick(0, -0.1, true)107            .elementByClassName('UIATableCell').getLocation()108            .then(function (location2) {109              location2.x.should.equal(location1.x);110              location2.y.should.not.equal(location1.y, '===y');111            });112        }).nodeify(done);113    });114    it('should work with mobile function in pixels', function (done) {115      var opts = {startX: 50, startY: 400, endX: 50, endY: 300, duration: 2};116      driver117        .elementByClassName('UIATableCell').getLocation()118        .then(function (location1) {119          return spinWait(function () {120            return driver121              .execute("mobile: swipe", [opts])122              .elementByClassName('UIATableCell').getLocation()123              .then(function (location2) {124                location2.x.should.equal(location1.x);125                location2.y.should.not.equal(location1.y);126              });127          });128        }).nodeify(done);129    });130    it('should work with mobile function in percent', function (done) {131      var opts = {startX: 0.5, startY: 0.9, endX: 0.5, endY: 0.7, duration: 2};132      driver133        .elementByClassName('UIATableCell').getLocation()134        .then(function (location1) {135          return spinWait(function () {136            return driver137              .execute("mobile: swipe", [opts])138              .elementByClassName('UIATableCell').getLocation()139              .then(function (location2) {140                location2.x.should.equal(location1.x);141                location2.y.should.not.equal(location1.y);142              });143          });144        }).nodeify(done);145    });146    it('should not complete instantaneously', function (done) {147      var start = Date.now();148      var opts = {startX: 0.5, startY: 0.9, endX: 0.5, endY: 0.7, duration: 2};149      driver150        .execute("mobile: swipe", [opts])151        .then(function () {152          (Date.now() - start).should.be.above(1999);153        }).nodeify(done);154    });155  });156  describe("flick element @skip-ios7", function () {157    var driver;158    setup(this, desired).then(function (d) { driver = d; });159    if (env.FAST_TESTS) {160      afterEach(function (done) {161        driver162          .elementByClassName("UIASlider")163          .then(function (el) { if (el) return el.sendKeys(0.5); })164          .then(function (el) { if (el) return el.sendKeys(0.5); })165          .clickBack()166          .sleep(SLOW_DOWN_MS)167          .nodeify(done);168      });169    }170    it("slider value should change", function (done) {171      var valueBefore, slider;172      driver173        .elementsByClassName('UIATableCell').then(function (els) { return els[1]; })174        .click()175        .elementByClassName("UIASlider").then(function (el) { slider = el; })176        .then(function () { return slider.getAttribute("value"); })177        .then(function (value) { valueBefore = value; })178        .then(function () { return slider.flick(-0.5, 0, 1); })179        .then(function () { return slider.getAttribute("value"); })180        .then(function (valueAfter) {181          valueBefore.should.not.equal("0%");182          valueAfter.should.equal("0%");183        }).nodeify(done);184    });185    it("should work with mobile flick", function (done) {186      var valueBefore, slider;187      driver188        .elementsByClassName('UIATableCell').then(function (els) { return els[1]; })189        .click()190        .elementByClassName("UIASlider").then(function (el) { slider = el; })191        .then(function () { return slider.getAttribute("value"); })192        .then(function (value) { valueBefore = value; })193        .then(function () {194          var opts = {element: slider.value, endX: -50, endY: 0};195          return driver.execute("mobile: flick", [opts]);196        })197        .then(function () { return slider.getAttribute("value"); })198        .then(function (valueAfter) {199          valueBefore.should.not.equal("0%");200          valueAfter.should.equal("0%");201        }).nodeify(done);202    });203    it("should work with mobile flick and percent", function (done) {204      var valueBefore, slider;205      driver206        .elementsByClassName('UIATableCell').then(function (els) { return els[1]; })207        .click()208        .elementByClassName("UIASlider").then(function (el) { slider = el; })209        .then(function () { return slider.getAttribute("value"); })210        .then(function (value) { valueBefore = value; })211        .then(function () {212          var opts = {element: slider.value, startX: 0.5, startY: 0.0,213            endX: 0.0, endY: 0.0};214          return driver.execute("mobile: flick", [opts]);215        })216        .then(function () { return slider.getAttribute("value"); })217        .then(function (valueAfter) {218          valueBefore.should.not.equal("0%");219          valueAfter.should.equal("0%");220        }).nodeify(done);221    });222  });223  describe("swipe element @skip-ios7", function () {224    var driver;225    setup(this, desired).then(function (d) { driver = d; });226    if (env.FAST_TESTS) {227      afterEach(function (done) {228        driver229          .elementByClassName("UIASlider")230          .then(function (el) { if (el) return el.sendKeys(0.5); })231          .clickBack()232          .sleep(SLOW_DOWN_MS)233          .nodeify(done);234      });235    }236    it("slider value should change", function (done) {237      var valueBefore, slider;238      driver239        .elementsByClassName('UIATableCell').then(function (els) { return els[1]; })240        .click()241        .elementByClassName("UIASlider").then(function (el) { slider = el; })242        .then(function () { return slider.getAttribute("value"); })243        .then(function (value) { valueBefore = value; })244        .then(function () {245          var opts = {startX: 0.5, startY: 0.5, endX: 0.25, endY: 0.5,246            duration: 0.3, element: slider.value};247          return driver.execute("mobile: swipe", [opts]);248        })249        .then(function () { return slider.getAttribute("value"); })250        .then(function (valueAfter) {251          valueBefore.should.equal("50%");252          valueAfter.should.equal("20%");253        }).nodeify(done);254    });255    it("slider value should change by pixels", function (done) {256      var valueBefore, slider;257      driver258        .elementsByClassName('UIATableCell').then(function (els) { return els[1]; })259        .click()260        .elementByClassName("UIASlider").then(function (el) { slider = el; })261        .then(function () { return slider.getAttribute("value"); })262        .then(function (value) { valueBefore = value; })263        .then(function () {264          var opts = {endX: 15, endY: 10, duration: 0.3, element: slider.value};265          return driver.execute("mobile: swipe", [opts]);266        })267        .then(function () { return slider.getAttribute("value"); })268        .then(function (valueAfter) {269          valueBefore.should.equal("50%");270          valueAfter.should.equal("5%");271        }).nodeify(done);272    });273  });274  describe('complex tap', function () {275    var driver;276    setup(this, desired).then(function (d) { driver = d; });277    if (env.FAST_TESTS) {278      afterEach(function (done) {279        driver280          .clickBack()281          .sleep(SLOW_DOWN_MS)282          .nodeify(done);283      });284    }285    it('should work with custom options', function (done) {286      var tapOpts = {287        tapCount: 1 // how many taps288      , duration: 2.3 // how long289      , touchCount: 3 // how many fingers290      , x: 100 // in pixels from left291      , y: 250 // in pixels from top292      };293      driver294        .execute("mobile: tap", [tapOpts])295        .elementByClassName("UIATextView").text()296        .then(function (text) {297          text.should.include(textBlock);298        })299        .nodeify(done);300    });301    it('should work in relative units @skip-ios7', function (done) {302      var tapOpts = {303        tapCount: 1 // how many taps304      , duration: 2.3 // how long305      , touchCount: 3 // how many fingers306      , x: 0.5 // 50% from left of screen307      , y: 0.55 // 55% from top of screen308      };309      driver310        .execute("mobile: tap", [tapOpts])311        .elementByClassName('UIATextView').text()312        .then(function (text) {313          text.should.include(textBlock);314        })315        .nodeify(done);316    });317    it('should work with default options @skip-ios7', function (done) {318      driver319        .execute("mobile: tap")320        .elementByClassName('UIATextView').text()321        .then(function (text) {322          text.should.include(textBlock);323        })324        .nodeify(done);325    });326  });327  describe('complex tap on element', function () {328    var driver;329    setup(this, desired).then(function (d) { driver = d; });330    if (env.FAST_TESTS) {331      afterEach(function (done) {332        driver333          .clickBack()334          .sleep(SLOW_DOWN_MS)335          .nodeify(done);336      });337    }338    it('should work in relative units', function (done) {339      driver340        .elementsByClassName('UIATableCell').then(function (els) { return els[4]; })341        .then(function (el) {342          var tapOpts = {343            x: 0.5 // in relative width from left344          , y: 0.5 // in relative height from top345          , element: el.value346          };347          return driver348            .execute("mobile: tap", [tapOpts]);349        }).elementByClassName('UIATextView').text()350        .then(function (text) {351          text.should.include(textBlock);352        }).nodeify(done);353    });354    it('should work in pixels', function (done) {355      driver356        .elementsByClassName('UIATableCell').then(function (els) { return els[4]; })357        .then(function (el) {358          var tapOpts = {359            x: 150 // in pixels from left360          , y: 30 // in pixels from top361          , element: el.value362          };363          return driver364            .execute("mobile: tap", [tapOpts]);365        }).elementByClassName('UIATextView').text()366        .then(function (text) {367          text.should.include(textBlock);368        }).nodeify(done);369    });370  });371  describe('scroll to element @skip-ios7', function () {372    var driver;373    setup(this, desired).then(function (d) { driver = d; });374    if (env.FAST_TESTS) {375      afterEach(function (done) {376        driver377          .flick(0, 100, false)378          .flick(0, 100, false)379          .sleep(SLOW_DOWN_MS)380          .nodeify(done);381      });382    }383    it('should bring the element into view', function (done) {384      var el, scrollOpts, location1;385      driver.elementsByClassName('UIATableCell').then(function (els) {386        el = els[10];387        scrollOpts = { element: el.value };388      })389      .then(function () { return el.getLocation(); })390      .then(function (loc) { location1 = loc; })391      .then(function () {392        return driver.execute("mobile: scrollTo", [scrollOpts]);393      }).then(function () { return el.getLocation(); })394      .then(function (location2) {395        location2.x.should.equal(location1.x);396        location2.y.should.not.equal(location1.y);397      }).nodeify(done);398    });399  });400  describe('mobile: scroll', function () {401    var driver;402    setup(this, desired).then(function (d) { driver = d; });403    it('should scroll down and up', function (done) {404      var firstEl, location1, location2;405      driver406      .elementByClassName('UIATableCell')407      .then(function (el) { firstEl = el; return el.getLocation(); })408      .then(function (loc) { location1 = loc; })409      .then(function () {410        return driver.execute("mobile: scroll", [{direction: 'down'}]);411      })412      .then(function () { return firstEl.getLocation(); })413      .then(function (loc2) {414        location2 = loc2;415        loc2.x.should.equal(location1.x);416        loc2.y.should.not.equal(location1.y);417      })418      .then(function () {419        return driver.execute("mobile: scroll", [{direction: 'up'}]);420      })421      .then(function () { return firstEl.getLocation(); })422      .then(function (loc3) {423        loc3.x.should.equal(location2.x);424        loc3.y.should.not.equal(location2.y);425      })426      .nodeify(done);427    });428    it('should scroll down and up using element', function (done) {429      var firstEl, location1, location2, table_view;430      driver.elementByClassName('UIATableView').then(function (el) {431        table_view = el;432      })433      .elementByClassName('UIATableCell')434      .then(function (el) { firstEl = el; return el.getLocation(); })435      .then(function (loc) { location1 = loc; })436      .then(function () {437        return driver.execute("mobile: scroll", [{element: table_view.value, direction: 'down'}]);438      })439      .then(function () { return firstEl.getLocation(); })440      .then(function (loc2) {441        location2 = loc2;442        loc2.x.should.equal(location1.x);443        loc2.y.should.not.equal(location1.y);444      })445      .then(function () {446        return driver.execute("mobile: scroll", [{element: table_view.value, direction: 'up'}]);447      })448      .then(function () { return firstEl.getLocation(); })449      .then(function (loc3) {450        loc3.x.should.equal(location2.x);451        loc3.y.should.not.equal(location2.y);452      })453      .nodeify(done);454    });455  });456  describe('mobile shake', function () {457    var driver;458    setup(this, desired).then(function (d) { driver = d; });459    it('should not error', function (done) {460      driver.shakeDevice().nodeify(done);461    });462  });...

Full Screen

Full Screen

gesture-specs.js

Source:gesture-specs.js Github

copy

Full Screen

...53  });54  describe('flick @skip-ios8 @skip-ios7', function () {55    const SLOW_DOWN_MS = 1000;56    afterEach(async function () {57      await driver.flick(undefined, 0, 100);58      await driver.flick(undefined, 0, 100);59      await B.delay(SLOW_DOWN_MS);60    });61    describe('with element', function () {62      it('slider value should change', async function () {63        let els = await driver.findElements('class name', 'UIATableCell');64        await driver.click(els[10]);65        let slider = await driver.findElement('class name', 'UIASlider');66        let valueBefore = await driver.getAttribute('value', slider);67        await driver.flick(slider, undefined, undefined, -0.5, 0, 1);68        let valueAfter = await driver.getAttribute('value', slider);69        valueBefore.should.not.equal('0%');70        valueAfter.should.equal('0%');71      });72    });73  });74  describe('mobile scroll', function () {75    before(async function () {76      try {77        await driver.back();78      } catch (ign) {}79      // we want to begin at the top, so try to scroll up there80      await driver.execute('mobile: scroll', {direction: 'up'});81    });...

Full Screen

Full Screen

flick-specs.js

Source:flick-specs.js Github

copy

Full Screen

1"use strict";2var env = require('../../../../helpers/env')3  , setup = require("../../../common/setup-base")4  , desired = require('../desired');5var SLOW_DOWN_MS = 1000;6describe('uicatalog - gestures - flick @skip-ios-all', function () {7  var driver;8  setup(this, desired).then(function (d) { driver = d; });9  if (env.FAST_TESTS) {10    afterEach(function (done) {11      driver12        .flick(0, 100, false)13        .flick(0, 100, false)14        .sleep(SLOW_DOWN_MS)15        .nodeify(done);16    });17  }18  it('should work via webdriver method', function (done) {19    driver20      .elementByClassName('UIATableCell').getLocationInView()21      .then(function (location1) {22        return driver23          .flick(0, -100, false)24          .elementByClassName('UIATableCell').getLocationInView()25          .then(function (location2) {26            location2.x.should.equal(location1.x);27            location2.y.should.not.equal(location1.y);28          });29      }).nodeify(done);30  });31  it('should work via mobile only method', function (done) {32    driver33      .elementByClassName('UIATableCell').getLocationInView()34      .then(function (location1) {35        return driver36          .execute("mobile: flick", [{endX: 0, endY: 0}])37          .elementByClassName('UIATableCell').getLocationInView()38          .then(function (location2) {39            location2.x.should.equal(location1.x);40            location2.y.should.not.equal(location1.y);41          });42      }).nodeify(done);43  });44  it('should not complete instantaneously', function (done) {45    var start = Date.now();46    driver47      .execute("mobile: flick", [{endX: 0, endY: 0}])48      .then(function () { (Date.now() - start).should.be.above(2500); })49      .nodeify(done);50  });51  it('should work via mobile only method with percentage', function (done) {52    var opts = {startX: 0.75, startY: 0.75, endX: 0.25, endY: 0.25};53    driver54      .elementByClassName('UIATableCell').getLocationInView()55      .then(function (location1) {56        return driver57          .execute("mobile: flick", [opts])58          .elementByClassName('UIATableCell').getLocationInView()59          .then(function (location2) {60            location2.x.should.equal(location1.x);61            location2.y.should.not.equal(location1.y);62          });63      }).nodeify(done);64  });65  describe('with element', function () {66    afterEach(function () {67      driver.back();68    });69    it("slider value should change", function (done) {70      var valueBefore, slider;71      driver72        .elementsByClassName('UIATableCell').then(function (els) { return els[10]; })73        .click()74        .elementByClassName("UIASlider").then(function (el) { slider = el; })75        .then(function () { return slider.getAttribute("value"); })76        .then(function (value) { valueBefore = value; })77        .then(function () { return slider.flick(-0.5, 0, 1); })78        .then(function () { return slider.getAttribute("value"); })79        .then(function (valueAfter) {80          valueBefore.should.not.equal("0%");81          valueAfter.should.equal("0%");82        }).nodeify(done);83    });84    it("should work with mobile flick", function (done) {85      var valueBefore, slider;86      driver87        .elementsByClassName('UIATableCell').then(function (els) { return els[10]; })88        .click()89        .elementByClassName("UIASlider").then(function (el) { slider = el; })90        .then(function () { return slider.getAttribute("value"); })91        .then(function (value) { valueBefore = value; })92        .then(function () {93          var opts = {element: slider.value, endX: -50, endY: 0};94          return driver.execute("mobile: flick", [opts]);95        })96        .then(function () { return slider.getAttribute("value"); })97        .then(function (valueAfter) {98          valueBefore.should.not.equal("0%");99          valueAfter.should.equal("0%");100        }).nodeify(done);101    });102    it("should work with mobile flick and percent", function (done) {103      var valueBefore, slider;104      driver105        .elementsByClassName('UIATableCell').then(function (els) { return els[10]; })106        .click()107        .elementByClassName("UIASlider").then(function (el) { slider = el; })108        .then(function () { return slider.getAttribute("value"); })109        .then(function (value) { valueBefore = value; })110        .then(function () {111          var opts = {element: slider.value, startX: 0.5, startY: 0.0,112            endX: 0.0, endY: 0.0};113          return driver.execute("mobile: flick", [opts]);114        })115        .then(function () { return slider.getAttribute("value"); })116        .then(function (valueAfter) {117          valueBefore.should.not.equal("0%");118          valueAfter.should.equal("0%");119        }).nodeify(done);120    });121  });...

Full Screen

Full Screen

swipe-specs.js

Source:swipe-specs.js Github

copy

Full Screen

1"use strict";2var env = require('../../../../helpers/env')3  , setup = require("../../../common/setup-base")4  , desired = require('../desired')5  , spinWait = require('../../../../helpers/spin.js').spinWait;6var SLOW_DOWN_MS = 1000;7describe('uicatalog - gestures - swipe @skip-ios7 @skip-ios6', function () {8  var driver;9  setup(this, desired).then(function (d) { driver = d; });10  if (env.FAST_TESTS) {11    afterEach(function (done) {12      driver13        .flick(0, 70, false)14        .flick(0, 70, false)15        .sleep(SLOW_DOWN_MS)16        .nodeify(done);17    });18  }19  it('should work with wd function in pixels', function (done) {20    driver21      .elementByClassName('UIATableCell').getLocation()22      .then(function (location1) {23        return spinWait(function () {24          return driver25            .flick(0, -70, true)26            .elementByClassName('UIATableCell').getLocation()27            .then(function (location2) {28              ((location2.x === location1.x) &&29                (location2.y !== location1.y)30              ).should.be.ok;31            });32        }, 5000);33      }).nodeify(done);34  });35  it('should work with wd function in percent', function (done) {36    driver37      .elementByClassName('UIATableCell').getLocation()38      .then(function (location1) {39        return driver40          .flick(0, -0.1, true) // flaky41          .flick(0, -0.1, true)42          .flick(0, -0.1, true)43          .elementByClassName('UIATableCell').getLocation()44          .then(function (location2) {45            location2.x.should.equal(location1.x);46            location2.y.should.not.equal(location1.y, '===y');47          });48      }).nodeify(done);49  });50  it('should work with mobile function in pixels', function (done) {51    var opts = {startX: 50, startY: 400, endX: 50, endY: 300, duration: 2};52    driver53      .elementByClassName('UIATableCell').getLocation()54      .then(function (location1) {55        return spinWait(function () {56          return driver57            .execute("mobile: swipe", [opts])58            .elementByClassName('UIATableCell').getLocation()59            .then(function (location2) {60              location2.x.should.equal(location1.x);61              location2.y.should.not.equal(location1.y);62            });63        });64      }).nodeify(done);65  });66  it('should work with mobile function in percent', function (done) {67    var opts = {startX: 0.5, startY: 0.9, endX: 0.5, endY: 0.7, duration: 2};68    driver69      .elementByClassName('UIATableCell').getLocation()70      .then(function (location1) {71        return spinWait(function () {72          return driver73            .execute("mobile: swipe", [opts])74            .elementByClassName('UIATableCell').getLocation()75            .then(function (location2) {76              location2.x.should.equal(location1.x);77              location2.y.should.not.equal(location1.y);78            });79        });80      }).nodeify(done);81  });82  it('should not complete instantaneously', function (done) {83    var start = Date.now();84    var opts = {startX: 0.5, startY: 0.9, endX: 0.5, endY: 0.7, duration: 2};85    driver86      .execute("mobile: swipe", [opts])87      .then(function () {88        (Date.now() - start).should.be.above(1999);89      }).nodeify(done);90  });...

Full Screen

Full Screen

article-skeleton.fructose.android.js

Source:article-skeleton.fructose.android.js Github

copy

Full Screen

...33      await isComponentDisplayed("flag-exclusive");34      await isComponentDisplayed("articleByline");35    });36    test("article skeleton should be able to scroll down the page", async () => {37      await driver.flick(0, -900);38      await driver.waitForElementByXPath(39        `//*[contains(@content-desc, 'paragraph')]`40      );41    });42  }...

Full Screen

Full Screen

basic.e2e.js

Source:basic.e2e.js Github

copy

Full Screen

...18  });19  it('should find text by scrolling', async () => {20    expect(await driver.hasElementByAccessibilityId('text3')).toBe(false);21    const FAST = 2;22    await driver.flick(0, -1000, FAST)23    expect(await driver.hasElementByAccessibilityId('text3')).toBe(true);24  });...

Full Screen

Full Screen

scroll-to-el-specs.js

Source:scroll-to-el-specs.js Github

copy

Full Screen

1"use strict";2var env = require('../../../../helpers/env')3  , setup = require("../../../common/setup-base")4  , desired = require('../desired');5var SLOW_DOWN_MS = 1000;6describe('uicatalog - gestures - scroll to el @skip-ios7 @skip-ios6', function () {7  var driver;8  setup(this, desired).then(function (d) { driver = d; });9  if (env.FAST_TESTS) {10    afterEach(function (done) {11      driver12        .flick(0, 100, false)13        .flick(0, 100, false)14        .sleep(SLOW_DOWN_MS)15        .nodeify(done);16    });17  }18  it('should bring the element into view', function (done) {19    var el, scrollOpts, location1;20    driver.elementsByClassName('UIATableCell').then(function (els) {21      el = els[10];22      scrollOpts = { element: el.value };23    })24    .then(function () { return el.getLocation(); })25    .then(function (loc) { location1 = loc; })26    .then(function () {27      return driver.execute("mobile: scrollTo", [scrollOpts]);28    }).then(function () { return el.getLocation(); })29    .then(function (location2) {30      location2.x.should.equal(location1.x);31      location2.y.should.not.equal(location1.y);32    }).nodeify(done);33  });...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1var webdriverio = require('webdriverio');2var options = {3    desiredCapabilities: {4    }5};6var driver = webdriverio.remote(options);7    .init()8    .flick(0, -100, 0, 100)9    .end()10var driver = webdriverio.remote(options).init();11driver.flick(0, -100, 0, 100);12driver.end();13var driver = webdriverio.remote(options).init();14driver.flick(0, -100, 0, 100);15driver.end();16var driver = webdriverio.remote(options).init();17driver.flick(0, -100, 0, 100);18driver.end();19var driver = webdriverio.remote(options).init();20driver.flick(0, -100, 0, 100);21driver.end();22var driver = webdriverio.remote(options).init();23driver.flick(0, -100, 0, 100);24driver.end();25var driver = webdriverio.remote(options).init();26driver.flick(0, -100, 0, 100);27driver.end();28var driver = webdriverio.remote(options).init();

Full Screen

Using AI Code Generation

copy

Full Screen

1driver.flick(100, 100, 0, -100);2driver.flick(100, 100, 0, -100);3driver.flick(100, 100, 0, -100, 1);4driver.flick(100, 100, 0, -100, 1);5driver.flick(100, 100, 0, -100, 1, 1);6driver.flick(100, 100, 0, -100, 1, 1);7driver.flick(100, 100, 0, -100, 1, 1, 1);8driver.flick(100, 100, 0, -100, 1, 1, 1);9driver.flick(100, 100, 0, -100, 1, 1, 1, 1);10driver.flick(100, 100, 0, -100, 1, 1, 1, 1);11driver.flick(100, 100, 0, -100, 1, 1, 1, 1, 1);12driver.flick(100, 100, 0, -100, 1, 1, 1, 1, 1);

Full Screen

Using AI Code Generation

copy

Full Screen

1driver.flick(100, 100, 100, 100, 100);2driver.flick(100, 100, 100, 100, 100, 100);3driver.flick(100, 100, 100, 100, 100, 100, 100);4driver.flick(100, 100, 100, 100, 100, 100, 100, 100);5driver.flick(100, 100, 100, 100, 100, 100, 100, 100, 100);6driver.flick(100, 100, 100, 100, 100, 100, 100, 100, 100, 100);7driver.flick(100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 10

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 Android 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