Skip to content
This repository has been archived by the owner on Mar 23, 2020. It is now read-only.

removing not passing tests and adding in a test for scrolling down #75

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
140 changes: 14 additions & 126 deletions sample-code/examples/node/android-complex.js
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand All @@ -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);
});
});

});
10 changes: 5 additions & 5 deletions sample-code/examples/node/helpers/caps.js
Original file line number Diff line number Diff line change
@@ -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',
Expand All @@ -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',
Expand All @@ -28,7 +28,7 @@ exports.android19 = {

exports.selendroid16 = {
browserName: '',
'appium-version': '1.3',
'appium-version': '1.5',
platformName: 'Android',
platformVersion: '4.1',
automationName: 'selendroid',
Expand Down