cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sgreb...@apache.org
Subject cordova-plugin-geolocation git commit: CB-10286 Don't skip automatic tests on Android devices
Date Tue, 05 Jan 2016 05:55:48 GMT
Repository: cordova-plugin-geolocation
Updated Branches:
  refs/heads/master a818d6dcc -> ed5bfa42d


CB-10286 Don't skip automatic tests on Android devices

github close #65


Project: http://git-wip-us.apache.org/repos/asf/cordova-plugin-geolocation/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugin-geolocation/commit/ed5bfa42
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-geolocation/tree/ed5bfa42
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-geolocation/diff/ed5bfa42

Branch: refs/heads/master
Commit: ed5bfa42dbdd23dc7364b2ed3562ed1bb8d0a595
Parents: a818d6d
Author: Alexander Sorokin <alexander.sorokin@akvelon.com>
Authored: Thu Dec 31 14:26:33 2015 +0300
Committer: sgrebnov <v-segreb@microsoft.com>
Committed: Tue Jan 5 08:55:04 2016 +0300

----------------------------------------------------------------------
 tests/plugin.xml |  1 +
 tests/tests.js   | 36 +++++++++++++++---------------------
 2 files changed, 16 insertions(+), 21 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugin-geolocation/blob/ed5bfa42/tests/plugin.xml
----------------------------------------------------------------------
diff --git a/tests/plugin.xml b/tests/plugin.xml
index 592eec9..de76b83 100644
--- a/tests/plugin.xml
+++ b/tests/plugin.xml
@@ -26,6 +26,7 @@
     <name>Cordova Geolocation Plugin Tests</name>
     <license>Apache 2.0</license>
 
+    <dependency id="cordova-plugin-device" url="https://github.com/apache/cordova-plugin-device"
/>
     <js-module src="tests.js" name="tests">
     </js-module>
 </plugin>

http://git-wip-us.apache.org/repos/asf/cordova-plugin-geolocation/blob/ed5bfa42/tests/tests.js
----------------------------------------------------------------------
diff --git a/tests/tests.js b/tests/tests.js
index 3566211..65a9c69 100644
--- a/tests/tests.js
+++ b/tests/tests.js
@@ -55,8 +55,16 @@ exports.defineAutoTests = function () {
         });
     };
 
+    // On Windows, some tests prompt user for permission to use geolocation and interrupt
autotests run
     var isWindowsStore = (cordova.platformId == "windows8") || (cordova.platformId == "windows"
&& !WinJS.Utilities.isPhone);
-    var isAndroid = cordova.platformId == "android";
+    var majorDeviceVersion = null;
+    var versionRegex = /(\d)\..+/.exec(device.version);
+    if (versionRegex !== null) {
+        majorDeviceVersion = Number(versionRegex[1]);
+    }
+    // Starting from Android 6.0 there are confirmation dialog which prevents us from running
auto tests in silent mode (user interaction needed)
+    // Also, Android emulator doesn't provide geo fix without manual interactions or mocks
+    var skipAndroid = cordova.platformId == "android" && (device.isVirtual || majorDeviceVersion
>= 6);
     var isIOSSim = false; // if iOS simulator does not have a location set, it will fail.
 
 
@@ -88,10 +96,7 @@ exports.defineAutoTests = function () {
         describe('error callback', function () {
 
             it("geolocation.spec.5 should be called if we set timeout to 0 and maximumAge
to a very small number", function (done) {
-                // On Windows, this test prompts user for permission to use geolocation and
interrupts autotests running.
-                // On Android geolocation Api is not available on emulator so we pended tests
until we found the way to detect
-                // whether we run on emulator or real device from JavaScript. You can still
run the tests on Android manually.
-                if (isWindowsStore || isAndroid) {
+                if (isWindowsStore || skipAndroid) {
                     pending();
                 }
 
@@ -105,8 +110,7 @@ exports.defineAutoTests = function () {
             });
 
             it("geolocation.spec.9 on failure should return PositionError object with error
code constants", function (done) {
-                // On Windows, this test prompts user for permission to use geolocation and
interrupts autotests running.
-                if (isWindowsStore) {
+                if (isWindowsStore || skipAndroid) {
                     pending();
                 }
 
@@ -130,10 +134,7 @@ exports.defineAutoTests = function () {
         describe('success callback', function () {
 
             it("geolocation.spec.6 should be called with a Position object", function (done)
{
-                // On Windows, this test prompts user for permission to use geolocation and
interrupts autotests running.
-                // On Android geolocation Api is not available on emulator so we pended tests
until we found the way to detect
-                // whether we run on emulator or real device from JavaScript. You can still
run the tests on Android manually.
-                if (isWindowsStore || isAndroid) {
+                if (isWindowsStore || skipAndroid) {
                     pending();
                 }
 
@@ -178,10 +179,7 @@ exports.defineAutoTests = function () {
             });
 
             it("geolocation.spec.7 should be called if we set timeout to 0 and maximumAge
to a very small number", function (done) {
-                // On Windows, this test prompts user for permission to use geolocation and
interrupts autotests running.
-                // On Android geolocation Api is not available on emulator so we pended tests
until we found the way to detect
-                // whether we run on emulator or real device from JavaScript. You can still
run the tests on Android manually.
-                if (isWindowsStore || isAndroid) {
+                if (isWindowsStore || skipAndroid) {
                     pending();
                 }
 
@@ -196,8 +194,7 @@ exports.defineAutoTests = function () {
             });
 
             it("geolocation.spec.10 on failure should return PositionError object with error
code constants", function (done) {
-                // On Windows, this test prompts user for permission to use geolocation and
interrupts autotests running.
-                if (isWindowsStore) {
+                if (isWindowsStore || skipAndroid) {
                     pending();
                 }
 
@@ -231,10 +228,7 @@ exports.defineAutoTests = function () {
             });
 
             it("geolocation.spec.8 should be called with a Position object", function (done)
{
-                // On Windows, this test prompts user for permission to use geolocation and
interrupts autotests running.
-                // On Android geolocation Api is not available on emulator so we pended tests
until we found the way to detect
-                // whether we run on emulator or real device from JavaScript. You can still
run the tests on Android manually.
-                if (isWindowsStore || isAndroid || isIOSSim) {
+                if (isWindowsStore || skipAndroid || isIOSSim) {
                     pending();
                 }
 


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org


Mime
View raw message