Add integration test for making sale (#305)

This commit is contained in:
jekkos
2016-01-26 20:27:07 +01:00
parent a3119d1993
commit 847c4a67c9
3 changed files with 16 additions and 6 deletions

View File

@@ -259,8 +259,9 @@ if (isset($success))
if(count($cart) > 0)
{
?>
<?php echo form_open("sales/cancel_sale", array('id'=>'cancel_sale_form')); ?>
<div id="Cancel_sale">
<?php echo form_open("sales/cancel_sale", array('id'=>'cancel_sale_form')); ?>
<div class='small_button' id='cancel_sale_button' style='float:left; margin-top: 5px;'>
<span><?php echo $this->lang->line('sales_cancel_sale'); ?></span>
</div>
@@ -279,8 +280,9 @@ if (isset($success))
if(count($payments) > 0)
{
?>
<?php echo form_open("sales/complete", array('id'=>'finish_sale_form')); ?>
<div id="finish_sale">
<?php echo form_open("sales/complete", array('id'=>'finish_sale_form')); ?>
<label id="comment_label" for="comment"><?php echo $this->lang->line('common_comments'); ?>:</label>
<?php echo form_textarea(array('name'=>'comment', 'id'=>'comment', 'value'=>$comment, 'rows'=>'4', 'cols'=>'23'));?>
<br />

View File

@@ -2,14 +2,13 @@ var assert = require("assert"); // node.js core module
var ospos = require("./ospos");
describe("giftcard numbering test", function () {
this.timeout(25000);
it("should be able to login", function (done) {
return ospos.login(this.browser, done);
});
it("issue #65: giftcard numbering should add properly", function(done) {
this.timeout(25000);
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) {

View File

@@ -1,9 +1,10 @@
var assert = require('assert');
var ospos = require('./ospos');
describe("create item", function () {
describe("create item and make sale", function () {
this.timeout(25000);
it("should be able to add new item", function (done) {
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")
@@ -14,4 +15,12 @@ describe("create item", function () {
}).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:nth-child(3)", 5000).text().then(function(value) {
assert.equal(value, "$43.56", "discounted price " + value + " is not correct!!");
}).then(done, done);
});
});