diff --git a/sample-code/examples/node/android-complex.js b/sample-code/examples/node/android-complex.js index fef89b96..24920b38 100644 --- a/sample-code/examples/node/android-complex.js +++ b/sample-code/examples/node/android-complex.js @@ -49,30 +49,22 @@ describe("android complex", function () { allPassed = allPassed && this.currentTest.state === 'passed'; }); - it("should find an element", function () { - return driver - .elementByXPath('//android.widget.TextView[@text=\'Animation\']') - .elementByXPath('//android.widget.TextView') - .text().should.become('API Demos') - .elementsByXPath('//android.widget.TextView[contains(@text, "Animat")]') - .then(_p.filterDisplayed).first() - .then(function (el) { - if (!process.env.SAUCE) { - return el.text().should.become('Animation'); - } - }).elementByName('App').click() - .sleep(3000) - .elementsByAndroidUIAutomator('new UiSelector().clickable(true)') - .should.eventually.have.length.above(10) - .elementByXPath('//android.widget.TextView[@text=\'Action Bar\']') - .should.eventually.exist - .elementsByXPath('//android.widget.TextView') - .then(_p.filterDisplayed).first() - .text().should.become('API Demos') - .back().sleep(1000); + it("should scroll down", function () { + return driver.getWindowSize() + .then(function(size){ + var center = { + x: size.width / 2, + y: size.height / 2 + }; + return driver.swipe({ + startX: center.x, startY: center.y, + endX: center.x, endY: 100, + duration: 800 + }); + }); }); - it("should scroll", function () { + it("should scroll with an element", function () { return driver .elementByXPath('//android.widget.TextView[@text=\'Animation\']') .elementsByXPath('//android.widget.TextView') @@ -90,108 +82,4 @@ describe("android complex", function () { }); }); }); - - it("should draw a smiley", function () { - function findTouchPaint() { - return driver - .elementsByClassName('android.widget.TextView') - .then(function (els) { - return Q.all([ - els[els.length - 1].getLocation(), - els[0].getLocation() - ]).then(function (locs) { - return driver.swipe({ - startX: locs[0].x, startY: locs[0].y, - endX: locs[1].x, endY: locs[1].y, - duration: 800 - }); - }); - }).elementByName('Touch Paint') - .catch(function () { - return findTouchPaint(); - }); - } - - return driver - .elementByName('Graphics').click() - .then(findTouchPaint) - .click() - .sleep(5000) - .then(function () { - var a1 = new wd.TouchAction(); - a1.press({x: 150, y: 100}).release(); - var a2 = new wd.TouchAction(); - a2.press({x: 250, y: 100}).release(); - var smile = new wd.TouchAction(); - smile - .press({x:110, y:200}) - .moveTo({x:1, y:1}) - .moveTo({x:1, y:1}) - .moveTo({x:1, y:1}) - .moveTo({x:1, y:1}) - .moveTo({x:1, y:1}) - .moveTo({x:2, y:1}) - .moveTo({x:2, y:1}) - .moveTo({x:2, y:1}) - .moveTo({x:2, y:1}) - .moveTo({x:2, y:1}) - .moveTo({x:3, y:1}) - .moveTo({x:3, y:1}) - .moveTo({x:3, y:1}) - .moveTo({x:3, y:1}) - .moveTo({x:3, y:1}) - .moveTo({x:4, y:1}) - .moveTo({x:4, y:1}) - .moveTo({x:4, y:1}) - .moveTo({x:4, y:1}) - .moveTo({x:4, y:1}) - .moveTo({x:5, y:1}) - .moveTo({x:5, y:1}) - .moveTo({x:5, y:1}) - .moveTo({x:5, y:1}) - .moveTo({x:5, y:1}) - .moveTo({x:5, y:0}) - .moveTo({x:5, y:0}) - .moveTo({x:5, y:0}) - .moveTo({x:5, y:0}) - .moveTo({x:5, y:0}) - .moveTo({x:5, y:0}) - .moveTo({x:5, y:0}) - .moveTo({x:5, y:0}) - .moveTo({x:5, y:-1}) - .moveTo({x:5, y:-1}) - .moveTo({x:5, y:-1}) - .moveTo({x:5, y:-1}) - .moveTo({x:5, y:-1}) - .moveTo({x:4, y:-1}) - .moveTo({x:4, y:-1}) - .moveTo({x:4, y:-1}) - .moveTo({x:4, y:-1}) - .moveTo({x:4, y:-1}) - .moveTo({x:3, y:-1}) - .moveTo({x:3, y:-1}) - .moveTo({x:3, y:-1}) - .moveTo({x:3, y:-1}) - .moveTo({x:3, y:-1}) - .moveTo({x:2, y:-1}) - .moveTo({x:2, y:-1}) - .moveTo({x:2, y:-1}) - .moveTo({x:2, y:-1}) - .moveTo({x:2, y:-1}) - .moveTo({x:1, y:-1}) - .moveTo({x:1, y:-1}) - .moveTo({x:1, y:-1}) - .moveTo({x:1, y:-1}) - .moveTo({x:1, y:-1}) - .release(); - - var ma = new wd.MultiAction().add(a1, a2, smile); - return driver.performMultiAction(ma) - // so you can see it - .sleep(10000) - .back().sleep(1000) - .back().sleep(1000); - }); - }); - }); diff --git a/sample-code/examples/node/helpers/caps.js b/sample-code/examples/node/helpers/caps.js index 7d38be95..51d40b9f 100644 --- a/sample-code/examples/node/helpers/caps.js +++ b/sample-code/examples/node/helpers/caps.js @@ -1,16 +1,16 @@ exports.ios81 = { browserName: '', - 'appium-version': '1.3', + 'appium-version': '1.5', platformName: 'iOS', - platformVersion: '8.1', + platformVersion: '9.1', deviceName: 'iPhone Simulator', app: undefined // will be set later }; exports.android18 = { browserName: '', - 'appium-version': '1.3', + 'appium-version': '1.5', platformName: 'Android', platformVersion: '4.3', deviceName: 'Android Emulator', @@ -19,7 +19,7 @@ exports.android18 = { exports.android19 = { browserName: '', - 'appium-version': '1.3', + 'appium-version': '1.5', platformName: 'Android', platformVersion: '4.4.2', deviceName: 'Android Emulator', @@ -28,7 +28,7 @@ exports.android19 = { exports.selendroid16 = { browserName: '', - 'appium-version': '1.3', + 'appium-version': '1.5', platformName: 'Android', platformVersion: '4.1', automationName: 'selendroid',