From 31010a4cb699d92c1d331837d89c03a9da64ab5a Mon Sep 17 00:00:00 2001 From: Chris Brody Date: Tue, 12 May 2015 12:10:52 +0200 Subject: [PATCH] Run simple-test.js in CircleCI (Android) & TravisCI (iOS) and legacy.js in CircleCI (Android) --- .travis.yml | 3 ++- circle.yml | 4 +++ spec/www/index.html | 1 + spec/www/spec/browser-check-startup.js | 33 +++++++++++++++++++++++++ spec/www/spec/legacy.js | 10 +++++--- spec/www/spec/simple-test.js | 34 ++++++++++---------------- 6 files changed, 60 insertions(+), 25 deletions(-) create mode 100644 spec/www/spec/browser-check-startup.js diff --git a/.travis.yml b/.travis.yml index bb429ab19..db9638d42 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,9 +5,10 @@ node_js: - "0.10" install: - echo -e "Host github.com\n\tStrictHostKeyChecking no\n" >> ~/.ssh/config - - cd .. - npm install -g cordova-paramedic - npm install -g cordova - npm install -g ios-sim script: + - cordova-paramedic --platform ios --plugin ${TRAVIS_BUILD_DIR} + - cp ${TRAVIS_BUILD_DIR}/spec/www/spec/simple-test.js ${TRAVIS_BUILD_DIR}/tests/tests.js - cordova-paramedic --platform ios --plugin ${TRAVIS_BUILD_DIR} --timeout 3600000 diff --git a/circle.yml b/circle.yml index bb0b4c87f..d8e935805 100644 --- a/circle.yml +++ b/circle.yml @@ -15,3 +15,7 @@ test: - circle-android wait-for-boot override: - cordova-paramedic --platform android --plugin . + - cp spec/www/spec/simple-test.js tests/tests.js + - cordova-paramedic --platform android --plugin . --timeout 3600000 + - cp spec/www/spec/legacy.js tests/tests.js + - cordova-paramedic --platform android --plugin . --timeout 7200000 diff --git a/spec/www/index.html b/spec/www/index.html index 89acb0981..916f455a7 100644 --- a/spec/www/index.html +++ b/spec/www/index.html @@ -19,6 +19,7 @@ + diff --git a/spec/www/spec/browser-check-startup.js b/spec/www/spec/browser-check-startup.js new file mode 100644 index 000000000..be0a4938a --- /dev/null +++ b/spec/www/spec/browser-check-startup.js @@ -0,0 +1,33 @@ +/* 'use strict'; */ + +var MYTIMEOUT = 12000; + +var isAndroid = /Android/.test(navigator.userAgent); +var isWP8 = /IEMobile/.test(navigator.userAgent); // Matches WP(7/8/8.1) +//var isWindows = /Windows NT/.test(navigator.userAgent); // Windows [NT] (8.1) +var isWindows = /Windows /.test(navigator.userAgent); // Windows (8.1) +//var isWindowsPC = /Windows NT/.test(navigator.userAgent); // Windows [NT] (8.1) +//var isWindowsPhone_8_1 = /Windows Phone 8.1/.test(navigator.userAgent); // Windows Phone 8.1 +//var isIE = isWindows || isWP8 || isWindowsPhone_8_1; +var isIE = isWindows || isWP8; +var isWebKit = !isIE; // TBD [Android or iOS] + +window.hasBrowser = true; +window.hasWebKitBrowser = isWebKit; + +describe('check startup', function() { + it('receives deviceready event', function(done) { + expect(true).toBe(true); + document.addEventListener("deviceready", function() { + done(); + }); + }, MYTIMEOUT); + + it('has openDatabase', function() { + if (isWebKit) expect(window.openDatabase).toBeDefined(); + expect(window.sqlitePlugin).toBeDefined(); + expect(window.sqlitePlugin.openDatabase).toBeDefined(); + }); +}); + +/* vim: set expandtab : */ diff --git a/spec/www/spec/legacy.js b/spec/www/spec/legacy.js index 5d050ac50..9989d2e4e 100755 --- a/spec/www/spec/legacy.js +++ b/spec/www/spec/legacy.js @@ -42,9 +42,10 @@ var isWebKit = !isIE; // TBD [Android or iOS] var scenarioList = [ 'Plugin', 'HTML5' ]; -var scenarioCount = isWebKit ? 2 : 1; +var scenarioCount = (!!window.hasWebKitBrowser) ? 2 : 1; -describe('legacy tests', function() { +// legacy tests: +var mytests = function() { for (var i=0; i