Fix general test setup (finally)

Add basic selenium test for application login
Adapt default database template file
Add correct db settings for travis-ci
This commit is contained in:
jekkos
2015-05-15 00:45:55 +02:00
parent 19f7c6aa57
commit 687d4c06c6
8 changed files with 45 additions and 12 deletions

View File

@@ -18,4 +18,5 @@ before_script:
- sudo service apache2 restart
- mysql -e "create database IF NOT EXISTS ospos;" -uroot
- mysql -e "use ospos; source database/database.sql;" -uroot
- cp application/config/database.php.tmpl application/config/database.php
script: grunt mochaWebdriver:test

View File

@@ -60,9 +60,13 @@ module.exports = function(grunt) {
}
},
mochaWebdriver: {
options: {
timeout: 1000 * 60 * 3
},
test : {
options: {
usePhantom: true,
usePromises: true
},
src: ['test/**/*.js']
}

View File

@@ -49,9 +49,9 @@ $active_group = 'default';
$active_record = TRUE;
$db['default']['hostname'] = 'localhost';
$db['default']['username'] = '';
$db['default']['username'] = 'root';
$db['default']['password'] = '';
$db['default']['database'] = '';
$db['default']['database'] = 'ospos';
$db['default']['dbdriver'] = 'mysql';
$db['default']['dbprefix'] = 'ospos_';
$db['default']['pconnect'] = FALSE;
@@ -66,4 +66,4 @@ $db['default']['stricton'] = FALSE;
/* End of file database.php */
/* Location: ./application/config/database.php */
/* Location: ./application/config/database.php */

View File

@@ -33,14 +33,16 @@ $(document).ready(function()
<div class="form_field_label"><?php echo $this->lang->line('login_username'); ?>: </div>
<div class="form_field">
<?php echo form_input(array(
'name'=>'username',
'name'=>'username',
'id'=>'username',
'size'=>'20')); ?>
</div>
<div class="form_field_label"><?php echo $this->lang->line('login_password'); ?>: </div>
<div class="form_field">
<?php echo form_password(array(
'name'=>'password',
'name'=>'password',
'id' => 'password',
'size'=>'20')); ?>
</div>

View File

File diff suppressed because one or more lines are too long

View File

@@ -21,10 +21,10 @@
"grunt-contrib-jshint": "~0.6.3",
"grunt-contrib-uglify": "~0.8.0",
"grunt-contrib-watch": "~0.5.3",
"grunt-mocha-selenium": "~1.0.1",
"grunt-mocha-webdriver": "^1.1.2",
"grunt-mocha-webdriver": "^1.2.1",
"grunt-script-link-tags": "git://github.com/jekkos/grunt-script-link-tags.git#master",
"mocha": "^2.2.1",
"wd": "^0.3.11"
"wd": "^0.3.3",
"phantomjs": "~1.9.2"
}
}

26
test/login.js Normal file
View File

@@ -0,0 +1,26 @@
var assert = require("assert"); // node.js core module
describe("giftcard numbering test", function () {
it("giftcard numbering should increment", function (done) {
var searchBox;
var browser = this.browser;
browser.get('http://localhost/pos/index.php?XDEBUG_SESSION_START=ECLIPSE_DBGP&KEY=14241668456852')
.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);
});
});

View File

@@ -1,11 +1,11 @@
var assert = require("assert"); // node.js core module
var wd = require('wd')
var wd = require('wd');
describe('A Mocha test run by grunt-mocha-webdriver', function () {
it('has a browser injected into it', function () {
assert.ok(this.browser);
});
it('has wd injected into it for customizing', function () {
assert.notEqual(wd, undefined);
});
assert.notEqual(this.wd, undefined);
});
});