Working
- add tests casper JS
This commit is contained in:
3
tests/functionnal/casperjs/conf/local.js
Normal file
3
tests/functionnal/casperjs/conf/local.js
Normal file
@@ -0,0 +1,3 @@
|
||||
//LOCAL = ton pc
|
||||
var thelia2_base_url = 'http://www.thelia2.dev/index.php/';
|
||||
casper.test.done(0);
|
||||
12
tests/functionnal/casperjs/exe/00_parameters.js
Normal file
12
tests/functionnal/casperjs/exe/00_parameters.js
Normal file
@@ -0,0 +1,12 @@
|
||||
|
||||
casper.test.comment('Please edit 00_parameters.js to add your configuration');
|
||||
|
||||
var thelia2_login_admin_url = thelia2_base_url + 'admin/login';
|
||||
|
||||
|
||||
//var findMyId = /([0-9]+)$/;
|
||||
//var currentId;
|
||||
|
||||
casper.test.comment('Variables are set');
|
||||
|
||||
casper.test.done(0);
|
||||
27
tests/functionnal/casperjs/exe/10_login.js
Normal file
27
tests/functionnal/casperjs/exe/10_login.js
Normal file
@@ -0,0 +1,27 @@
|
||||
casper.test.comment('Testing login');
|
||||
|
||||
casper.start(thelia2_login_admin_url, function() {
|
||||
this.echo('\nLOGIN');
|
||||
this.test.assertTitle('Welcome - Thelia Back Office', 'Web page title OK');
|
||||
this.sendKeys('input#username', 'thelia2');
|
||||
this.sendKeys('input#password', 'thelia2');
|
||||
this.click('form[action*="checklogin"] button[type="submit"]');
|
||||
});
|
||||
|
||||
casper.wait(1000, function() {
|
||||
this.echo("\nWaiting....");
|
||||
});
|
||||
|
||||
casper.then(function(){
|
||||
this.echo('\nDASHBOARD');
|
||||
|
||||
console.log('Now on : ' + this.getCurrentUrl());
|
||||
// @todo implement dashboard
|
||||
// this.test.assertTitle('Back-office home - Thelia Back Office', 'Web page title OK');
|
||||
// this.test.assertSelectorHasText('#wrapper > div', ' This is the administration home page. Put some interesting statistics here, and display useful information :) ', 'Web page main content OK');
|
||||
});
|
||||
|
||||
//RUN
|
||||
casper.run(function() {
|
||||
this.test.done();
|
||||
});
|
||||
Reference in New Issue
Block a user