From 15493ae58e53035a0d9e357621583d42c3608564 Mon Sep 17 00:00:00 2001 From: jekkos Date: Sun, 17 May 2015 22:36:00 +0200 Subject: [PATCH 1/3] Set correct url --- test/login.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/login.js b/test/login.js index 0a1890a36..aab5aaf70 100644 --- a/test/login.js +++ b/test/login.js @@ -6,7 +6,7 @@ describe("giftcard numbering test", function () { var searchBox; var browser = this.browser; - browser.get('http://localhost/pos/index.php?XDEBUG_SESSION_START=ECLIPSE_DBGP&KEY=14241668456852') + browser.get('http://localhost/index.php?XDEBUG_SESSION_START=ECLIPSE_DBGP&KEY=14241668456852') .elementByName('username').type("admin").getValue() .then(function(value) { assert.equal(value, "admin"); From 3936f2dcf37ba0873c8dc7a2f05913cc7c6b82c2 Mon Sep 17 00:00:00 2001 From: jekkos Date: Wed, 20 May 2015 18:35:10 +0200 Subject: [PATCH 2/3] Add giftcard numbering test --- test/giftcard_numbering.js | 43 ++++++++++++++++++++++++++++++++++++++ test/login.js | 26 ----------------------- 2 files changed, 43 insertions(+), 26 deletions(-) create mode 100644 test/giftcard_numbering.js delete mode 100644 test/login.js diff --git a/test/giftcard_numbering.js b/test/giftcard_numbering.js new file mode 100644 index 000000000..a799cd51a --- /dev/null +++ b/test/giftcard_numbering.js @@ -0,0 +1,43 @@ +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); + + }); + + for (var i=1; i < 12; i++) { + + var evaluate = (function(i, browser) { + return function() { + return this.browser.get(url("/index.php/giftcards")).waitForElementByCss(".big_button").click() + .waitForElementByName("value").type("100") + .elementById("submit").click().waitForElementById("giftcard_" + i, 100, 2000).then(function(value) { + assert.ok(value, "Giftcard failed to be added properly!"); + }); + }})(i); + it("gitftcard numbering should add up fine " + i, evaluate); + } + + +}); diff --git a/test/login.js b/test/login.js deleted file mode 100644 index aab5aaf70..000000000 --- a/test/login.js +++ /dev/null @@ -1,26 +0,0 @@ -var assert = require("assert"); // node.js core module - -describe("giftcard numbering test", function () { - - it("giftcard numbering should increment", function (done) { - - var searchBox; - var browser = this.browser; - browser.get('http://localhost/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); - - }); - -}); From 1ad08c014f766acd3a3f991a02b54a3885461607 Mon Sep 17 00:00:00 2001 From: jekkos Date: Thu, 21 May 2015 22:00:14 +0200 Subject: [PATCH 3/3] Fix giftcard numbering issue #65 --- database/database.sql | 2 +- test/giftcard_numbering.js | 23 ++++++++++------------- test/login.js | 3 +++ travis-ci-apache | 1 + 4 files changed, 15 insertions(+), 14 deletions(-) create mode 100644 test/login.js 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 index a799cd51a..5ca111daf 100644 --- a/test/giftcard_numbering.js +++ b/test/giftcard_numbering.js @@ -26,18 +26,15 @@ describe("giftcard numbering test", function () { }); - for (var i=1; i < 12; i++) { - - var evaluate = (function(i, browser) { - return function() { - return this.browser.get(url("/index.php/giftcards")).waitForElementByCss(".big_button").click() - .waitForElementByName("value").type("100") - .elementById("submit").click().waitForElementById("giftcard_" + i, 100, 2000).then(function(value) { - assert.ok(value, "Giftcard failed to be added properly!"); - }); - }})(i); - it("gitftcard numbering should add up fine " + i, evaluate); - } - + 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 new file mode 100644 index 000000000..35c6961ce --- /dev/null +++ b/test/login.js @@ -0,0 +1,3 @@ +exports.loginFirst = function() { + +} \ 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%