mirror of
https://github.com/appium/appium.git
synced 2026-04-25 12:58:39 -05:00
fix some failing android tests
This commit is contained in:
@@ -77,8 +77,6 @@ fi
|
||||
if $android_only || $all_tests; then
|
||||
echo "RUNNING ANDROID TESTS"
|
||||
echo "---------------------"
|
||||
# android_dirs="apidemos android toggletest"
|
||||
# selendroid_dirs=" gappium selendroid"
|
||||
DEVICE=android time $appium_mocha -g '@skip-android-all' -i \
|
||||
test/functional/common \
|
||||
test/functional/android
|
||||
|
||||
+1
-1
@@ -779,7 +779,7 @@ Appium.prototype.reset = function (cb) {
|
||||
logger.info("Android fast reset");
|
||||
this.device.fastReset(function (err) {
|
||||
if (err) {
|
||||
cb(null, {status: status.codes.UnknownError.code, value: null});
|
||||
cb(null, {status: status.codes.UnknownError.code, value: err.message});
|
||||
} else {
|
||||
cb(null, {status: status.codes.Success.code, value: null});
|
||||
}
|
||||
|
||||
@@ -979,19 +979,25 @@ ADB.prototype.androidCoverage = function (instrumentClass, waitPkg, waitActivity
|
||||
ADB.prototype.getFocusedPackageAndActivity = function (cb) {
|
||||
logger.info("Getting focused package and activity");
|
||||
var cmd = "dumpsys window windows"
|
||||
, nullRe = new RegExp(/mFocusedApp=null/)
|
||||
, searchRe = new RegExp(/mFocusedApp.+ ([a-zA-Z0-9\._]+)\/(\.?[^\} ]+).*\}/);
|
||||
|
||||
this.shell(cmd, function (err, stdout) {
|
||||
if (err) return cb(err);
|
||||
var foundMatch = false;
|
||||
var foundNullMatch = false;
|
||||
_.each(stdout.split("\n"), function (line) {
|
||||
var match = searchRe.exec(line);
|
||||
if (match) {
|
||||
foundMatch = match;
|
||||
} else if (nullRe.test(line)) {
|
||||
foundNullMatch = true;
|
||||
}
|
||||
});
|
||||
if (foundMatch) {
|
||||
cb(null, foundMatch[1].trim(), foundMatch[2].trim());
|
||||
} else if (foundNullMatch) {
|
||||
cb(null, null, null);
|
||||
} else {
|
||||
cb(new Error("Could not parse activity from dumpsys"));
|
||||
}
|
||||
@@ -1029,7 +1035,6 @@ ADB.prototype.waitForActivityOrNot = function (pkg, activity, not,
|
||||
var wait = function () {
|
||||
this.getFocusedPackageAndActivity(function (err, foundPackage,
|
||||
foundActivity) {
|
||||
if (err) return cb(err);
|
||||
var foundAct = checkForActivity(foundPackage, foundActivity);
|
||||
if ((!not && foundAct) || (not && !foundAct)) {
|
||||
cb();
|
||||
|
||||
@@ -242,9 +242,6 @@ Android.prototype.onUiautomatorExit = function () {
|
||||
}
|
||||
};
|
||||
|
||||
Android.prototype.cleanupUiAutomator = function (cb) {
|
||||
};
|
||||
|
||||
Android.prototype.checkShouldRelaunch = function (launchErr) {
|
||||
if (launchErr.message === null || typeof launchErr.message === 'undefined') {
|
||||
logger.error("We're checking if we should relaunch based on something " +
|
||||
@@ -399,7 +396,6 @@ Android.prototype.cleanup = function () {
|
||||
};
|
||||
|
||||
Android.prototype.shutdown = function (cb) {
|
||||
this.adb.endAndroidCoverage();
|
||||
var next = function () {
|
||||
this.cleanupChromedriver(function () {
|
||||
if (this.uiautomator) {
|
||||
@@ -415,6 +411,7 @@ Android.prototype.shutdown = function (cb) {
|
||||
}.bind(this);
|
||||
|
||||
if (this.adb) {
|
||||
this.adb.endAndroidCoverage();
|
||||
this.adb.stopLogcat(function () {
|
||||
next();
|
||||
}.bind(this));
|
||||
|
||||
@@ -112,8 +112,7 @@ describe("apidemo - basic -", function () {
|
||||
});
|
||||
});
|
||||
|
||||
// TODO: fix that, that frequently hangs then crashes Appium
|
||||
describe('without fastClear @skip-android-all', function () {
|
||||
describe('without fastClear', function () {
|
||||
var driver;
|
||||
setup(this, _.defaults({fastClear: false}, desired))
|
||||
.then(function (d) { driver = d; });
|
||||
@@ -144,7 +143,7 @@ describe("apidemo - basic -", function () {
|
||||
session.setUp().nodeify(done);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
describe('error cases', function () {
|
||||
var opts = {'no-retry': true};
|
||||
|
||||
@@ -202,11 +201,10 @@ describe("apidemo - basic -", function () {
|
||||
});
|
||||
});
|
||||
|
||||
// TODO: fix that, same fastclear issue killing appium
|
||||
describe('pre-existing uiautomator session @skip-android-all', function () {
|
||||
describe('pre-existing uiautomator session', function () {
|
||||
before(function (done) {
|
||||
var adb = new ADB();
|
||||
var binPath = path.resolve(__dirname, "..", "..", "..", "build",
|
||||
var binPath = path.resolve(__dirname, "..", "..", "..", "..", "build",
|
||||
"android_bootstrap", "AppiumBootstrap.jar");
|
||||
var uiArgs = ["shell", "uiautomator", "runtest", "AppiumBootstrap.jar", "-c",
|
||||
"io.appium.android.bootstrap.Bootstrap"];
|
||||
|
||||
Reference in New Issue
Block a user