mirror of
https://github.com/opensourcepos/opensourcepos.git
synced 2026-10-20 07:14:33 -04:00
Merge remote-tracking branch 'jekkos/develop/2.4' into ci3
This commit is contained in:
commit
d07ed0c09f
7 files changed
+88
-42
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 "while ! curl http://localhost/index.php | grep username; do sleep 1; done; cd app && grunt mochaWebdriver:test"
|
||||
+3
-3
@@ -1,8 +1,9 @@
|
||||
FROM ubuntu:trusty
|
||||
FROM ubuntu:utopic
|
||||
MAINTAINER jekkos
|
||||
RUN sed -i -e 's/archive.ubuntu.com\|security.ubuntu.com/old-releases.ubuntu.com/g' /etc/apt/sources.list
|
||||
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 curl
|
||||
RUN easy_install supervisor
|
||||
ADD ./docker/foreground.sh /etc/apache2/foreground.sh
|
||||
ADD ./docker/supervisord.conf /etc/supervisord.conf
|
||||
@@ -20,7 +21,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 rm /var/www/html/index.html
|
||||
ADD ./docker/start_container.sh /start_container.sh
|
||||
RUN chmod 755 /start_container.sh
|
||||
EXPOSE 80 3306
|
||||
|
||||
@@ -73,7 +73,7 @@ class Customers extends Person_controller
|
||||
);
|
||||
$customer_data=array(
|
||||
'account_number'=>$this->input->post('account_number') == '' ? null : $this->input->post('account_number'),
|
||||
'company_name'=>$this->input->post('company_name') == '' ? null : $this->input->post('account_number'),
|
||||
'company_name'=>$this->input->post('company_name') == '' ? null : $this->input->post('company_name'),
|
||||
'taxable'=>$this->input->post('taxable') != null
|
||||
);
|
||||
if($this->Customer->save_customer($person_data,$customer_data,$customer_id))
|
||||
|
||||
@@ -512,14 +512,16 @@ class CI_Pagination {
|
||||
{
|
||||
$this->cur_page = str_replace(array($this->prefix, $this->suffix), '', $this->cur_page);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$this->cur_page = (string) $this->cur_page;
|
||||
}
|
||||
|
||||
// If something isn't quite right, back to the default base page.
|
||||
if ( ! ctype_digit($this->cur_page) OR ($this->use_page_numbers && (int) $this->cur_page === 0))
|
||||
{
|
||||
$this->cur_page = $base_page;
|
||||
}
|
||||
else
|
||||
elseif (empty($this->cur_page))
|
||||
{
|
||||
// Make sure we're using integers for comparisons later.
|
||||
$this->cur_page = (int) $this->cur_page;
|
||||
|
||||
+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) {
|
||||
|
||||
+31
-17
@@ -10,24 +10,38 @@ var ospos = function() {
|
||||
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);
|
||||
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);
|
||||
|
||||
},
|
||||
|
||||
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!!");
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = ospos();
|
||||
module.exports = ospos();
|
||||
@@ -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