mirror of
https://github.com/opensourcepos/opensourcepos.git
synced 2026-05-06 23:05:45 -04:00
Add integration test for creating new item
This commit is contained in:
@@ -2,13 +2,14 @@ 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() {
|
||||
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) {
|
||||
@@ -16,7 +17,7 @@ describe("giftcard numbering test", function () {
|
||||
}).elementByCss(".big_button").click().waitForElementByName("value", 4000).type("100").elementById("submit").click()
|
||||
.waitForElementByXPath("//table/tbody/tr[td/text()='11']/td[4]").text().then(function (value) {
|
||||
assert.equal(value, "11", "giftcard number not incrementing properly!!");
|
||||
});
|
||||
}).then(done, done);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
17
test/make_item.js
Normal file
17
test/make_item.js
Normal file
@@ -0,0 +1,17 @@
|
||||
var assert = require('assert');
|
||||
var ospos = require('./ospos');
|
||||
|
||||
describe("create item", function () {
|
||||
|
||||
it("should be able to add new 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);
|
||||
});
|
||||
|
||||
});
|
||||
@@ -1,13 +0,0 @@
|
||||
var assert = require('assert');
|
||||
var ospos = require('./ospos');
|
||||
|
||||
describe("create item", function () {
|
||||
|
||||
it("should be able to add new item", function (done) {
|
||||
return this.browser.get(ospos.url("/index.php/items")).waitForElement("a[title='New Item']", 5000).click()
|
||||
.waitForElementByName("name", 10000).type("anItem").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();
|
||||
});
|
||||
|
||||
});
|
||||
Reference in New Issue
Block a user