- add tests casper JS on coupon
This commit is contained in:
gmorel
2013-09-11 17:06:04 +02:00
parent c8b5b9e9fa
commit 8d71bfecc5
3 changed files with 45 additions and 1 deletions

View File

@@ -1,3 +1,3 @@
//LOCAL = ton pc
var thelia2_base_url = 'http://www.thelia2.dev/index.php/';
var thelia2_base_url = 'http://www.thelia2.dev/index_dev.php/';
casper.test.done(0);

View File

@@ -2,6 +2,11 @@
casper.test.comment('Please edit 00_parameters.js to add your configuration');
var thelia2_login_admin_url = thelia2_base_url + 'admin/login';
var thelia2_login_coupon_list_url = thelia2_base_url + 'admin/login';
var thelia2_login_coupon_create_url = thelia2_base_url + 'admin/coupon/create';
var thelia2_login_coupon_read_url = thelia2_base_url + 'admin/coupon/read/1';
var thelia2_login_coupon_update_url = thelia2_base_url + 'admin/coupon/update/1';
//var findMyId = /([0-9]+)$/;

View File

@@ -0,0 +1,39 @@
casper.test.comment('Testing coupons');
////LIST
// @todo implement
////CREATE
// @todo implement
//UPDATE COUPON RULE
casper.start(thelia2_login_coupon_update_url, function() {
console.log('Now on : ' + this.getCurrentUrl());
this.echo('\nCOUPON RULE - EDIT');
this.test.assertTitle('Update coupon - Thelia Back Office', 'Web page title OK');
// this.test.assertSelectorHasText('#content-header > h1', 'Liste des pays', 'Web page main content OK');
this.test.assertSelectorHasText('tbody#constraint-list tr:nth-child(1)', 'If cart total amount is superior to 40 EUR','1st default rule found');
this.test.assertSelectorHasText('tbody#constraint-list tr:nth-child(2)', 'If cart total amount is inferior to 400 EUR','2nd default rule found');
// Create rule
this.evaluate(function() {
// document.querySelector('select#category-rule').selectedItem = 'thelia.constraint.rule.available_for_x_articles';
$('#category-rule').val('thelia.constraint.rule.available_for_x_articles').change();
return true;
});
this.capture('screenshot-category-rule.png');
// this.click('constraint-list > tr:last-child > td > a.constraint-update-btn');
});
////EDIT CHECK
// @todo implement
////DELETE
// @todo implement
//RUN
casper.run(function() {
this.test.done();
});