Skip to content

Commit

Permalink
Merge pull request #9111 from hadrich-hatem/languages
Browse files Browse the repository at this point in the history
Languages
  • Loading branch information
mbadrani committed Sep 14, 2018
2 parents be3320a + f83dd3b commit 1c41a40
Show file tree
Hide file tree
Showing 28 changed files with 356 additions and 38 deletions.
4 changes: 2 additions & 2 deletions tests/E2E/test/campaigns/common_scenarios/attribute.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ module.exports = {
},
checkAttributeInFO(productName, data) {
scenario('Check that the attribute is well created/updated in the Front Office', client => {
test('should set the shop language to "English"', () => client.changeLanguage('english'));
test('should set the shop language to "English"', () => client.changeLanguage());
test('should search for the product', () => client.searchByValue(SearchProductPage.search_input, SearchProductPage.search_button, productName + date_time));
test('should go to the product page', () => client.waitForExistAndClick(SearchProductPage.product_result_name));
test('should check the product attribute name', () => client.checkTextValue(SearchProductPage.attribute_name, data.name + date_time));
Expand Down Expand Up @@ -88,7 +88,7 @@ module.exports = {
},
checkDeletedAttributeInFO(productName) {
scenario('Check that the attribute is well deleted in Front Office', client => {
test('should set the shop language to "English"', () => client.changeLanguage('english'));
test('should set the shop language to "English"', () => client.changeLanguage());
test('should search for the product', () => client.searchByValue(SearchProductPage.search_input, SearchProductPage.search_button, productName + date_time));
test('should go to the product page', () => client.waitForExistAndClick(SearchProductPage.product_result_name));
test('should check that the attribute has been deleted in the Front Office', () => client.checkDeleted(SearchProductPage.attribute_name));
Expand Down
4 changes: 2 additions & 2 deletions tests/E2E/test/campaigns/common_scenarios/feature.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ module.exports = {
},
checkFeatureInFO(productName, data) {
scenario('Check that the feature is well created/updated in the Front Office', client => {
test('should set the shop language to "English"', () => client.changeLanguage('english'));
test('should set the shop language to "English"', () => client.changeLanguage());
test('should search for the product', () => client.searchByValue(SearchProductPage.search_input, SearchProductPage.search_button, productName + date_time));
test('should go to the product page', () => client.waitForExistAndClick(SearchProductPage.product_result_name));
test('should check the feature name', () => client.checkTextValue(SearchProductPage.feature_name, data.name + date_time));
Expand Down Expand Up @@ -72,7 +72,7 @@ module.exports = {
},
checkDeletedFeatureInFO(productName) {
scenario('Check that the feature does not exist in the Front Office', client => {
test('should set the shop language to "English"', () => client.changeLanguage('english'));
test('should set the shop language to "English"', () => client.changeLanguage());
test('should search for the product', () => client.searchByValue(SearchProductPage.search_input, SearchProductPage.search_button, productName + date_time));
test('should go to the product page', () => client.waitForExistAndClick(SearchProductPage.product_result_name));
test('should check that the feature has been deleted in the Front Office', () => client.checkDeleted(SearchProductPage.feature_name));
Expand Down
140 changes: 140 additions & 0 deletions tests/E2E/test/campaigns/common_scenarios/localization.js

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ scenario('Delete product', () => {
}, 'product/product');

scenario('check that the product "DP' + date_time + ' doesn\'t exist in the front office', client => {
test('should set the shop language to "English"', () => client.changeLanguage('english'));
test('should set the shop language to "English"', () => client.changeLanguage());
test('should search for the product', () => client.searchByValue(SearchProductPage.search_input, SearchProductPage.search_button, productData.name + date_time));
test('should check that the product "DP' + date_time + '" doesn\'t exist ', () => client.isNotExisting(SearchProductPage.product_result_name));
}, 'product/product');
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
const {AccessPageBO} = require('../../../../selectors/BO/access_page');
const {AccessPageFO} = require('../../../../selectors/FO/access_page');
const common_scenarios = require('../../../common_scenarios/localization');

let languageData = [{
name: 'Spanish',
iso_code: 'ES',
language_code: 'ES',
date_format: 'Y-m-d',
date_format_full: 'Y-m-d H:i:s',
flag_file: 'language_spanish_flag.png',
no_picture_file: 'no_image_available.png',
is_rtl: 'off',
status: 'on'
}, {
name: 'Farsi',
iso_code: 'FA',
language_code: 'FA',
date_format: 'Y-m-d',
date_format_full: 'Y-m-d H:i:s',
flag_file: 'language_farsi_flag.png',
no_picture_file: 'no_image_available.png',
is_rtl: 'on',
status: 'on'
}], languageEditedData = [{
name: 'Spanishh',
iso_code: 'ES',
language_code: 'ES',
date_format: 'Y-m-d',
date_format_full: 'Y-m-d H:i:s',
flag_file: 'language_spanish_flag.png',
no_picture_file: 'no_image_available.png',
is_rtl: 'off',
status: 'on'
}, {
name: 'Spanishh',
iso_code: 'ES',
language_code: 'ES',
date_format: 'Y-m-d',
date_format_full: 'Y-m-d H:i:s',
flag_file: 'language_spanish_flag.png',
no_picture_file: 'no_image_available.png',
is_rtl: 'off',
status: 'off'
}];

scenario('Create, edit, delete and check "Languages" in the Back Office', () => {
scenario('Open the browser and connect to the Back Office', client => {
test('should open the browser', () => client.open());
test('should log in successfully in the Back Office', () => client.signInBO(AccessPageBO));
}, 'common_client');

scenario('Test 1: Create, check language in the Back Office and check it in the Front Office', () => {
common_scenarios.createLanguage(languageData[0]);
common_scenarios.checkLanguageBO(languageData[0]);
scenario('Go to the Front Office', client => {
test('should go to the Front Office', () => client.accessToFO(AccessPageFO));
}, 'common_client');
common_scenarios.checkLanguageFO(languageData[0]);
}, 'common_client');

scenario('Test 2: Create, check language in the Back Office and check it in the Front Office', () => {
scenario('Go back to the Back Office', client => {
test('should go back to the Back Office', () => client.accessToBO(AccessPageBO));
}, 'common_client');
common_scenarios.createLanguage(languageData[1]);
common_scenarios.checkLanguageBO(languageData[1]);
common_scenarios.generateRtlStylesheet();
scenario('Go to the Front Office', client => {
test('should go to the Front Office', () => client.accessToFO(AccessPageFO));
}, 'common_client');
common_scenarios.checkLanguageFO(languageData[1]);
}, 'common_client');

scenario('Test 3: Edit the created language in the Back Office and check it in the Front Office', () => {
scenario('Go back to the Back Office', client => {
test('should go back to the Back Office', () => client.accessToBO(AccessPageBO));
}, 'common_client');
common_scenarios.editLanguage(languageData[0].name, languageEditedData[0]);
scenario('Go to the Front Office', client => {
test('should go to the Front Office', () => client.accessToFO(AccessPageFO));
}, 'common_client');
common_scenarios.checkLanguageFO(languageEditedData[0]);
scenario('Go back to the Back Office', client => {
test('should go back to the Back Office', () => client.accessToBO(AccessPageBO));
}, 'common_client');
common_scenarios.editLanguage(languageData[0].name, languageEditedData[1]);
scenario('Go to the Front Office', client => {
test('should go to the Front Office', () => client.accessToFO(AccessPageFO));
}, 'common_client');
common_scenarios.checkLanguageFO(languageEditedData[1]);
}, 'common_client');

scenario('Test 4: Delete the created languages in the Back Office and check it in the Front Office', () => {
scenario('Go back to the Back Office', client => {
test('should go back to the Back Office', () => client.accessToBO(AccessPageBO));
}, 'common_client');
common_scenarios.deleteLanguage(languageData[1].name);
common_scenarios.deleteLanguage(languageEditedData[1].name);
scenario('Go to the Front Office', client => {
test('should go to the Front Office', () => client.accessToFO(AccessPageFO));
}, 'common_client');
common_scenarios.checkLanguageFO(languageData[1], true);
}, 'common_client');
scenario('Logout from the Back Office', client => {
test('should go back to the Back Office', () => client.accessToBO(AccessPageBO));
test('should logout successfully from the Back Office', () => client.signOutBO());
}, 'common_client');
}, 'common_client', true);
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ scenario('Check double catalog price rules', () => {

scenario('Check Catalog Price Rules in the Front Office', client => {
test('should login successfully in the Front Office', () => client.signInFO(AccessPageFO));
test('should change front office language to english', () => client.changeLanguage('english'));
test('should set the shop language to "English"', () => client.changeLanguage());
test('should go to the first product page', () => client.waitForExistAndClick(productPage.first_product));
test('should verify that the discount is equal to "18%"', () => client.checkTextValue(productPage.product_discount_details, catalogPriceRule[0].reduction, "contain"));
test('should set quantity to "48"', () => client.waitAndSetValue(productPage.first_product_quantity, 48));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ scenario('Check "Specific price"', () => {
test('should login successfully in the Front Office', () => client.signInFO(AccessPageFO));
}, 'product/product');
scenario('Check the created "Specific price" in the Front Office', client => {
test('should change front office language to english', () => client.changeLanguage('english'));
test('should set the shop language to "English"', () => client.changeLanguage());
test('should search for the product', () => client.searchByValue(SearchProductPage.search_input, SearchProductPage.search_button, productData["name"] + date_time));
test('should verify that the discount is equal to "-19.6%"', () => client.checkTextValue(SearchProductPage.product_result_discount, '-19.6%'));
test('should go to the product page', () => client.waitForExistAndClick(SearchProductPage.product_result_name));
Expand Down Expand Up @@ -102,7 +102,7 @@ scenario('Check "Catalog price rule"', () => {
test('should login successfully in the Front Office', () => client.signInFO(AccessPageFO));
}, 'common_client');
scenario('Check the created "Catalog price rule" in the Front Office', client => {
test('should change front office language to english', () => client.changeLanguage('english'));
test('should set the shop language to "English"', () => client.changeLanguage());
test('should search for the product', () => client.searchByValue(SearchProductPage.search_input, SearchProductPage.search_button, productData["name"] + date_time));
test('should verify that the discount is equal to "-19.67%"', () => client.checkTextValue(SearchProductPage.product_result_discount, '-19.67%'));
test('should go to the product page', () => client.waitForExistAndClick(SearchProductPage.product_result_name));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ scenario('Check the total price after applying vouchers in the Front Office', ()
test('should login successfully in the Front Office', () => client.signInFO(AccessPageFO));
}, 'discount');
scenario('Check the total price of the shopping cart', client => {
test('should change front office language to english', () => client.changeLanguage('english'));
test('should set the shop language to "English"', () => client.changeLanguage());
test('should search for the product "A"', () => client.searchByValue(SearchProductPage.search_input, SearchProductPage.search_button, productData.name + date_time));
test('should go to the product page', () => client.waitForExistAndClick(SearchProductPage.product_result_name));
test('should set the "Quantity" input', () => client.waitAndSetValue(productPage.first_product_quantity, 3));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ scenario('Check the product discount in the Front Office', () => {
.then(() => client.waitForExistAndClick(AccessPageBO.shopname))
.then(() => client.switchWindow(1));
});
test('should set the shop language to "English"', () => client.changeLanguage('english'));
test('should set the shop language to "English"', () => client.changeLanguage());
test('should search for the product "' + productData.name + date_time + '"', () => client.searchByValue(SearchProductPage.search_input, SearchProductPage.search_button, productData.name + date_time));
test('should go to the product page', () => client.waitForExistAndClick(SearchProductPage.product_result_name));
test('should check that the first quantity is equal to "10"', () => client.checkTextValue(productPage.product_discounts_table.replace('%R', 1).replace('%D', 1), productData.pricing[0].starting_at));
Expand Down Expand Up @@ -181,7 +181,7 @@ scenario('Check the product discount in the Front Office', () => {
.then(() => client.waitForExistAndClick(AccessPageBO.shopname))
.then(() => client.switchWindow(1));
});
test('should set the shop language to "English"', () => client.changeLanguage('english'));
test('should set the shop language to "English"', () => client.changeLanguage());
test('should search for the product "' + productData.name + date_time + '"', () => client.searchByValue(SearchProductPage.search_input, SearchProductPage.search_button, productData.name + date_time));
test('should go to the product page', () => client.waitForExistAndClick(SearchProductPage.product_result_name));
test('should check that the first quantity is equal to "10"', () => client.checkTextValue(productPage.product_discounts_table.replace('%R', 1).replace('%D', 1), productData.pricing[0].starting_at));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ scenario('Check the standard product in the Front Office', () => {
}, 'product/product');

scenario('Check that the standard product is well displayed in the Front Office', client => {
test('should set the shop language to "English"', () => client.changeLanguage('english'));
test('should set the shop language to "English"', () => client.changeLanguage());
test('should search for the product', () => client.searchByValue(SearchProductPage.search_input, SearchProductPage.search_button, data.standard.name + date_time));
test('should go to the product page', () => client.waitForExistAndClick(SearchProductPage.product_result_name));
test('should check that the product name is equal to "' + (data.standard.name + date_time).toUpperCase() + '"', () => client.checkTextValue(productPage.product_name, (data.standard.name + date_time).toUpperCase()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ scenario('Check the pack product in the Front Office', () => {
test('should login successfully in the Front Office', () => client.signInFO(AccessPageFO));
}, 'product/product');
scenario('Check that the pack product is well displayed in the Front Office', client => {
test('should set the shop language to "English"', () => client.changeLanguage('english'));
test('should set the shop language to "English"', () => client.changeLanguage());
test('should search for the product', () => client.searchByValue(SearchProductPage.search_input, SearchProductPage.search_button, data.pack.name + date_time));
test('should go to the product page', () => client.waitForExistAndClick(SearchProductPage.product_result_name));
test('should check that the product name is equal to "' + (data.pack.name + date_time).toUpperCase() + '"', () => client.checkTextValue(productPage.product_name, (data.pack.name + date_time).toUpperCase()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ scenario('Check the product with combination in the Front Office', () => {
test('should login successfully in the Front Office', () => client.signInFO(AccessPageFO));
}, 'product/product');
scenario('Check that the product with combination is well displayed in the Front Office', client => {
test('should set the shop language to "English"', () => client.changeLanguage('english'));
test('should set the shop language to "English"', () => client.changeLanguage());
test('should search for the product', () => client.searchByValue(SearchProductPage.search_input, SearchProductPage.search_button, data.standard.name + 'C' + date_time));
test('should go to the product page', () => client.waitForExistAndClick(SearchProductPage.product_result_name));
test('should check that the product name is equal to "' + (data.standard.name + 'C' + date_time).toUpperCase() + '"', () => client.checkTextValue(productPage.product_name, (data.standard.name + 'C' + date_time).toUpperCase()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ scenario('Check the virtual product in the Front Office', () => {
test('should login successfully in the Front Office', () => client.signInFO(AccessPageFO));
}, 'product/product');
scenario('Check that the pack product is well displayed in the Front Office', client => {
test('should set the shop language to "English"', () => client.changeLanguage('english'));
test('should set the shop language to "English"', () => client.changeLanguage());
test('should search for the product', () => client.searchByValue(SearchProductPage.search_input, SearchProductPage.search_button, data.virtual.name + date_time));
test('should go to the product page', () => client.waitForExistAndClick(SearchProductPage.product_result_name));
test('should check that the product name is equal to "' + (data.virtual.name + date_time).toUpperCase() + '"', () => client.checkTextValue(productPage.product_name, (data.virtual.name + date_time).toUpperCase()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ scenario('Check that the shopping cart dosen\'t allow checkout of zero quantity
.then(() => client.waitForExistAndClick(AccessPageBO.shopname))
.then(() => client.switchWindow(1));
});
test('should set the shop language to "English"', () => client.changeLanguage('english'));
test('should set the shop language to "English"', () => client.changeLanguage());
test('should search for the product', () => client.searchByValue(SearchProductPage.search_input, SearchProductPage.search_button, productData.name + date_time));
test('should go to the product page', () => client.waitForExistAndClick(SearchProductPage.product_result_name));
test('should click on "Add to cart" button', () => client.waitForExistAndClick(CheckoutOrderPage.add_to_cart_button));
Expand Down
2 changes: 1 addition & 1 deletion tests/E2E/test/campaigns/regular/03_create_product.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ scenario('Check the created product in the Front Office', () => {
test('should login successfully in the Front Office', () => client.signInFO(AccessPageFO));
}, 'product/product');
scenario('Check that the created product is well displayed in the Front Office', client => {
test('should set the shop language to "English"', () => client.changeLanguage('english'));
test('should set the shop language to "English"', () => client.changeLanguage());
test('should search for the product', () => client.searchByValue(SearchProductPage.search_input, SearchProductPage.search_button, productData.name + date_time));
test('should go to the product page', () => client.waitForExistAndClick(SearchProductPage.product_result_name));
test('should check that the product name is equal to "' + (productData.name + date_time).toUpperCase() + '"', () => client.checkTextValue(productPage.product_name, (productData.name + date_time).toUpperCase()));
Expand Down
Loading

0 comments on commit 1c41a40

Please sign in to comment.