var zombieAuth = require('../lib/zombie_auth'),
prepDatabase = require('../lib/prep_database');
- before(function (done) {
- this.timeout(10 * 120 * 1000);
+ describe('xTuple Login', function () {
+ this.timeout(60 * 1000);
- zombieAuth.loadApp({
- refreshLogin: true,
- callback: function () {
- prepDatabase.prepDatabase(done);
- }
+ it('should login', function (done) {
+ zombieAuth.loadApp(done);
});
+
+ it('should prepare database', function (done) {
+ prepDatabase.prepDatabase(done);
+ });
+
});
}());
global.URL = require('url');
var assert = require('assert'),
- zombie = require('zombie'),
+ Browser = require('zombie'),
_ = require('underscore');
(function () {
- "use strict";
var secondsToWait = 40;
}
};
- zombie.visit(host, {runScripts: false, debug: verboseMode}, function (e, browser) {
- if (e) {
- console.log("Zombie visit error: ", e);
- }
- //
- // This is the login screen
- //
- browser
- .fill('id', username)
- .fill('password', password)
- .select('database', database)
- .pressButton('submit', function () {
+ var browser = new Browser({
+ runScripts: false,
+ site: host,
+ maxWait: 30 * 1000
+ });
+
+ browser
+ .visit(host)
+ .then(function (e) {
+ if (e) {
+ console.log("Zombie visit error: ", e);
+ }
+ //
+ // This is the login screen
+ //
+ browser.fill('id', 'admin');
+ browser.fill('password', 'VXalkO2g');
+ browser.select('database', 'xtuple_demo');
+ })
+ .then(function () {
+ browser.runScripts = true;
+ return browser.pressButton('Sign In');
+ })
+ .then(function () {
//
// Plan to give up after a set time
//
+ /*
var timeout = setTimeout(function () {
console.log("App did not fully load");
process.exit(1);
}, secondsToWait * 1000);
+ */
//
// Check frequently to see if the app is loaded, and move forward when it is
//
var interval = setInterval(function () {
+ //console.dir(browser.windows);
if (browser.window.XT && browser.window.XT.app && browser.window.XT.app.state === 6) {
// add the global objects to our global namespace
// clear out both is interval and the I'm-giving-up timeout
// we really want neither to be run again.
clearInterval(interval);
- clearTimeout(timeout);
// give control back to whoever called us
callback();
}
}, 500); // 100 = check to see if the app is loaded every 0.1 seconds
});
- });
};
}());