From 0fcd48fdbf8ce34374152cbbf77f75d84d3e9f96 Mon Sep 17 00:00:00 2001 From: Isaac Murchie Date: Fri, 27 Jan 2017 11:02:48 -0500 Subject: [PATCH] Make sure scroll/swipe works in web context --- lib/commands/gesture.js | 2 +- test/functional/web/safari-execute-e2e-specs.js | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/commands/gesture.js b/lib/commands/gesture.js index 7188d872e..a4cd1ed12 100644 --- a/lib/commands/gesture.js +++ b/lib/commands/gesture.js @@ -301,7 +301,7 @@ helpers.handlePinchOrZoom = async function (actions) { helpers.mobileScroll = async function (opts={}, swipe=false) { if (!opts.element) { - opts.element = await this.findElement(`class name`, `XCUIElementTypeApplication`); + opts.element = await this.findNativeElementOrElements(`class name`, `XCUIElementTypeApplication`, false); } // WDA supports four scrolling strategies: predication based on name, direction, // predicateString, and toVisible, in that order. Swiping requires direction. diff --git a/test/functional/web/safari-execute-e2e-specs.js b/test/functional/web/safari-execute-e2e-specs.js index 4db78ac1f..cbaec3ef4 100644 --- a/test/functional/web/safari-execute-e2e-specs.js +++ b/test/functional/web/safari-execute-e2e-specs.js @@ -31,6 +31,12 @@ describe('safari - execute', function () { await deleteSession(); }); + describe('mobile: x methods', function () { + it('should run in native context', async () => { + await driver.execute('mobile: scroll', {direction: 'down'}).should.not.be.rejected; + }); + }); + describe('synchronous', function () { it('should bubble up javascript errors', async () => { await driver.execute(`'nan'--`).should.eventually.be.rejected;