Skip to content

Commit

Permalink
add tests for apk downloading, delete old tests (fix #1631)
Browse files Browse the repository at this point in the history
  • Loading branch information
jlipps committed Dec 17, 2013
1 parent 7b15d05 commit 0b80544
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 3 deletions.
2 changes: 1 addition & 1 deletion bin/test.sh
Expand Up @@ -59,7 +59,7 @@ if $ios_only || $all_tests; then
echo "RUNNING IOS 6.1 TESTS"
echo "---------------------"
ios_testfile="./test/functional/_joined/ios.js"
ios_dirs="prefs safari testapp uicatalog webview"
ios_dirs="prefs safari testapp uicatalog webview appium"
join_testfiles ios6.1 $ios_testfile $ios_dirs
if test -d /Applications/Xcode-6.1.app; then
echo "Found Xcode for iOS 6.1, switching to it"
Expand Down
3 changes: 2 additions & 1 deletion lib/appium.js
Expand Up @@ -328,7 +328,8 @@ Appium.prototype.configureDownloadedApp = function(appPath, origin, cb) {
try {
downloadFile(appUrl, function(appPath) {
this.tempFiles.push(appPath);
cb(null, appPath);
this.args.app = appPath;
cb(null);
}.bind(this));
} catch (e) {
var err = e.toString();
Expand Down
13 changes: 13 additions & 0 deletions test/functional/apidemos/basic.js
Expand Up @@ -11,6 +11,8 @@ var path = require('path')
, appAct2 = "ApiDemos"
, appAct3 = "com.example.android.apis.ApiDemos"
, appAct4 = ".Blargimarg"
, appUrl = 'http://appium.s3.amazonaws.com/ApiDemos-debug.apk'
, describeUrl = require('../../helpers/driverblock.js').describeForApp(appUrl, "android", appPkg, appAct)
, driverBlock = require("../../helpers/driverblock.js")
, describeWd = driverBlock.describeForApp(appPath, "android", appPkg, appAct)
, describeWd2 = driverBlock.describeForApp(appPath, "android", appPkg, appAct2)
Expand Down Expand Up @@ -191,3 +193,14 @@ describe('pre-existing uiautomator session', function() {
});
});
});

describeUrl('appium android', function(h) {
it('should load a zipped app via url', function(done) {
h.driver.execute("mobile: currentActivity", function(err, activity) {
should.not.exist(err);
activity.should.include("ApiDemos");
done();
});
});
});

37 changes: 36 additions & 1 deletion test/functional/uicatalog/basic.js
@@ -1,7 +1,12 @@
/*global it:true */
"use strict";

var describeWd = require("../../helpers/driverblock.js").describeForApp('UICatalog')
, it = require("../../helpers/driverblock.js").it
, path = require('path')
, appUrl = 'http://appium.s3.amazonaws.com/UICatalog6.0.app.zip'
, appZip = path.resolve(__dirname, "../../../assets/UICatalog6.0.app.zip")
, describeZip = require('../../helpers/driverblock.js').describeForApp(appZip)
, describeUrl = require('../../helpers/driverblock.js').describeForApp(appUrl)
, should = require('should');

describeWd('basic', function(h) {
Expand Down Expand Up @@ -67,3 +72,33 @@ describeWd('basic', function(h) {
});

});

describeZip('appium ios', function(h) {
it('should load a zipped app via path', function(done) {
h.driver.elementByTagName('tableView', function(err, element) {
should.not.exist(err);
should.exist(element.value);
done();
});
});
});

describeUrl('appium ios', function(h) {
it('should load a zipped app via url', function(done) {
h.driver.elementByTagName('tableView', function(err, element) {
should.not.exist(err);
should.exist(element.value);
done();
});
});
});

describeWd('appium ios', function(h) {
it('should go back to using app from before', function(done) {
h.driver.elementsByTagName('tableView', function(err, elements) {
should.not.exist(err);
elements.length.should.be.above(0);
done();
});
});
});

0 comments on commit 0b80544

Please sign in to comment.