From d846d108323c0c0f5a9456e793534c5f5ed2fd13 Mon Sep 17 00:00:00 2001 From: gmorel Date: Wed, 11 Sep 2013 17:47:52 +0200 Subject: [PATCH] Working - CasperJS : coupon rule --- tests/functionnal/casperjs/exe/30_coupons.js | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/tests/functionnal/casperjs/exe/30_coupons.js b/tests/functionnal/casperjs/exe/30_coupons.js index 6031d71f8..2ac04a759 100644 --- a/tests/functionnal/casperjs/exe/30_coupons.js +++ b/tests/functionnal/casperjs/exe/30_coupons.js @@ -9,7 +9,7 @@ casper.test.comment('Testing coupons'); //UPDATE COUPON RULE 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.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'); @@ -18,12 +18,10 @@ casper.start(thelia2_login_coupon_update_url, function() { // 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('tests/functionnal/casperjs/pictures/screenshot-category-rule.png'); -// this.click('constraint-list > tr:last-child > td > a.constraint-update-btn'); + this.capture('tests/functionnal/casperjs/screenshot/coupons/rule-selected.png'); }); casper.wait(1000, function() { @@ -31,7 +29,21 @@ casper.wait(1000, 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