Skip to content

Commit

Permalink
Update Ti.UI.Layout tests (tidev#8127)
Browse files Browse the repository at this point in the history
* Backport tests to common suite

* Update Ti.UI.Layout tests

* Fix typo

* try to hook postlayout listeners on view involved when single view has assertions, cine Window doesn't fire that event.

* Keep tweaking tests

* Add new scons command to run unit tests locally

* Update tests so they pass (or are skipped) locally for Android.

* Skip another test

* Keep skipping tests

* Keep tweaking tests

* Keep tweaking tests

* Keep tweaking tests

* Keep tweaking tests
  • Loading branch information
sgtcoolguy committed Jul 15, 2016
1 parent 02620f7 commit c245800
Show file tree
Hide file tree
Showing 18 changed files with 4,275 additions and 469 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ apidoc/node_modules/*

support/ti_mocha_script/testApp

/titanium-mobile-mocha-suite

# intelliJ Android User-specific configurations
android/.idea/libraries/
android/.idea/workspace.xml
Expand Down
98 changes: 98 additions & 0 deletions build/scons-test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
#!/usr/bin/env node

var exec = require('child_process').exec,
os = require('os'),
path = require('path'),
async = require('async'),
program = require('commander'),
fs = require('fs-extra'),
version = require('../package.json').version,
platforms = [],
osName = os.platform(),
zipfile,
ALL_PLATFORMS = ['ios', 'android'],
MOCHA_TESTS_DIR = path.join(__dirname, '..', 'titanium-mobile-mocha-suite'),
DIST_DIR = path.join(__dirname, '..', 'dist'),
LOCAL_TESTS = path.join(__dirname, '..', 'tests');

program.parse(process.argv);

platforms = program.args;

if (!platforms.length) {
// assume all!
platforms = ['full'];
}

// expand 'full' to every platform
if (platforms.length === 1 && platforms[0] == 'full') {
platforms = ['ios', 'android'];
}

// FIXME Assume the zipfile is just uisng the base SDK version and not a version tag
if (osName === 'darwin') {
osName = 'osx';
}
zipfile = path.join(DIST_DIR, 'mobilesdk-' + version + '-' + osName + '.zip');
if (!fs.existsSync(zipfile)) {
console.error("Could not find zipped SDK in dist dir: " + zipfile +". Please run node scons.js cleanbuild first.");
process.exit(1);
}

/**
* Wipes and re-clones the mocha common test suite, then runs our unit testing script for the
* SDK zipfile in dist against the supplied platforms.
*
* @param {String[]} platforms [description]
* @param {Function} next [description]
*/
function runTests(platforms, next) {
async.series([
function (cb) {
// If we have a clone of the tests locally, wipe it...
if (fs.existsSync(MOCHA_TESTS_DIR)) {
// TODO Can we instead just do a git clean -fdx in it and then a git pull master?
fs.removeSync(MOCHA_TESTS_DIR);
}
// clone the common test suite shallow
exec('git clone --depth 1 https://github.com/appcelerator/titanium-mobile-mocha-suite.git', { cwd: path.join(__dirname, '..') }, cb);
},
function (cb) {
// Make sure it's dependencies are installed
exec('npm install .', { cwd: path.join(MOCHA_TESTS_DIR, 'scripts') }, cb);
},
function (cb) {
// Copy over the local overrides from tests folder
fs.copy(LOCAL_TESTS, MOCHA_TESTS_DIR, cb);
},
function (cb) {
// Load up the main script
var tests = require(path.join(MOCHA_TESTS_DIR, 'scripts'));
// Run the tests
tests.test(zipfile, platforms, function(err, results) {
if (err) {
return cb(err);
}

// Spit out the results to the console
async.eachSeries(platforms, function (platform, cb1) {
console.log();
console.log('=====================================');
console.log(platform.toUpperCase());
console.log('-------------------------------------');
tests.outputResults(results[platform].results, cb1);
}, cb);
});
}
], next);
}

runTests(platforms, function (err) {
if (err) {
console.error(err.toString());
process.exit(1);
return;
}

process.exit(0);
});
1 change: 1 addition & 0 deletions build/scons.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,6 @@ commander
.command('install', 'install the built SDK')
.command('package [platforms]', 'package one or more platforms')
.command('build [platforms]', 'build one or more platforms')
.command('test [platforms]', 'Runs our unit tests')
.command('update-node-deps', 'deletes and reinstalls node dependencies')
.parse(process.argv);
3 changes: 0 additions & 3 deletions tests/Resources/node_modules/abbrev/CONTRIBUTING.md

This file was deleted.

15 changes: 0 additions & 15 deletions tests/Resources/node_modules/abbrev/LICENSE

This file was deleted.

23 changes: 0 additions & 23 deletions tests/Resources/node_modules/abbrev/README.md

This file was deleted.

62 changes: 0 additions & 62 deletions tests/Resources/node_modules/abbrev/abbrev.js

This file was deleted.

75 changes: 0 additions & 75 deletions tests/Resources/node_modules/abbrev/package.json

This file was deleted.

Loading

0 comments on commit c245800

Please sign in to comment.