Working : Fix : Image Management + Document Management

This commit is contained in:
gmorel
2013-09-24 18:41:28 +02:00
parent 71888e68aa
commit 7f3367f590
15 changed files with 372 additions and 179 deletions

View File

@@ -9,6 +9,13 @@ var thelia2_login_coupon_update_url = thelia2_base_url + 'admin/coupon/update/1'
var thelia2_category_image_list_url = thelia2_base_url + 'admin/categories/update?category_id=1';
var thelia2_product_image_list_url = thelia2_base_url + 'admin/products/update?product_id=1';
var thelia2_folder_image_list_url = thelia2_base_url + 'admin/folders/update/1';
var thelia2_content_image_list_url = thelia2_base_url + 'admin/content/update/1';
//var findMyId = /([0-9]+)$/;
//var currentId;

View File

@@ -12,145 +12,145 @@
casper.test.comment('Testing coupons');
////LIST
// @todo implement
////CREATE
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.test.comment('COUPON - CREATE EMPTY');
// Click on is unlimited button
this.click("form #is-unlimited");
this.sendKeys('input#max-usage', '-2');
// cleaning expiration date default value
this.evaluate(function() {
$("#expiration-date").val('').change();
return true;
});
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.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');
});
// 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.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
////DELETE
// @todo implement
////@todo implement
//
//////CREATE
//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.test.comment('COUPON - CREATE EMPTY');
//
// // Click on is unlimited button
// this.click("form #is-unlimited");
// this.sendKeys('input#max-usage', '-2');
//
// // cleaning expiration date default value
// this.evaluate(function() {
// $("#expiration-date").val('').change();
// return true;
// });
//
// 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.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');
//});
//
//// 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.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
//
//////DELETE
//// @todo implement
//RUN
casper.run(function() {

View File

@@ -9,7 +9,7 @@
//// verbose:true
////});
//
//casper.test.comment('Testing coupons rules');
casper.test.comment('Testing coupons rules');
//
////UPDATE COUPON RULE
//casper.start(thelia2_login_coupon_update_url, function() {
@@ -306,7 +306,7 @@
// test.assertDoesntExist('tbody#constraint-list tr:nth-child(2)');
//});
//
////RUN
//casper.run(function() {
// this.test.done();
//});
//RUN
casper.run(function() {
this.test.done();
});

View File

@@ -0,0 +1,77 @@
//
//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 Image Management');
// Image list
// @todo implement
////CREATE
casper.start(thelia2_category_image_list_url, function() {
this.test.assertHttpStatus(200);
this.test.comment('Now on : ' + this.getCurrentUrl());
this.capture('tests/functionnal/casperjs/screenshot/category/images/init.png');
this.test.comment('CATEGORY : IMAGES - CREATE');
// Click on is unlimited button
this.clickLabel('Images', 'a');
});
casper.wait(1000, function() {
this.echo("\nWaiting....");
});
// Test Coupon creation if no input
casper.then(function(){
this.capture('tests/functionnal/casperjs/screenshot/category/images/init-tab-image.png');
this.test.assertExists('.existing-image tr:nth-child(1)', 'First image found');
this.click('.existing-image tr:nth-child(1) .image-update-btn');
});
casper.wait(1000, function() {
this.echo("\nWaiting....");
});
// Test Coupon creation if no input
casper.then(function(){
this.test.assertHttpStatus(200);
this.test.comment('Now on : ' + this.getCurrentUrl());
this.capture('tests/functionnal/casperjs/screenshot/category/images/read-image.png');
});
// Image add 1
// @todo implement
// Image add 4
// @todo implement
// Image read
// @todo implement
// Image update
// @todo implement
// Image delete
// @todo implement
// Image links
// @todo implement
// Image i18n
// @todo implement
//RUN
casper.run(function() {
this.test.done();
});