- CasperJS : coupon rule
This commit is contained in:
gmorel
2013-09-11 17:47:52 +02:00
parent 8ec6b2e790
commit d846d10832

View File

@@ -9,7 +9,7 @@ casper.test.comment('Testing coupons');
//UPDATE COUPON RULE //UPDATE COUPON RULE
casper.start(thelia2_login_coupon_update_url, function() { casper.start(thelia2_login_coupon_update_url, function() {
console.log('Now on : ' + this.getCurrentUrl()); this.capture('tests/functionnal/casperjs/screenshot/coupons/init.png');
this.echo('\nCOUPON RULE - EDIT'); this.echo('\nCOUPON RULE - EDIT');
this.test.assertTitle('Update coupon - Thelia Back Office', 'Web page title OK'); 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('#content-header > h1', 'Liste des pays', 'Web page main content OK');
@@ -18,12 +18,10 @@ casper.start(thelia2_login_coupon_update_url, function() {
// Create rule // Create rule
this.evaluate(function() { 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(); $('#category-rule').val('thelia.constraint.rule.available_for_x_articles').change();
return true; return true;
}); });
this.capture('tests/functionnal/casperjs/pictures/screenshot-category-rule.png'); this.capture('tests/functionnal/casperjs/screenshot/coupons/rule-selected.png');
// this.click('constraint-list > tr:last-child > td > a.constraint-update-btn');
}); });
casper.wait(1000, function() { casper.wait(1000, function() {
@@ -31,7 +29,21 @@ casper.wait(1000, function() {
}); });
casper.then(function(){ casper.then(function(){
this.evaluate(function() {
$('#quantity-operator').val('>=').change();
return true;
});
this.sendKeys('input#quantity-value', '4');
this.click('#constraint-save-btn');
});
casper.wait(1000, function() {
this.echo("\nWaiting....");
});
casper.then(function(){
this.capture('tests/functionnal/casperjs/screenshot/coupons/rule-added.png');
this.test.assertSelectorHasText('tbody#constraint-list tr:nth-child(3)', ' If cart products quantity is superior or equals to 4','3rd rule found');
}); });
////EDIT CHECK ////EDIT CHECK