mirror of
https://github.com/opensourcepos/opensourcepos.git
synced 2026-10-23 08:38:37 -04:00
Wait for container before running integration tests (#305)
Add integratoin test for quantity units (#305)
This commit is contained in:
1 parent
85c6da4346
commit
8f9d80a809
5 files changed
+68
-24
No files matched your search
+6
-4
@@ -1,14 +1,16 @@
|
||||
sudo: false
|
||||
|
||||
|
||||
language: node_js
|
||||
|
||||
node_js:
|
||||
- "4.1"
|
||||
|
||||
services:
|
||||
- docker
|
||||
|
||||
before_install:
|
||||
- docker build -t jekkos/opensourcepos .
|
||||
- docker run -d -p 127.0.0.1:80:80 jekkos/opensourcepos
|
||||
- sleep 4
|
||||
- docker run -d jekkos/opensourcepos
|
||||
|
||||
script:
|
||||
- docker exec -t -i $(docker ps | tail -n 1 | cut -d' ' -f1) /bin/sh -c "cd /app; grunt mochaWebdriver:test"
|
||||
- docker exec -t -i $(docker ps | tail -n 1 | cut -d' ' -f1) /bin/sh -c "wget --retry-connrefused --tries=5 -q --waitretry=3 --spider http://localhost/index.php && cd /app && grunt mochaWebdriver:test"
|
||||
+1
-1
@@ -2,7 +2,7 @@ FROM ubuntu:trusty
|
||||
MAINTAINER jekkos
|
||||
RUN apt-get update
|
||||
RUN apt-get -y upgrade
|
||||
RUN DEBIAN_FRONTEND=noninteractive apt-get -y install mysql-client mysql-server apache2 libapache2-mod-php5 pwgen python-setuptools vim-tiny php5-mysql php5-gd nodejs npm
|
||||
RUN DEBIAN_FRONTEND=noninteractive apt-get -y install mysql-client mysql-server apache2 libapache2-mod-php5 pwgen python-setuptools vim-tiny php5-mysql php5-gd nodejs npm wget
|
||||
RUN easy_install supervisor
|
||||
ADD ./docker/foreground.sh /etc/apache2/foreground.sh
|
||||
ADD ./docker/supervisord.conf /etc/supervisord.conf
|
||||
|
||||
+12
-15
@@ -4,26 +4,23 @@ var ospos = require('./ospos');
|
||||
describe("create item and make sale", function () {
|
||||
this.timeout(25000);
|
||||
|
||||
var def_timeout = 3000;
|
||||
|
||||
var item = {name: "anItem", category: "aCategory", cost_price: 10, unit_price: 20};
|
||||
|
||||
it("should be able to add item", function (done) {
|
||||
return this.browser.get(ospos.url("/index.php/items")).elementByCssSelector("a[title='New Item']", 5000).click()
|
||||
.waitForElementByName("name", 10000).type("anItem").elementById("category").type("aCategory")
|
||||
.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()
|
||||
.waitForElementByXPath("//table/tbody/tr[td/text()='anItem']/td[3]").text().then(function (value) {
|
||||
assert.equal(value, "anItem", "item could not be created!!");
|
||||
}).then(done, done);
|
||||
return ospos.create_item(this.browser, item).then(done, done);
|
||||
});
|
||||
|
||||
it("should be able to make sale", function(done) {
|
||||
return this.browser.get(ospos.url("/index.php/sales"))
|
||||
.elementById("item", 3000).type("1\r\n")
|
||||
.waitForElementByName("quantity", 5000).clear().type("2").elementByName("discount", 1000).type("10").elementByName("edit_item").click()
|
||||
.elementById("add_payment_button", 2000).click().elementByCssSelector("tbody#payment_contents tr td:last-child", 5000).text().then(function(value) {
|
||||
.elementById("item", def_timeout).type("1\r\n")
|
||||
.waitForElementByName("quantity", def_timeout).clear().type("2").elementByName("discount", def_timeout).type(item.cost_price).elementByName("edit_item").click()
|
||||
.elementById("add_payment_button", def_timeout).click().elementByCssSelector("tbody#payment_contents tr td:last-child", def_timeout).text().then(function(value) {
|
||||
assert.equal(value, "$43.56", "price " + value + " in sale register is not correct!!");
|
||||
}).elementById("finish_sale_button", 3000).submit().elementByCssSelector("#receipt_items tbody tr:nth-child(7) td:last-child", 5000).text().then(function(value) {
|
||||
}).elementById("finish_sale_button", def_timeout).submit().elementByCssSelector("#receipt_items tbody tr:nth-child(7) td:last-child", def_timeout).text().then(function(value) {
|
||||
assert.equal(value, "$43.56", "price " + value + " on sale receipt is not correct!!");
|
||||
}).elementByCssSelector("#receipt_items tbody tr:nth-child(9) td:last-child div.total-value", 5000).text().then(function(value) {
|
||||
}).elementByCssSelector("#receipt_items tbody tr:nth-child(9) td:last-child div.total-value", def_timeout).text().then(function(value) {
|
||||
assert.equal(value, "-$43.56", "payment amount " + value + " on sale receipt is not correct!!")
|
||||
}).then(done, done);
|
||||
});
|
||||
@@ -31,8 +28,8 @@ describe("create item and make sale", function () {
|
||||
|
||||
it("should be able to make receiving", function(done) {
|
||||
return this.browser.get(ospos.url("/index.php/receivings"))
|
||||
.elementById("item", 3000).type("1\r\n")
|
||||
.waitForElementByName("quantity", 3000).clear().type("2").elementByName("edit_item").click()
|
||||
.elementById("item", def_timeout).type("1\r\n")
|
||||
.waitForElementByName("quantity", def_timeout).clear().type("2").elementByName("edit_item").click()
|
||||
.elementByCssSelector("td:nth-last-child(2)").text().then(function(value) {
|
||||
assert.equal(value, "$20.00", "price " + value + " in receiving register is not correct!!");
|
||||
}).elementById("finish_receiving_button").submit().elementByCssSelector("#receipt_items tbody tr:nth-last-child(2) td:nth-child(2) div.total-value").text().then(function(value) {
|
||||
|
||||
+18
-4
@@ -2,7 +2,7 @@ var assert = require('assert');
|
||||
|
||||
var ospos = function() {
|
||||
|
||||
var server = "http://localhost";
|
||||
var server = "http://localhost/index.php";
|
||||
|
||||
return {
|
||||
|
||||
@@ -13,20 +13,34 @@ var ospos = function() {
|
||||
login : function(browser, done) {
|
||||
return browser.get(this.url("/index.php"))
|
||||
.elementByName('username').type("admin").getValue()
|
||||
.then(function(value) {
|
||||
.then(function (value) {
|
||||
assert.equal(value, "admin");
|
||||
})
|
||||
.elementByName('password').type("pointofsale").getValue()
|
||||
.then(function(value) {
|
||||
.then(function (value) {
|
||||
assert.ok(value, "pointofsale");
|
||||
})
|
||||
.elementByName('loginButton').click()
|
||||
.elementById('home_module_list').then(function(value) {
|
||||
.elementById('home_module_list').then(function (value) {
|
||||
assert.ok(value, "Login failed!!")
|
||||
})
|
||||
.then(done, done);
|
||||
|
||||
},
|
||||
|
||||
create_item : function(browser, item)
|
||||
{
|
||||
return browser.get(this.url("/index.php/items")).elementByCssSelector("a[title='New Item']", 5000).click()
|
||||
.waitForElementByName("name", 10000).type(item.name).elementById("category").type(item.category)
|
||||
.elementById('cost_price', 2000).clear().type(item.cost_price).elementById("unit_price", 2000).type(item.unit_price)
|
||||
.elementById('tax_name_1', 2000).type('VAT').elementById("tax_percent_name_1", 2000).type("21")
|
||||
.elementById('receiving_quantity', 2000).type(item.receiving_quantity || 1)
|
||||
.elementById("1_quantity", 2000).type("1").elementById("reorder_level", 2000).type("0").elementById("submit", 2000).click()
|
||||
.waitForElementByXPath("//table/tbody/tr[td/text()='anItem']/td[3]").text().then(function (value) {
|
||||
assert.equal(value, "anItem", "item " + item.name + " could not be created!!");
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
var assert = require('assert');
|
||||
var ospos = require('./ospos');
|
||||
|
||||
describe("test receiving quantity", function() {
|
||||
|
||||
var def_timeout = 5000;
|
||||
|
||||
var item = {
|
||||
name: "recvQty",
|
||||
category: "aCategory",
|
||||
cost_price: 10,
|
||||
unit_price: 20,
|
||||
receiving_quantity: 2
|
||||
};
|
||||
|
||||
it("should be able to creaate item with receiving quantity", function(done) {
|
||||
return ospos.create_item(this.browser, item).then(done, done);
|
||||
});
|
||||
|
||||
it("should be able to receive quantities with multiplier", function(done) {
|
||||
this.browser.get(ospos.url('/index.php/receivings')).elementById("item").type(item.name)
|
||||
.waitForElementByCssSelector(".ac_even", def_timeout).click().waitForElementByName("quantity", def_timeout)
|
||||
.elementByCssSelector("#cart_contents tr td:nth-child(5)").text().then(function(value) {
|
||||
assert(value, "x " + item.receiving_quantity, "receiving quantity " + item.receiving_quantity + " is not displayed correctly in receivings module!");
|
||||
}).elementById("finish_receiving_button", def_timeout).submit()
|
||||
.elementByCssSelector("#receipt_items tr:nth-child(2) td:nth-last-child(2)", def_timeout).text().then(function(value) {
|
||||
assert(value, "1 x " + item.receiving_quantity, "receiving quantity " + item.receiving_quantity + " is not displayed correctly on receipt!!");
|
||||
}).then(done, done);
|
||||
});
|
||||
|
||||
});
|
||||
Reference in new issue
Block a user