diff --git a/.travis.yml b/.travis.yml index 586044f17..4ba69aeaf 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,7 +11,7 @@ services: before_install: - docker build -t jekkos/opensourcepos . - docker run -d -p 127.0.0.1:80:80 jekkos/opensourcepos - - sleep 10 + - sleep 4 script: - docker exec -t -i $(docker ps | tail -n 1 | cut -d' ' -f1) /bin/sh -c "cd /app; grunt mochaWebdriver:test" diff --git a/Dockerfile b/Dockerfile index adc2ea166..2befc5538 100644 --- a/Dockerfile +++ b/Dockerfile @@ -20,7 +20,6 @@ RUN npm install -g grunt-cli RUn ln -s /usr/local/bin/grunt /usr/bin/grunt RUN ln -fs /app/* /var/www/html -RUN ln -s /app /var/www/html/pos ADD ./docker/start_container.sh /start_container.sh RUN chmod 755 /start_container.sh EXPOSE 80 3306 diff --git a/test/giftcard_numbering.js b/test/giftcard_numbering.js index 40bb2caeb..8eb3e54fd 100644 --- a/test/giftcard_numbering.js +++ b/test/giftcard_numbering.js @@ -1,34 +1,16 @@ var assert = require("assert"); // node.js core module +var ospos = require("./ospos"); 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'"; - }; + this.timeout(25000); 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); - + return ospos.login(this.browser, done); }); - it.skip("issue #65: giftcard numbering should add properly", function() { - return this.browser.get(url("/index.php/giftcards")).waitForElementByCss(".big_button").click() - .waitForElementByName("value", 4000).type("100").elementById('giftcard_number').clear().type("10") + it("issue #65: giftcard numbering should add properly", function() { + return this.browser.get(ospos.url("/index.php/giftcards")).waitForElementByCss(".big_button").click() + .waitForElementByName("value", 10000).type("100").elementById('giftcard_number').clear().type("10") .elementById("submit").click().waitForElementByXPath("//table/tbody/tr[td/text()='10']/td[4]", 2000).text().then(function (value) { assert.ok(value, "giftcard failed to be added properly!"); }).elementByCss(".big_button").click().waitForElementByName("value", 4000).type("100").elementById("submit").click() diff --git a/test/login.js b/test/login.js deleted file mode 100644 index 35c6961ce..000000000 --- a/test/login.js +++ /dev/null @@ -1,3 +0,0 @@ -exports.loginFirst = function() { - -} \ No newline at end of file diff --git a/test/make_sale.js b/test/make_sale.js new file mode 100644 index 000000000..b63620330 --- /dev/null +++ b/test/make_sale.js @@ -0,0 +1,13 @@ +var assert = require('assert'); +var ospos = require('./ospos'); + +describe("create item", function () { + + it("should be able to add new item", function (done) { + return this.browser.get(ospos.url("/index.php/items")).waitForElement("a[title='New Item']", 5000).click() + .waitForElementByName("name", 10000).type("anItem").elementById('cost_price', 2000).clear().type("10").elementById("unit_price", 2000).type("20") + .elementById('tax_name_1', 2000).type('VAT').elementById("tax_percent_name_1", 2000).type("21") + .elementById("1_quantity", 2000).type("1").elementById("reorder_level", 2000).type("0").elementById("submit", 2000).click(); + }); + +}); \ No newline at end of file diff --git a/test/ospos.js b/test/ospos.js new file mode 100644 index 000000000..5d9d023ba --- /dev/null +++ b/test/ospos.js @@ -0,0 +1,33 @@ +var assert = require('assert'); + +var ospos = function() { + + var server = "http://localhost"; + + return { + + url : function(suffix) { + return server + suffix; + } + , + login : function(browser, done) { + return browser.get(this.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); + + } + } +}; + +module.exports = ospos(); \ No newline at end of file diff --git a/travis-ci-apache b/travis-ci-apache deleted file mode 100644 index 4c93d795e..000000000 --- a/travis-ci-apache +++ /dev/null @@ -1,21 +0,0 @@ -Alias /pos %TRAVIS_BUILD_DIR% - - - DocumentRoot %TRAVIS_BUILD_DIR% - - - Options FollowSymLinks MultiViews ExecCGI - AllowOverride All - Order deny,allow - Allow from all - - - # Wire up Apache to use Travis CI's php-fpm. - - AddHandler php5-fcgi .php - Action php5-fcgi /php5-fcgi - Alias /php5-fcgi /usr/lib/cgi-bin/php5-fcgi - FastCgiExternalServer /usr/lib/cgi-bin/php5-fcgi -host 127.0.0.1:9000 -pass-header Authorization - - -