From 847c4a67c9212e5951c6e4560a556919978d971d Mon Sep 17 00:00:00 2001 From: jekkos Date: Tue, 26 Jan 2016 20:27:07 +0100 Subject: [PATCH] Add integration test for making sale (#305) --- application/views/sales/register.php | 6 ++++-- test/giftcard_numbering.js | 3 +-- test/{make_item.js => make_sale.js} | 13 +++++++++++-- 3 files changed, 16 insertions(+), 6 deletions(-) rename test/{make_item.js => make_sale.js} (54%) diff --git a/application/views/sales/register.php b/application/views/sales/register.php index 170e567e4..34a5ff0ff 100644 --- a/application/views/sales/register.php +++ b/application/views/sales/register.php @@ -259,8 +259,9 @@ if (isset($success)) if(count($cart) > 0) { ?> + 'cancel_sale_form')); ?> +
- 'cancel_sale_form')); ?>
lang->line('sales_cancel_sale'); ?>
@@ -279,8 +280,9 @@ if (isset($success)) if(count($payments) > 0) { ?> + 'finish_sale_form')); ?> +
- 'finish_sale_form')); ?> 'comment', 'id'=>'comment', 'value'=>$comment, 'rows'=>'4', 'cols'=>'23'));?>
diff --git a/test/giftcard_numbering.js b/test/giftcard_numbering.js index cc8d95911..7b7390113 100644 --- a/test/giftcard_numbering.js +++ b/test/giftcard_numbering.js @@ -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) { diff --git a/test/make_item.js b/test/make_sale.js similarity index 54% rename from test/make_item.js rename to test/make_sale.js index b80be2dab..70998e4fa 100644 --- a/test/make_item.js +++ b/test/make_sale.js @@ -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); + }); + }); \ No newline at end of file