Uppdate testcase and make them ospos 3.0 compliant

This commit is contained in:
jekkos
2016-05-18 23:02:02 +02:00
parent ea77980bff
commit 2746a0ef03
5 changed files with 26 additions and 21 deletions

View File

@@ -175,7 +175,7 @@ if (isset($error))
}
?>
<td><?php echo to_currency($item['price']*$item['quantity']-$item['price']*$item['quantity']*$item['discount']/100); ?></td>
<td><a href="javascript:document.getElementById('<?php echo 'cart_'.$line ?>').submit();" title=<?php echo $this->lang->line('recvs_update')?> ><span class="glyphicon glyphicon-refresh"></span></a></td>
<td><a href="javascript:document.getElementById('<?php echo 'cart_'.$line ?>').submit();" title=<?php echo $this->lang->line('receivings_update')?> ><span class="glyphicon glyphicon-refresh"></span></a></td>
</tr>
<tr>
<?php

View File

@@ -350,12 +350,12 @@ if (isset($success))
</table>
<div id="payment_details">
<?php echo form_open($controller_name."/add_payment", array('id'=>'add_payment_form', 'class'=>'form-horizontal')); ?>
<?php
// Show Complete sale button instead of Add Payment if there is no amount due left
if( $payments_cover_total )
{
?>
<?php echo form_open($controller_name."/add_payment", array('id'=>'add_payment_form', 'class'=>'form-horizontal')); ?>
<table class="sales_table_100">
<tr>
<td><?php echo $this->lang->line('sales_payment');?></td>
@@ -370,13 +370,15 @@ if (isset($success))
</td>
</tr>
</table>
<?php echo form_close(); ?>
<div class='btn btn-sm btn-success pull-right' id='finish_sale_button' tabindex='<?php echo $tabindex+1; ?>'><span class="glyphicon glyphicon-ok">&nbsp</span><?php echo $this->lang->line('sales_complete_sale'); ?></div>
<?php
}
else
{
?>
<?php echo form_open($controller_name."/add_payment", array('id'=>'add_payment_form', 'class'=>'form-horizontal')); ?>
<table class="sales_table_100">
<tr>
<td><?php echo $this->lang->line('sales_payment');?></td>
@@ -393,10 +395,11 @@ if (isset($success))
</table>
<div class='btn btn-sm btn-success pull-right' id='add_payment_button' tabindex='<?php echo $tabindex+2; ?>'><span class="glyphicon glyphicon-credit-card">&nbsp</span><?php echo $this->lang->line('sales_add_payment'); ?></div>
<?php
<?php echo form_close(); ?>
<?php
}
?>
<?php echo form_close(); ?>
<?php
// Only show this part if there is at least one payment entered.

View File

@@ -11,10 +11,10 @@ describe("giftcard numbering test", function () {
it.skip("issue #65: giftcard numbering should add properly", function(done) {
return this.browser.get(ospos.url("/index.php/giftcards")).waitForElementByCss(".modal-dlg").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) {
.elementById("submit").click().waitForElementByXPath("//table/tbody/tr[td/text()='10']", 2000).text().then(function (value) {
assert.ok(value, "giftcard failed to be added properly!");
}).elementByCss(".modal-dlg").click().waitForElementByName("value", 4000).type("100").elementById("submit").click()
.waitForElementByXPath("//table/tbody/tr[td/text()='11']/td[4]").text().then(function (value) {
}).waitForElementByCss(".modal-dlg").click().waitForElementByName("value", 4000).type("100").elementById("submit").click()
.waitForElementByXPath("//table/tbody/tr[td/text()='11']").text().then(function (value) {
assert.equal(value, "11", "giftcard number not incrementing properly!!");
}).then(done, done);
});

View File

@@ -1,5 +1,6 @@
var assert = require('assert');
var ospos = require('./ospos');
require('wd');
describe("create item and make sale", function () {
this.timeout(25000);
@@ -14,13 +15,13 @@ describe("create item and make sale", function () {
it("should be able to make sale", function(done) {
return this.browser.get(ospos.url("/index.php/sales"))
.elementById("item", def_timeout).type("1\r\n")
.elementById("item", def_timeout).clear().type("1\uE007")
.waitForElementByName("quantity", def_timeout).clear().type("2").elementByName("discount", def_timeout).type(item.cost_price).waitForElementByCss(".glyphicon.glyphicon-refresh").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", def_timeout).submit().elementByCssSelector("#receipt_items tbody tr:nth-child(7) td:last-child", def_timeout).text().then(function(value) {
}).elementById("finish_sale_button", def_timeout).click().elementByCssSelector("#receipt_items tbody tr:nth-child(8) 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", def_timeout).text().then(function(value) {
}).elementByCssSelector("#receipt_items tbody tr:nth-child(10) td:last-child", def_timeout).text().then(function(value) {
assert.equal(value, "-$43.56", "payment amount " + value + " on sale receipt is not correct!!")
}).then(done, done);
});
@@ -28,11 +29,11 @@ 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", def_timeout).type("1\r\n")
.waitForElementByName("quantity", def_timeout).clear().type("2").elementByName("edit_item").click()
.elementById("item", def_timeout).clear().type("1\uE007")
.waitForElementByName("quantity", def_timeout).clear().type("2").elementByCssSelector("a[title='Update']").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) {
}).elementById("finish_receiving_button").click().elementByCssSelector("#receipt_items tbody tr:nth-last-child(2) td:nth-child(2) div.total-value").text().then(function(value) {
assert.equal(value, "$20.00", "price " + value + " on receiving receipt is not correct!!");
})
.then(done, done);

View File

@@ -30,17 +30,18 @@ var ospos = function() {
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)
return browser.get(this.url("/index.php/items")).elementByCssSelector("button[title*='New Item']", 5000).click()
.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("name", 10000).type(item.name)
.elementById("category", 2000).clear().type(item.category)
.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!!");
.elementById("quantity_1", 2000).type("1").elementById("reorder_level", 2000).type("0").elementById("submit", 2000).click()
.waitForElementByXPath("//table/tbody/tr[td/text()='anItem']", 3000).text().then(function (value) {
assert.equal(value, "1 - anItem aCategory - $10.00 $20.00 1 21.00%");
});
}
}
};