Working
- CasperJS : coupon rule
This commit is contained in:
@@ -122,17 +122,17 @@
|
|||||||
{if $error}{$message}{/if}
|
{if $error}{$message}{/if}
|
||||||
{/form_field}
|
{/form_field}
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
{*<div class="form-group">*}
|
||||||
<label for="category">Category :</label>
|
{*<label for="category">Category :</label>*}
|
||||||
{*form_field form=$form field='category'*}
|
{*form_field form=$form field='category'*}
|
||||||
<select name="{$name}" value="{$value}" id="category" class="form-control">
|
{*<select name="{$name}" value="{$value}" id="category" class="form-control">*}
|
||||||
<option value="1">Category 1</option>
|
{*<option value="1">Category 1</option>*}
|
||||||
<option value="1">Category 2</option>
|
{*<option value="1">Category 2</option>*}
|
||||||
<option value="1">Category 3</option>
|
{*<option value="1">Category 3</option>*}
|
||||||
</select>
|
{*</select>*}
|
||||||
{*if $error}{$message}{/if}*}
|
{*if $error}{$message}{/if}*}
|
||||||
{*/form_field*}
|
{*/form_field*}
|
||||||
</div>
|
{*</div>*}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,6 @@ casper.start(thelia2_login_coupon_update_url, function() {
|
|||||||
this.capture('tests/functionnal/casperjs/screenshot/coupons/init.png');
|
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('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(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.assertSelectorHasText('tbody#constraint-list tr:nth-child(2)', 'If cart total amount is inferior to 400 EUR','2nd default rule found');
|
||||||
|
|
||||||
@@ -28,6 +27,7 @@ casper.wait(1000, function() {
|
|||||||
this.echo("\nWaiting....");
|
this.echo("\nWaiting....");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Test Rule updating
|
||||||
casper.then(function(){
|
casper.then(function(){
|
||||||
this.evaluate(function() {
|
this.evaluate(function() {
|
||||||
$('#quantity-operator').val('>=').change();
|
$('#quantity-operator').val('>=').change();
|
||||||
@@ -43,7 +43,107 @@ casper.wait(1000, function() {
|
|||||||
|
|
||||||
casper.then(function(){
|
casper.then(function(){
|
||||||
this.capture('tests/functionnal/casperjs/screenshot/coupons/rule-added.png');
|
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','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.assertSelectorHasText('tbody#constraint-list tr:nth-child(3)', ' If cart products quantity is superior or equals to 4','3rd rule found');
|
this.test.assertSelectorHasText('tbody#constraint-list tr:nth-child(3)', ' If cart products quantity is superior or equals to 4','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;
|
||||||
|
});
|
||||||
|
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','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.assertSelectorHasText('tbody#constraint-list tr:nth-child(3)', 'If cart products quantity is equals to 5','3rd rule updated found');
|
||||||
|
});
|
||||||
|
|
||||||
|
// Check if updated rule has been well saved
|
||||||
|
casper.start(thelia2_login_coupon_update_url, function() {
|
||||||
|
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','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.assertSelectorHasText('tbody#constraint-list tr:nth-child(3)', 'If cart products quantity is equals to 5','3rd rule updated found');
|
||||||
|
|
||||||
|
// Click on Delete button
|
||||||
|
this.click('tbody#constraint-list tr:nth-child(2) .constraint-delete-btn');
|
||||||
|
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.assertSelectorDoesntHaveText('tbody#constraint-list tr:nth-child(2)', 'If cart total amount is inferior to 400 EUR','2nd default rule found');
|
||||||
|
this.test.assertSelectorHasText('tbody#constraint-list tr:nth-child(3)', 'If cart products quantity is equals to 5','3rd rule updated found');
|
||||||
|
});
|
||||||
|
|
||||||
|
// Check if updated rule has been well saved
|
||||||
|
casper.start(thelia2_login_coupon_update_url, function() {
|
||||||
|
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','1st default rule found');
|
||||||
|
this.test.assertSelectorDoesntHaveText('tbody#constraint-list tr:nth-child(2)', 'If cart total amount is inferior to 400 EUR','2nd default rule found');
|
||||||
|
this.test.assertSelectorHasText('tbody#constraint-list tr:nth-child(3)', 'If cart products quantity is equals to 5','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(1000, function() {
|
||||||
|
this.echo("\nWaiting....");
|
||||||
|
});
|
||||||
|
|
||||||
|
// Test Rule creation
|
||||||
|
casper.then(function(){
|
||||||
|
this.evaluate(function() {
|
||||||
|
$('#price-operator').val('<=').change();
|
||||||
|
return true;
|
||||||
|
});
|
||||||
|
this.sendKeys('input#price-value', '401');
|
||||||
|
this.evaluate(function() {
|
||||||
|
$('#currency-value').val('GBP').change();
|
||||||
|
return true;
|
||||||
|
});
|
||||||
|
this.click('#constraint-save-btn');
|
||||||
|
});
|
||||||
|
|
||||||
|
casper.wait(1000, 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','1st default rule found');
|
||||||
|
this.test.assertSelectorDoesntHaveText('tbody#constraint-list tr:nth-child(2)', 'If cart total amount is inferior to 400 EUR','2nd default rule found');
|
||||||
|
this.test.assertSelectorHasText('tbody#constraint-list tr:nth-child(2)', 'If cart products quantity is equals to 5','3rd rule updated found');
|
||||||
|
this.test.assertSelectorHasText('tbody#constraint-list tr:nth-child(3)', 'If cart total amount is inferior or equals to 401 GBP','4rd rule created found');
|
||||||
|
});
|
||||||
|
|
||||||
|
// Check if created rule has been well saved
|
||||||
|
casper.start(thelia2_login_coupon_update_url, function() {
|
||||||
|
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','1st default rule found');
|
||||||
|
this.test.assertSelectorDoesntHaveText('tbody#constraint-list tr:nth-child(2)', 'If cart total amount is inferior to 400 EUR','2nd default rule found');
|
||||||
|
this.test.assertSelectorHasText('tbody#constraint-list tr:nth-child(2)', 'If cart products quantity is equals to 5','3rd rule updated found');
|
||||||
|
this.test.assertSelectorHasText('tbody#constraint-list tr:nth-child(3)', 'If cart total amount is inferior or equals to 401 GBP','4rd rule created found');
|
||||||
});
|
});
|
||||||
|
|
||||||
////EDIT CHECK
|
////EDIT CHECK
|
||||||
|
|||||||
Reference in New Issue
Block a user