Skip to content

Commit

Permalink
Merge pull request appium#2664 from sebv/master
Browse files Browse the repository at this point in the history
Various test fixes and improvements
  • Loading branch information
sebv committed May 24, 2014
2 parents 995f56b + 04d569f commit 8371ff0
Show file tree
Hide file tree
Showing 33 changed files with 219 additions and 189 deletions.
16 changes: 6 additions & 10 deletions bin/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,9 @@ if $android_only || $all_tests; then
fi

if $android_chrome; then
echo "RUNNING ANDROID (ARM) TESTS"
echo "RUNNING ANDROID CHROME TESTS"
echo "---------------------"
DEVICE=android time $appåium_mocha \
DEVICE=android time $appium_mocha \
-g '@skip-chrome|@skip-android-all' -i \
test/functional/android/chrome
fi
Expand All @@ -119,12 +119,8 @@ if $gappium_only || $all_tests; then
echo "---------------------"
DEVICE=ios71 time $appium_mocha test/functional/gappium
DEVICE=ios6 time $appium_mocha test/functional/gappium
# TODO: fix android/gappium test, no webview context found, investigate
# echo "Start the android emulator and press Enter."
# read
# DEVICE=android time $appium_mocha test/functional/gappium
# TODO: the gappium app does not work on selendroid, investigate
# echo "Start the android emulator and press Enter."
# read
# DEVICE=selendroid time $appium_mocha test/functional/gappium
echo "Start the android emulator api 19 and press Enter."
read
DEVICE=android time $appium_mocha test/functional/gappium
DEVICE=selendroid time $appium_mocha test/functional/gappium
fi
9 changes: 1 addition & 8 deletions test/functional/android/apidemos/attributes-specs.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,13 @@
"use strict";

var env = require('../../../helpers/env')
, setup = require("../../common/setup-base")
var setup = require("../../common/setup-base")
, desired = require("./desired");

describe("apidemos - attributes", function () {

var driver;
setup(this, desired).then(function (d) { driver = d; });

if (env.FAST_TESTS) {
beforeEach(function (done) {
driver.resetApp().nodeify(done);
});
}

it('should be able to find text attribute', function (done) {
driver
.elementByName('Animation').getAttribute('text')
Expand Down
2 changes: 1 addition & 1 deletion test/functional/android/apidemos/basic-specs.js
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ describe("apidemo - basic @skip-ci", function () {
pids.length.should.equal(1);
done();
});
}, 2000);
}, 5000);
});
});

Expand Down
5 changes: 3 additions & 2 deletions test/functional/android/apidemos/find/basics-specs.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
var env = require('../../../../helpers/env')
, setup = require("../../../common/setup-base")
, desired = require("../desired")
, reset = require("../reset")
, atv = 'android.widget.TextView';

describe("apidemo - find - basics", function () {
Expand All @@ -11,8 +12,8 @@ describe("apidemo - find - basics", function () {
setup(this, desired).then(function (d) { driver = d; });

if (env.FAST_TESTS) {
beforeEach(function (done) {
driver.resetApp().nodeify(done);
beforeEach(function () {
return reset(driver);
});
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,13 @@
"use strict";

var env = require('../../../../helpers/env')
, setup = require("../../../common/setup-base")
var setup = require("../../../common/setup-base")
, desired = require("../desired");

describe("apidemo - find - by accessibility id", function () {

var driver;
setup(this, desired).then(function (d) { driver = d; });

if (env.FAST_TESTS) {
beforeEach(function (done) {
driver.resetApp().nodeify(done);
});
}

it('should find an element by name', function (done) {
driver.element('accessibility id', 'Animation').then(function (el) {
el.should.exist;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,13 @@
"use strict";

var env = require('../../../../helpers/env')
, setup = require("../../../common/setup-base")
var setup = require("../../../common/setup-base")
, desired = require("../desired");

describe("apidemo - find elements - by uiautomator", function () {

var driver;
setup(this, desired).then(function (d) { driver = d; });

if (env.FAST_TESTS) {
beforeEach(function (done) {
driver.resetApp().nodeify(done);
});
}

it('should find elements with a boolean argument', function (done) {
driver.elements('-android uiautomator', 'new UiSelector().clickable(true)').then(function (els) {
els.length.should.be.above(11);
Expand Down
14 changes: 6 additions & 8 deletions test/functional/android/apidemos/find/by-xpath-specs.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
"use strict";

var env = require('../../../../helpers/env')
, setup = require("../../../common/setup-base")
var setup = require("../../../common/setup-base")
, desired = require("../desired")
, atv = 'android.widget.TextView'
, alv = 'android.widget.ListView';
Expand All @@ -11,15 +10,14 @@ describe("apidemo - find - by xpath", function () {
var driver;
setup(this, desired).then(function (d) { driver = d; });

if (env.FAST_TESTS) {
beforeEach(function (done) {
driver.resetApp().nodeify(done);
});
}

var f = "android.widget.FrameLayout";
var l = alv;
var t = atv;

before(function (done) {
driver.sleep(1000).nodeify(done);
});

it('should find element by type', function (done) {
driver
.elementByXPath('//' + t).text()
Expand Down
9 changes: 1 addition & 8 deletions test/functional/android/apidemos/find/complex-find-specs.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,13 @@
"use strict";

var env = require('../../../../helpers/env')
, setup = require("../../../common/setup-base")
var setup = require("../../../common/setup-base")
, desired = require("../desired");

describe("apidemo - find - complex", function () {

var driver;
setup(this, desired).then(function (d) { driver = d; });

if (env.FAST_TESTS) {
beforeEach(function (done) {
driver.resetApp().nodeify(done);
});
}

it('should scroll to an element by text or content desc', function (done) {
driver
.complexFind(["scroll", [[3, "views"]], [[7, "views"]]]).text()
Expand Down
9 changes: 1 addition & 8 deletions test/functional/android/apidemos/find/from-el-specs.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
"use strict";

var env = require('../../../../helpers/env')
, setup = require("../../../common/setup-base")
var setup = require("../../../common/setup-base")
, desired = require("../desired")
, atv = 'android.widget.TextView'
, alv = 'android.widget.ListView';
Expand All @@ -11,12 +10,6 @@ describe("apidemo - find - from element", function () {
var driver;
setup(this, desired).then(function (d) { driver = d; });

if (env.FAST_TESTS) {
beforeEach(function (done) {
driver.resetApp().nodeify(done);
});
}

it('should find a single element by tag name', function (done) {
driver.elementByClassName(alv).then(function (el) {
return el
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,13 @@
"use strict";

var env = require('../../../../helpers/env')
, setup = require("../../../common/setup-base")
var setup = require("../../../common/setup-base")
, desired = require("../desired");

describe("apidemo - find - invalid strategy", function () {

var driver;
setup(this, desired).then(function (d) { driver = d; });

if (env.FAST_TESTS) {
beforeEach(function (done) {
driver.resetApp().nodeify(done);
});
}

it('should not accept -ios uiautomation locator strategy', function (done) {
driver
.elements('-ios uiautomation', '.elements()').catch(function (err) {
Expand Down
7 changes: 3 additions & 4 deletions test/functional/android/apidemos/gestures/click-specs.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,16 @@
var env = require('../../../../helpers/env')
, setup = require("../../../common/setup-base")
, desired = require("../desired")
, reset = require("../reset")
, droidText = 'android.widget.TextView';

describe("apidemo - gestures - click", function () {
var driver;
setup(this, desired).then(function (d) { driver = d; });

if (env.FAST_TESTS) {
beforeEach(function (done) {
driver.resetApp()
.then(function () { return driver.sleep(3000); })
.nodeify(done);
beforeEach(function () {
return reset(driver);
});
}

Expand Down
7 changes: 3 additions & 4 deletions test/functional/android/apidemos/gestures/drag-specs.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
var env = require('../../../../helpers/env')
, setup = require("../../../common/setup-base")
, desired = require("../desired")
, reset = require("../reset")
, droidText = 'android.widget.TextView'
, droidList = 'android.widget.ListView'
, Q = require("q");
Expand All @@ -12,10 +13,8 @@ describe("apidemo - gestures - drag", function () {
setup(this, desired).then(function (d) { driver = d; });

if (env.FAST_TESTS) {
beforeEach(function (done) {
driver.resetApp()
.then(function () { return driver.sleep(3000); })
.nodeify(done);
beforeEach(function () {
return reset(driver);
});
}

Expand Down
7 changes: 3 additions & 4 deletions test/functional/android/apidemos/gestures/execute-specs.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,16 @@
var env = require('../../../../helpers/env')
, setup = require("../../../common/setup-base")
, desired = require("../desired")
, reset = require("../reset")
, droidText = 'android.widget.TextView';

describe("apidemo - gestures - execute", function () {
var driver;
setup(this, desired).then(function (d) { driver = d; });

if (env.FAST_TESTS) {
beforeEach(function (done) {
driver.resetApp()
.then(function () { return driver.sleep(3000); })
.nodeify(done);
beforeEach(function () {
return reset(driver);
});
}

Expand Down
9 changes: 4 additions & 5 deletions test/functional/android/apidemos/gestures/flick-specs.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,16 @@

var env = require('../../../../helpers/env')
, setup = require("../../../common/setup-base")
, desired = require("../desired");
, desired = require("../desired")
, reset = require("../reset");

describe("apidemo - gestures - flick", function () {
var driver;
setup(this, desired).then(function (d) { driver = d; });

if (env.FAST_TESTS) {
beforeEach(function (done) {
driver.resetApp()
.then(function () { return driver.sleep(3000); })
.nodeify(done);
beforeEach(function () {
return reset(driver);
});
}

Expand Down
27 changes: 23 additions & 4 deletions test/functional/android/apidemos/gestures/long-click-specs.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,36 @@
var env = require('../../../../helpers/env')
, setup = require("../../../common/setup-base")
, desired = require("../desired")
, droidText = 'android.widget.TextView';
, reset = require("../reset")
, droidText = 'android.widget.TextView'
, Q = require('q');

describe("apidemo - gestures - long click", function () {
var driver;
setup(this, desired).then(function (d) { driver = d; });

if (env.FAST_TESTS) {
beforeEach(function () {
return reset(driver);
});
}

if (env.FAST_TESTS) {
beforeEach(function (done) {
driver.resetApp()
.then(function () { return driver.sleep(3000); })
.nodeify(done);
function back(depth) {
if (depth < 0) return new Q();
return driver
.elementByNameOrNull("Animation")
.then(function (el) {
if (el) return;
else {
return driver.back().then(function () {
back(depth - 1);
});
}
});
}
back(3).nodeify(done);
});
}

Expand Down
11 changes: 1 addition & 10 deletions test/functional/android/apidemos/gestures/pinch-specs.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
"use strict";

var env = require('../../../../helpers/env')
, setup = require("../../../common/setup-base")
var setup = require("../../../common/setup-base")
, desired = require("../desired")
, droidText = 'android.widget.TextView'
, droidList = 'android.widget.ListView';
Expand All @@ -10,14 +9,6 @@ describe("apidemo - gestures - pinch", function () {
var driver;
setup(this, desired).then(function (d) { driver = d; });

if (env.FAST_TESTS) {
beforeEach(function (done) {
driver.resetApp()
.then(function () { return driver.sleep(3000); })
.nodeify(done);
});
}

// todo fix this: got Error response status: 13, Could not scroll element into view: Views
it('should pinch out/in @skip-android-all', function (done) {
var scrollOpts;
Expand Down
11 changes: 1 addition & 10 deletions test/functional/android/apidemos/gestures/scroll-specs.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,13 @@
"use strict";

var env = require('../../../../helpers/env')
, setup = require("../../../common/setup-base")
var setup = require("../../../common/setup-base")
, desired = require("../desired")
, droidList = 'android.widget.ListView';

describe("apidemo - gestures - scroll", function () {
var driver;
setup(this, desired).then(function (d) { driver = d; });

if (env.FAST_TESTS) {
beforeEach(function (done) {
driver.resetApp()
.then(function () { return driver.sleep(3000); })
.nodeify(done);
});
}

// todo fix this: got Error response status: 13, Could not scroll element into view: Views
it('should bring the element into view @skip-android-all', function (done) {
driver
Expand Down
Loading

0 comments on commit 8371ff0

Please sign in to comment.