Add testcase for creating new item

Optimise CI setup
This commit is contained in:
jekkos
2016-01-25 21:14:48 +01:00
parent 22a7231d8f
commit 0a159c803f
7 changed files with 53 additions and 50 deletions

View File

@@ -11,7 +11,7 @@ services:
before_install:
- docker build -t jekkos/opensourcepos .
- docker run -d -p 127.0.0.1:80:80 jekkos/opensourcepos
- sleep 10
- sleep 4
script:
- docker exec -t -i $(docker ps | tail -n 1 | cut -d' ' -f1) /bin/sh -c "cd /app; grunt mochaWebdriver:test"

View File

@@ -20,7 +20,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 ln -s /app /var/www/html/pos
ADD ./docker/start_container.sh /start_container.sh
RUN chmod 755 /start_container.sh
EXPOSE 80 3306

View File

@@ -1,34 +1,16 @@
var assert = require("assert"); // node.js core module
var ospos = require("./ospos");
describe("giftcard numbering test", function () {
var server = "http://localhost/pos";
var url = function url(suffix) {
return server + suffix + "?XDEBUG_SESSION_START=ECLIPSE_DBGP&KEY=14241668456852'";
};
this.timeout(25000);
it("should be able to login", function (done) {
return this.browser.get(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);
return ospos.login(this.browser, done);
});
it.skip("issue #65: giftcard numbering should add properly", function() {
return this.browser.get(url("/index.php/giftcards")).waitForElementByCss(".big_button").click()
.waitForElementByName("value", 4000).type("100").elementById('giftcard_number').clear().type("10")
it("issue #65: giftcard numbering should add properly", function() {
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) {
assert.ok(value, "giftcard failed to be added properly!");
}).elementByCss(".big_button").click().waitForElementByName("value", 4000).type("100").elementById("submit").click()

View File

@@ -1,3 +0,0 @@
exports.loginFirst = function() {
}

13
test/make_sale.js Normal file
View File

@@ -0,0 +1,13 @@
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();
});
});

33
test/ospos.js Normal file
View File

@@ -0,0 +1,33 @@
var assert = require('assert');
var ospos = function() {
var server = "http://localhost";
return {
url : function(suffix) {
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);
}
}
};
module.exports = ospos();

View File

@@ -1,21 +0,0 @@
Alias /pos %TRAVIS_BUILD_DIR%
<VirtualHost *:80>
DocumentRoot %TRAVIS_BUILD_DIR%
<Directory "%TRAVIS_BUILD_DIR%">
Options FollowSymLinks MultiViews ExecCGI
AllowOverride All
Order deny,allow
Allow from all
</Directory>
# Wire up Apache to use Travis CI's php-fpm.
<IfModule mod_fastcgi.c>
AddHandler php5-fcgi .php
Action php5-fcgi /php5-fcgi
Alias /php5-fcgi /usr/lib/cgi-bin/php5-fcgi
FastCgiExternalServer /usr/lib/cgi-bin/php5-fcgi -host 127.0.0.1:9000 -pass-header Authorization
</IfModule>
</VirtualHost>