{if $input.type == 'select'}
- {foreach from=$input.availableValues key=code item=availableValue}
+ {foreach from=$input.availableValues key=code item=availableValue name=availableValues}
{$availableValue}
{/foreach}
@@ -72,12 +72,16 @@
+ {/javascripts}
+
+
+{/block}
\ No newline at end of file
diff --git a/templates/admin/default/features.html b/templates/admin/default/features.html
new file mode 100644
index 000000000..69ed1d5d4
--- /dev/null
+++ b/templates/admin/default/features.html
@@ -0,0 +1,326 @@
+{extends file="admin-layout.tpl"}
+
+{block name="page-title"}{intl l='Thelia Product Features'}{/block}
+
+{block name="check-permissions"}admin.configuration.features.view{/block}
+
+{block name="main-content"}
+
+
+
+
+
+
+ {module_include location='features_top'}
+
+
+
+ {module_include location='features_bottom'}
+
+
+
+
+{* Adding a new feature *}
+
+{form name="thelia.admin.feature.creation"}
+
+ {* Capture the dialog body, to pass it to the generic dialog *}
+ {capture "creation_dialog"}
+ {form_hidden_fields form=$form}
+
+ {form_field form=$form field='success_url'}
+ {* on success, redirect to the edition page, _ID_ is replaced with the created feature ID, see controller *}
+
+ {/form_field}
+
+ {form_field form=$form field='title'}
+
+ {/form_field}
+
+ {form_field form=$form field='add_to_all'}
+
+ {/form_field}
+
+ {module_include location='feature_create_form'}
+
+ {/capture}
+
+ {include
+ file = "includes/generic-create-dialog.html"
+
+ dialog_id = "creation_dialog"
+ dialog_title = {intl l="Create a new feature"}
+ dialog_body = {$smarty.capture.creation_dialog nofilter}
+
+ dialog_ok_label = {intl l="Create this feature"}
+
+ form_action = {url path='/admin/configuration/features/create'}
+ form_enctype = {form_enctype form=$form}
+ form_error_message = $form_error_message
+ }
+{/form}
+
+{* Delete confirmation dialog *}
+
+{capture "delete_dialog"}
+
+
+ {module_include location='feature_delete_form'}
+
+{/capture}
+
+{include
+ file = "includes/generic-confirm-dialog.html"
+
+ dialog_id = "delete_dialog"
+ dialog_title = {intl l="Delete feature"}
+ dialog_message = {intl l="Do you really want to delete this feature ? It will be removed from all product templates."}
+
+ form_action = {url path='/admin/configuration/features/delete'}
+ form_content = {$smarty.capture.delete_dialog nofilter}
+}
+
+
+{* Add to all dialog *}
+
+{capture "add_to_all_dialog"}
+
+
+ {module_include location='feature_add_to_all_form'}
+
+{/capture}
+
+{include
+ file = "includes/generic-confirm-dialog.html"
+
+ dialog_id = "add_to_all_dialog"
+ dialog_title = {intl l="Add to all product templates"}
+ dialog_message = {intl l="Do you really want to add this feature to all product templates ?"}
+
+ form_action = {url path='/admin/configuration/features/add-to-all-templates'}
+ form_content = {$smarty.capture.add_to_all_dialog nofilter}
+}
+
+{* Remove from all dialog *}
+
+{capture "remove_from_all_dialog"}
+
+
+ {module_include location='feature_add_to_all_form'}
+
+{/capture}
+
+{include
+ file = "includes/generic-confirm-dialog.html"
+
+ dialog_id = "remove_from_all_dialog"
+ dialog_title = {intl l="Remove from all product templates"}
+ dialog_message = {intl l="Do you really want to remove this feature from all product templates ? You'll loose all product related data for this feature."}
+
+ form_action = {url path='/admin/configuration/features/remove-from-all-templates'}
+ form_content = {$smarty.capture.remove_from_all_dialog nofilter}
+}
+
+{/block}
+
+{block name="javascript-initialization"}
+
+ {javascripts file='assets/js/bootstrap-editable/bootstrap-editable.js'}
+
+ {/javascripts}
+
+
+{/block}
\ No newline at end of file
diff --git a/templates/admin/default/includes/coupon_breadcrumb.html b/templates/admin/default/includes/coupon_breadcrumb.html
deleted file mode 100755
index 878d9605d..000000000
--- a/templates/admin/default/includes/coupon_breadcrumb.html
+++ /dev/null
@@ -1,5 +0,0 @@
-{* Breadcrumb for coupon browsing and editing *}
-
-
Home
-
Coupon
-
Browse
\ No newline at end of file
diff --git a/tests/functionnal/casperjs/exe/00_parameters.js b/tests/functionnal/casperjs/exe/00_parameters.js
index a32ee89b5..df5470229 100644
--- a/tests/functionnal/casperjs/exe/00_parameters.js
+++ b/tests/functionnal/casperjs/exe/00_parameters.js
@@ -3,7 +3,7 @@ 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_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';
diff --git a/tests/functionnal/casperjs/exe/30_coupons.js b/tests/functionnal/casperjs/exe/30_coupons.js
index 2ac04a759..2147c14cf 100644
--- a/tests/functionnal/casperjs/exe/30_coupons.js
+++ b/tests/functionnal/casperjs/exe/30_coupons.js
@@ -1,51 +1,151 @@
-casper.test.comment('Testing coupons');
+//
+//var casper = require('casper').create({
+// viewportSize:{
+// width:1024, height:768
+// },
+// pageSettings:{
+// userAgent:'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_2) AppleWebKit/535.11 (KHTML, like Gecko) Chrome/17.0.963.79 Safari/535.11'
+// },
+// verbose:true
+//});
+casper.test.comment('Testing coupons');
////LIST
// @todo implement
////CREATE
-// @todo implement
-
-//UPDATE COUPON RULE
-casper.start(thelia2_login_coupon_update_url, function() {
+casper.start(thelia2_login_coupon_create_url, function() {
+ this.test.assertHttpStatus(200);
+ this.test.comment('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');
- 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');
+ this.test.comment('COUPON - CREATE EMPTY');
- // Create rule
+ // Click on is unlimited button
+ this.click("form #is-unlimited");
+ this.sendKeys('input#max-usage', '-2');
+
+ // cleaning expiration date default value
this.evaluate(function() {
- $('#category-rule').val('thelia.constraint.rule.available_for_x_articles').change();
+ $("#expiration-date").val('').change();
return true;
});
- this.capture('tests/functionnal/casperjs/screenshot/coupons/rule-selected.png');
+
+ this.capture('tests/functionnal/casperjs/screenshot/coupons/creating-new-coupon.png');
+ this.click("form .control-group .btn.btn-default.btn-primary");
+
});
casper.wait(1000, function() {
this.echo("\nWaiting....");
});
+// Test Coupon creation if no input
casper.then(function(){
- this.evaluate(function() {
- $('#quantity-operator').val('>=').change();
- return true;
- });
- this.sendKeys('input#quantity-value', '4');
- this.click('#constraint-save-btn');
+ this.test.assertHttpStatus(200);
+ this.capture('tests/functionnal/casperjs/screenshot/coupons/created-new-empty-coupon.png');
+ this.test.assertExists('.has-error #code', 'Error on code input found');
+ this.test.assertExists('.has-error #title', 'Error on title input found');
+
+ this.test.assertExists('.has-error #expiration-date', 'Error on expiration date input found');
+ this.test.assertExists('.has-error #max-usage', 'Error on max usage input found');
+ this.test.assertExists('.has-error #description', 'Error on description input found');
+ this.test.assertExists('.has-error #effect', 'Error on effect input found');
+ this.test.assertExists('.has-error #amount', 'Error on amount input found');
+ this.test.assertExists('.has-error #short-description', 'Error on short-description input found');
});
-casper.wait(1000, function() {
+// Test Coupon creation if good input
+casper.then(function(){
+
+ this.sendKeys('input#code', 'XMAS10');
+ this.sendKeys('input#title', 'christmas');
+ this.click("form #is-enabled");
+ this.click("form #is-available-on-special-offers");
+ this.click("form #is-cumulative");
+ this.click("form #is-removing-postage");
+
+ this.evaluate(function() {
+ $("#expiration-date").val('2013-11-14').change();
+ return true;
+ });
+
+ // Click on is unlimited button
+ this.click("form #is-unlimited");
+ this.sendKeys('input#max-usage', '40');
+
+ this.evaluate(function() {
+ $('#effect').val('thelia.coupon.type.remove_x_amount').change();
+ return true;
+ });
+
+ this.test.assertSelectorHasText(
+ '#effectToolTip',
+ this.evaluate(function () {
+ return $("#effect option[value^='thelia.coupon.type.remove_x_amount']").attr('data-description');
+ }),
+ 'Tooltip found'
+ );
+ this.sendKeys('input#amount', '42.12');
+ this.sendKeys('#short-description', 'Mauris sed risus imperdiet, blandit arcu ac, tempus metus. Aliquam erat volutpat. Nullam dictum sed.');
+ this.sendKeys('#description', 'Etiam sodales non nisi a condimentum. Morbi luctus mauris mattis sem ornare; ac blandit tortor porta! Sed vel viverra dolor. Nulla eget viverra eros. Donec rutrum felis ut quam blandit, eu massa nunc.');
+
+ this.capture('tests/functionnal/casperjs/screenshot/coupons/coupon-created-ready-to-be-saved.png');
+ this.click("#save-coupon-btn");
+});
+
+casper.wait(2000, function() {
this.echo("\nWaiting....");
});
+// Test Coupon creation if good input is well saved
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');
-});
+ this.test.assertHttpStatus(302);
+ this.test.comment('Now on : ' + this.getCurrentUrl());
+ this.capture('tests/functionnal/casperjs/screenshot/coupons/created-new-coupon.png');
+ this.test.assertField('thelia_coupon_creation[code]', 'XMAS10', 'Code found');
+ this.test.assertField('thelia_coupon_creation[title]', 'christmas', 'Title found');
+ this.test.assert(this.evaluate(function () {
+ return document.getElementById('is-enabled').checked;
+ }), 'Checkbox is enabled checked');
+ this.test.assert(this.evaluate(function () {
+ return document.getElementById('is-available-on-special-offers').checked;
+ }), 'Checkbox is available on special offers checked');
+ this.test.assert(this.evaluate(function () {
+ return document.getElementById('is-cumulative').checked;
+ }), 'Checkbox is cumulative checked');
+ this.test.assert(this.evaluate(function () {
+ return document.getElementById('is-removing-postage').checked;
+ }), 'Checkbox is cumulative checked');
+
+ this.test.assertField('thelia_coupon_creation[expirationDate]', '2013-11-14', 'Expiration date found');
+ this.test.assertField('thelia_coupon_creation[maxUsage]', '40', 'Max usage found');
+ this.test.assert(this.evaluate(function () {
+ return !document.getElementById('is-unlimited').checked;
+ }), 'Checkbox is unlimited not checked');
+
+ this.test.assert(
+ this.evaluate(function () {
+ return $("#effect").val();
+ }),
+ 'thelia.coupon.type.remove_x_amount',
+ 'Effect found'
+ );
+ this.test.assertSelectorHasText(
+ '#effectToolTip',
+ this.evaluate(function () {
+ return $("#effect option[value^='thelia.coupon.type.remove_x_amount']").attr('data-description');
+ }),
+ 'Tooltip found'
+ );
+ this.test.assertField('thelia_coupon_creation[amount]', '42.12', 'Amount found');
+
+ this.test.assertField('thelia_coupon_creation[shortDescription]', 'Mauris sed risus imperdiet, blandit arcu ac, tempus metus. Aliquam erat volutpat. Nullam dictum sed.', 'Short description found');
+ this.test.assertField('thelia_coupon_creation[description]', 'Etiam sodales non nisi a condimentum. Morbi luctus mauris mattis sem ornare; ac blandit tortor porta! Sed vel viverra dolor. Nulla eget viverra eros. Donec rutrum felis ut quam blandit, eu massa nunc.', 'Description found');
+
+
+});
////EDIT CHECK
// @todo implement
diff --git a/tests/functionnal/casperjs/exe/31_coupons_rule.js b/tests/functionnal/casperjs/exe/31_coupons_rule.js
new file mode 100644
index 000000000..66706aada
--- /dev/null
+++ b/tests/functionnal/casperjs/exe/31_coupons_rule.js
@@ -0,0 +1,312 @@
+////
+////var casper = require('casper').create({
+//// viewportSize:{
+//// width:1024, height:768
+//// },
+//// pageSettings:{
+//// userAgent:'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_2) AppleWebKit/535.11 (KHTML, like Gecko) Chrome/17.0.963.79 Safari/535.11'
+//// },
+//// verbose:true
+////});
+//
+//casper.test.comment('Testing coupons rules');
+//
+////UPDATE COUPON RULE
+//casper.start(thelia2_login_coupon_update_url, function() {
+// this.test.assertHttpStatus(200);
+// this.test.comment('Now on : ' + this.getCurrentUrl());
+// this.capture('tests/functionnal/casperjs/screenshot/coupons/init.png');
+// this.test.comment('COUPON RULE - EDIT');
+// this.test.assertTitle('Update coupon - Thelia Back Office', 'Web page title OK');
+// this.test.assertSelectorHasText('tbody#constraint-list tr:nth-child(1)', 'If cart total amount is superior to 40 EUR','1) 1st default rule found');
+// this.test.assertSelectorHasText('tbody#constraint-list tr:nth-child(2)', 'If cart total amount is inferior to 400 EUR','1) 2nd default rule found');
+//
+// // Create rule
+// this.evaluate(function() {
+// $('#category-rule').val('thelia.constraint.rule.available_for_x_articles').change();
+// return true;
+// });
+// this.capture('tests/functionnal/casperjs/screenshot/coupons/rule-selected.png');
+//});
+//
+//casper.wait(1000, function() {
+// this.echo("\nWaiting....");
+//});
+//
+//// Test Rule updating
+//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(1)', 'If cart total amount is superior to 40 EUR','2) 1st default rule found');
+// this.test.assertSelectorHasText('tbody#constraint-list tr:nth-child(2)', 'If cart total amount is inferior to 400 EUR','2) 2nd default rule found');
+// this.test.assertSelectorHasText('tbody#constraint-list tr:nth-child(3)', ' If cart products quantity is superior or equal to 4','2) 3rd rule found');
+//
+// // Click on Edit button
+// this.click('tbody#constraint-list tr:nth-child(3) .constraint-update-btn');
+//});
+//
+//casper.wait(2000, function() {
+// this.echo("\nWaiting....");
+//});
+//
+//casper.then(function(){
+// this.evaluate(function() {
+// $('#quantity-operator').val('==').change();
+// return true;
+// });
+//
+// // Removing old value
+//// casper.evaluate(function triggerKeyDownEvent() {
+//// var e = $.Event("keydown");
+//// e.which = 8;
+//// e.keyCode = 8;
+//// $("#quantity-value").trigger(e);
+//// });
+// this.evaluate(function() {
+// $("#quantity-value").val('').change();
+// return true;
+// });
+//
+// // Adding new value
+// this.sendKeys('#quantity-value', '5');
+// this.capture('tests/functionnal/casperjs/screenshot/coupons/rule-being-edited.png');
+// this.click('#constraint-save-btn');
+//});
+//
+//casper.wait(2000, function() {
+// this.echo("\nWaiting....");
+//});
+//// Check if updated rule has been saved and list refreshed
+//casper.then(function(){
+// this.capture('tests/functionnal/casperjs/screenshot/coupons/rule-edited.png');
+// this.test.assertSelectorHasText('tbody#constraint-list tr:nth-child(1)', 'If cart total amount is superior to 40 EUR','3) 1st default rule found');
+// this.test.assertSelectorHasText('tbody#constraint-list tr:nth-child(2)', 'If cart total amount is inferior to 400 EUR','3) 2nd default rule found');
+// this.test.assertSelectorHasText('tbody#constraint-list tr:nth-child(3)', 'If cart products quantity is equal to 5','3) 3rd rule updated found');
+//});
+//
+//// Check if updated rule has been well saved
+//casper.thenOpen(thelia2_login_coupon_update_url, function() {
+// this.test.assertHttpStatus(200);
+// this.test.comment('Now on : ' + this.getCurrentUrl());
+// this.capture('tests/functionnal/casperjs/screenshot/coupons/rule-edited-refreshed.png');
+// this.test.assertSelectorHasText('tbody#constraint-list tr:nth-child(1)', 'If cart total amount is superior to 40 EUR','4) 1st default rule found');
+// this.test.assertSelectorHasText('tbody#constraint-list tr:nth-child(2)', 'If cart total amount is inferior to 400 EUR','4) 2nd default rule found');
+// this.test.assertSelectorHasText('tbody#constraint-list tr:nth-child(3)', 'If cart products quantity is equal to 5','4) 3rd rule updated found');
+//
+// // Click on Delete button
+// this.click('tbody#constraint-list tr:nth-child(2) .constraint-delete-btn');
+//});
+//
+//casper.wait(2000, function() {
+// this.echo("\nWaiting....");
+//});
+//
+//casper.then(function(){
+// this.test.assertSelectorHasText('tbody#constraint-list tr:nth-child(1)', 'If cart total amount is superior to 40 EUR','5) 1st default rule found');
+// this.test.assertSelectorDoesntHaveText('tbody#constraint-list tr:nth-child(2)', 'If cart total amount is inferior to 400 EUR','5) 2nd default rule found');
+// this.test.assertSelectorHasText('tbody#constraint-list tr:nth-child(2)', 'If cart products quantity is equal to 5','5) 3rd rule updated found');
+//});
+//
+//// Check if updated rule has been well saved
+//casper.thenOpen(thelia2_login_coupon_update_url, function() {
+// this.test.assertHttpStatus(200);
+// this.test.comment('Now on : ' + this.getCurrentUrl());
+// this.capture('tests/functionnal/casperjs/screenshot/coupons/rule-deleted-refreshed.png');
+// this.test.assertSelectorHasText('tbody#constraint-list tr:nth-child(1)', 'If cart total amount is superior to 40 EUR','6) 1st default rule found');
+// this.test.assertSelectorDoesntHaveText('tbody#constraint-list tr:nth-child(2)', 'If cart total amount is inferior to 400 EUR','6) 2nd default rule found');
+// this.test.assertSelectorHasText('tbody#constraint-list tr:nth-child(2)', 'If cart products quantity is equal to 5','6) 3rd rule updated found');
+//});
+//
+//// Test creating rule that won't be edited
+//casper.then(function(){
+//// Create rule
+// this.evaluate(function() {
+// $('#category-rule').val('thelia.constraint.rule.available_for_total_amount').change();
+// return true;
+// });
+// this.capture('tests/functionnal/casperjs/screenshot/coupons/rule-selected2.png');
+//});
+//
+//casper.wait(2000, function() {
+// this.echo("\nWaiting....");
+//});
+//
+//// Test Rule creation
+//casper.then(function(){
+// this.evaluate(function() {
+// $('#price-operator').val('<=').change();
+// return true;
+// });
+// // Removing old value
+//// casper.evaluate(function triggerKeyDownEvent() {
+//// var e = $.Event("keydown");
+//// e.which = 8;
+//// e.keyCode = 8;
+//// $("input#price-value").trigger(e);
+//// });
+// this.evaluate(function() {
+// $("input#price-value").val('').change();
+// return true;
+// });
+//
+// // Changing 400 to 401
+// this.sendKeys('input#price-value', '401');
+// this.evaluate(function() {
+// $('#currency-value').val('GBP').change();
+// return true;
+// });
+// this.capture('tests/functionnal/casperjs/screenshot/coupons/rule-saved-edited-before-click-save.png');
+// this.click('#constraint-save-btn');
+//});
+//
+//casper.wait(2000, function() {
+// this.echo("\nWaiting....");
+//});
+//
+//casper.then(function(){
+// this.test.assertSelectorHasText('tbody#constraint-list tr:nth-child(1)', 'If cart total amount is superior to 40 EUR','7) 1st default rule found');
+// this.test.assertSelectorDoesntHaveText('tbody#constraint-list tr:nth-child(2)', 'If cart total amount is inferior to 400 EUR','7) 2nd default rule found');
+// this.test.assertSelectorHasText('tbody#constraint-list tr:nth-child(2)', 'If cart products quantity is equal to 5','7) 3rd rule updated found');
+// this.test.assertSelectorHasText('tbody#constraint-list tr:nth-child(3)', 'If cart total amount is inferior or equal to 401 GBP','7) 4rd rule created found');
+//});
+//
+//// Check if created rule has been well saved
+//casper.thenOpen(thelia2_login_coupon_update_url, function() {
+// this.test.assertHttpStatus(200);
+// this.test.comment('Now on : ' + this.getCurrentUrl());
+// this.capture('tests/functionnal/casperjs/screenshot/coupons/rule-added-refreshed.png');
+// this.test.assertSelectorHasText('tbody#constraint-list tr:nth-child(1)', 'If cart total amount is superior to 40 EUR','8) 1st default rule found');
+// this.test.assertSelectorDoesntHaveText('tbody#constraint-list tr:nth-child(2)', 'If cart total amount is inferior to 400 EUR','8) 2nd default rule found');
+// this.test.assertSelectorHasText('tbody#constraint-list tr:nth-child(2)', 'If cart products quantity is equal to 5','8) 3rd rule updated found');
+// this.test.assertSelectorHasText('tbody#constraint-list tr:nth-child(3)', 'If cart total amount is inferior or equal to 401 GBP','8) 4rd rule created found');
+//});
+//
+//// Testing deleting all rules
+//casper.then(function(){
+//// Click on Delete button
+// this.click('tbody#constraint-list tr:nth-child(1) .constraint-delete-btn');
+//});
+//casper.wait(1000, function() {
+// this.echo("\nWaiting....");
+//});
+//casper.then(function(){
+//// Click on Delete button
+// this.click('tbody#constraint-list tr:nth-child(1) .constraint-delete-btn');
+//});
+//casper.wait(1000, function() {
+// this.echo("\nWaiting....");
+//});
+//casper.then(function(){
+//// Click on Delete button
+// this.click('tbody#constraint-list tr:nth-child(1) .constraint-delete-btn');
+//});
+//casper.wait(1000, function() {
+// this.echo("\nWaiting....");
+//});
+//casper.then(function(){
+// this.capture('tests/functionnal/casperjs/screenshot/coupons/rule-all-deleted.png');
+// this.test.assertSelectorHasText('tbody#constraint-list tr:nth-child(1)', 'No conditions','9) 1st default rule found');
+// test.assertDoesntExist('tbody#constraint-list tr:nth-child(2)');
+//});
+//
+//// Check if created rule has been well saved
+//casper.thenOpen(thelia2_login_coupon_update_url, function() {
+// this.test.assertHttpStatus(200);
+// this.test.comment('Now on : ' + this.getCurrentUrl());
+// this.capture('tests/functionnal/casperjs/screenshot/coupons/rule-all-deleted-refreshed.png');
+// this.test.assertSelectorHasText('tbody#constraint-list tr:nth-child(1)', 'No conditions','10) 1st default rule found');
+// test.assertDoesntExist('tbody#constraint-list tr:nth-child(2)');
+//});
+//
+//
+//// Test add no condition rule
+//casper.then(function(){
+// this.evaluate(function() {
+// $('#category-rule').val('thelia.constraint.rule.available_for_x_articles').change();
+// return true;
+// });
+//});
+//
+//casper.wait(1000, function() {
+// this.echo("\nWaiting....");
+//});
+//
+//// Test Rule updating
+//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-all-deleted.png');
+// this.test.assertSelectorHasText('tbody#constraint-list tr:nth-child(1)', 'If cart products quantity is superior to 4', '11) 1st default rule found');
+// test.assertDoesntExist('tbody#constraint-list tr:nth-child(2)');
+//});
+//
+//// Check if created rule has been well saved
+//casper.thenOpen(thelia2_login_coupon_update_url, function() {
+// this.test.assertHttpStatus(200);
+// this.test.comment('Now on : ' + this.getCurrentUrl());
+// this.capture('tests/functionnal/casperjs/screenshot/coupons/rule-all-deleted-refreshed.png');
+// this.test.assertSelectorHasText('tbody#constraint-list tr:nth-child(1)', 'If cart products quantity is superior to 4','12) 1st default rule found');
+// test.assertDoesntExist('tbody#constraint-list tr:nth-child(2)');
+//});
+//
+//casper.then(function(){
+// this.evaluate(function() {
+// $('#category-rule').val('thelia.constraint.rule.available_for_everyone').change();
+// return true;
+// });
+//});
+//
+//casper.wait(1000, function() {
+// this.echo("\nWaiting....");
+//});
+//
+//// Test Rule updating
+//casper.then(function(){
+// this.click('#constraint-save-btn');
+//});
+//
+//casper.wait(1000, function() {
+// this.echo("\nWaiting....");
+//});
+//casper.then(function(){
+// this.capture('tests/functionnal/casperjs/screenshot/coupons/rule-all-deleted.png');
+// this.test.assertSelectorHasText('tbody#constraint-list tr:nth-child(1)', 'No conditions','13) 1st default rule found');
+// test.assertDoesntExist('tbody#constraint-list tr:nth-child(2)');
+//});
+//
+//// Check if created rule has been well saved
+//casper.thenOpen(thelia2_login_coupon_update_url, function() {
+// this.test.assertHttpStatus(200);
+// this.test.comment('Now on : ' + this.getCurrentUrl());
+// this.capture('tests/functionnal/casperjs/screenshot/coupons/rule-all-deleted-refreshed.png');
+// this.test.assertSelectorHasText('tbody#constraint-list tr:nth-child(1)', 'No conditions','14) 1st default rule found');
+// test.assertDoesntExist('tbody#constraint-list tr:nth-child(2)');
+//});
+//
+////RUN
+//casper.run(function() {
+// this.test.done();
+//});
\ No newline at end of file