diff --git a/database/database.sql b/database/database.sql index 03366dd13..424358d00 100644 --- a/database/database.sql +++ b/database/database.sql @@ -121,7 +121,7 @@ INSERT INTO `ospos_employees` (`username`, `password`, `person_id`, `deleted`) V CREATE TABLE `ospos_giftcards` ( `record_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `giftcard_id` int(11) NOT NULL AUTO_INCREMENT, - `giftcard_number` varchar(25) NOT NULL, + `giftcard_number` int(10) NOT NULL, `value` decimal(15,2) NOT NULL, `deleted` int(1) NOT NULL DEFAULT '0', `person_id` INT(10) DEFAULT NULL, diff --git a/test/giftcard_numbering.js b/test/giftcard_numbering.js new file mode 100644 index 000000000..5ca111daf --- /dev/null +++ b/test/giftcard_numbering.js @@ -0,0 +1,40 @@ +var assert = require("assert"); // node.js core module + +describe("giftcard numbering test", function () { + + var server = "http://localhost/pos"; + + var url = function url(suffix) { + return server + suffix + "?XDEBUG_SESSION_START=ECLIPSE_DBGP&KEY=14241668456852'"; + }; + + it("should be able to login", function (done) { + return this.browser.get(url("/index.php")) + .elementByName('username').type("admin").getValue() + .then(function(value) { + assert.equal(value, "admin"); + }) + .elementByName('password').type("pointofsale").getValue() + .then(function(value) { + assert.ok(value, "pointofsale"); + }) + .elementByName('loginButton').click() + .elementById('home_module_list').then(function(value) { + assert.ok(value, "Login failed!!") + }) + .then(done, done); + + }); + + it("issue #65: giftcard numbering should add properly", function() { + return this.browser.get(url("/index.php/giftcards")).waitForElementByCss(".big_button").click() + .waitForElementByName("value").type("100").elementById('giftcard_number').clear().type("10") + .elementById("submit").click().waitForElementByXPath("//table/tbody/tr[td/text()='10']/td[4]").text().then(function (value) { + assert.ok(value, "giftcard failed to be added properly!"); + }).elementByCss(".big_button").click().waitForElementByName("value").type("100").elementById("submit").click() + .waitForElementByXPath("//table/tbody/tr[td/text()='11']/td[4]").text().then(function (value) { + assert.equal(value, "11", "giftcard number not incrementing properly!!"); + }); + }); + +}); diff --git a/test/login.js b/test/login.js index 0a1890a36..35c6961ce 100644 --- a/test/login.js +++ b/test/login.js @@ -1,26 +1,3 @@ -var assert = require("assert"); // node.js core module +exports.loginFirst = function() { -describe("giftcard numbering test", function () { - - it("giftcard numbering should increment", function (done) { - - var searchBox; - var browser = this.browser; - browser.get('http://localhost/pos/index.php?XDEBUG_SESSION_START=ECLIPSE_DBGP&KEY=14241668456852') - .elementByName('username').type("admin").getValue() - .then(function(value) { - assert.equal(value, "admin"); - }) - .elementByName('password').type("pointofsale").getValue() - .then(function(value) { - assert.ok(value, "pointofsale"); - }) - .elementByName('loginButton').click() - .elementById('home_module_list').then(function(value) { - assert.ok(value, "Login failed!!") - }) - .then(done, done); - - }); - -}); +} \ No newline at end of file diff --git a/travis-ci-apache b/travis-ci-apache index 364d1fa4f..4c93d795e 100644 --- a/travis-ci-apache +++ b/travis-ci-apache @@ -1,3 +1,4 @@ +Alias /pos %TRAVIS_BUILD_DIR% DocumentRoot %TRAVIS_BUILD_DIR%