Skip to content

Commit

Permalink
Merge pull request #10708 from hadrich-hatem/add_fixes_script
Browse files Browse the repository at this point in the history
Add some fixes to the script
  • Loading branch information
mbadrani committed Oct 31, 2018
2 parents b1f36cb + 6d5182a commit 9170a3d
Show file tree
Hide file tree
Showing 15 changed files with 115 additions and 30 deletions.
2 changes: 1 addition & 1 deletion tests/E2E/package.json
Expand Up @@ -10,7 +10,7 @@
"full-test": "node_modules/mocha/bin/mocha test/campaigns/full/*",
"test": "node_modules/mocha/bin/mocha test/campaigns/regular/*",
"install-upgrade-test": "node_modules/mocha/bin/mocha test/campaigns/install_upgrade/*",
"specific-test": "node_modules/mocha/bin/mocha test/campaigns/$path",
"specific-test": "node_modules/mocha/bin/mocha test/campaigns/$TEST_PATH",
"sanity-check": "curl http://localhost:4444/wd/hub/status | json_pp ",
"concat-files-report": "cd email_sender && ../node_modules/gulp-cli/bin/gulp.js"
},
Expand Down
2 changes: 1 addition & 1 deletion tests/E2E/test/campaigns/common_scenarios/feature.js
Expand Up @@ -36,7 +36,7 @@ module.exports = {
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));
test('should check the feature value', () => client.checkTextValue(SearchProductPage.feature_value, data.values[1]));
test('should check the feature value', () => client.checkTextValue(SearchProductPage.feature_value, data.values[1], 'equal', 2000));
}, 'attribute_and_feature');
},
updateFeature(data) {
Expand Down
22 changes: 18 additions & 4 deletions tests/E2E/test/campaigns/common_scenarios/module.js
Expand Up @@ -3,7 +3,12 @@ let promise = Promise.resolve();

module.exports = {
checkConfigPage: function (client, ModulePage, moduleTechName) {
test('should click on "Configure" button', () => client.waitForExistAndClick(ModulePage.configure_module_button.split('%moduleTechName').join(moduleTechName)));
test('should click on "Configure" button', () => {
return promise
.then(() => client.getInstalledModulesNumber(ModulePage))
.then(() => client.getModuleButtonName(ModulePage))
.then(() => client.clickOnConfigureModuleButton(ModulePage, moduleTechName));
});
test('should check the configuration page', () => client.checkTextValue(ModulePage.config_legend.replace("%moduleTechName", moduleTechName), moduleTechName));
},
installModule: function (client, ModulePage, AddProductPage, moduleTechName) {
Expand Down Expand Up @@ -35,8 +40,12 @@ module.exports = {
test('should click on "Installed Modules"', () => client.waitForVisibleAndClick(Menu.Improve.Modules.installed_modules_tabs));
test('should search for ' + moduleTechName + ' module in the installed module tab', () => client.waitAndSetValue(ModulePage.modules_search_input, moduleTechName));
test('should click on "Search" button', () => client.waitForExistAndClick(ModulePage.modules_search_button));
test('should click on module dropdown', () => client.waitForVisibleAndClick(ModulePage.action_dropdown.replace('%moduleTechName', moduleTechName)));
test('should click on "Disable" button', () => client.waitForExistAndClick(ModulePage.disable_module.split('%moduleTechName').join(moduleTechName)));
test('should click on "Disable" button', () => {
return promise
.then(() => client.getInstalledModulesNumber(ModulePage))
.then(() => client.getModuleButtonName(ModulePage))
.then(() => client.clickOnDisableModuleButton(ModulePage, moduleTechName));
});
test('should click on "Yes, disable it" button', () => client.waitForVisibleAndClick(ModulePage.confirmation_disable_module));
test('should check that the success alert message is well displayed', () => client.waitForExistAndClick(AddProductPage.close_validation_button));
},
Expand All @@ -45,7 +54,12 @@ module.exports = {
test('should click on "Installed Modules"', () => client.waitForVisibleAndClick(Menu.Improve.Modules.installed_modules_tabs));
test('should search for ' + moduleTechName + ' module in the installed module tab', () => client.waitAndSetValue(ModulePage.modules_search_input, moduleTechName));
test('should click on "Search" button', () => client.waitForExistAndClick(ModulePage.modules_search_button));
test('should click on "Enable" button', () => client.waitForExistAndClick(ModulePage.enable_module.split('%moduleTechName').join(moduleTechName)));
test('should click on "Enable" button', () => {
return promise
.then(() => client.getInstalledModulesNumber(ModulePage))
.then(() => client.getModuleButtonName(ModulePage))
.then(() => client.clickOnEnableModuleButton(ModulePage, moduleTechName));
});
test('should check that the success alert message is well displayed', () => client.waitForExistAndClick(AddProductPage.close_validation_button));
},
resetModule: function (client, ModulePage, AddProductPage, moduleName, moduleTechName) {
Expand Down
15 changes: 9 additions & 6 deletions tests/E2E/test/campaigns/common_scenarios/shop_parameters.js
Expand Up @@ -24,7 +24,7 @@ module.exports = {
resetWelcomeModule: function (OnBoarding) {
scenario('Reset the module "Welcome" ', client => {
resetModule(client, ModulePage, AddProductPage, "Welcome", "welcome");
test('should click on "RESUME" button', () => client.waitForExistAndClick(OnBoarding.resume_button, 1000));
test('should click on "RESUME" button', () => client.waitForExistAndClick(OnBoarding.resume_button, 3000));
}, 'common_client');
},
onBoardingSteps: function (OnBoarding, AddProductPage) {
Expand Down Expand Up @@ -67,8 +67,11 @@ module.exports = {
test('should click on "Next" button', () => client.waitForExistAndClick(OnBoarding.welcomeSteps.next_button));
test('should check that the step number is equal to "5"', () => client.checkTextValue(OnBoarding.welcomeSteps.tooltip_step, '5', 'contain', 3000));
test('should check the fifth onboarding-tooltip message', () => client.checkTextValue(OnBoarding.welcomeSteps.message_value, 'Yay! You just created your first product. Looks good, right?'));
test('should search for the product"' + 'productTest' + date_time + '"', () => client.waitAndSetValue(AddProductPage.catalogue_filter_by_name_input, 'productTest' + date_time));
test('should click on "Apply" button', () => client.waitForExistAndClick(AddProductPage.catalog_submit_filter));
test('should search for the product"' + 'productTest' + date_time + '"', () => {
return promise
.then(() => client.waitAndSetValue(AddProductPage.catalogue_filter_by_name_input, 'productTest' + date_time))
.then(() => client.waitForExistAndClick(AddProductPage.catalogue_submit_filter_button));
});
test('should check the product', () => client.checkTextValue(ProductList.product_name.replace("%ID", '1'), 'productTest' + date_time));
test('should click on "Reset" button', () => client.waitForExistAndClick(AddProductPage.catalog_reset_filter));
}, 'common_client');
Expand All @@ -77,14 +80,14 @@ module.exports = {
scenario('Step 1/2', client => {
test('should check that the current step has started', () => client.checkAttributeValue(OnBoarding.welcomeSteps.tutorial_step.replace("%P", '1'), 'class', 'id -done'));
test('should click on "Next" button', () => client.scrollWaitForExistAndClick(OnBoarding.welcomeSteps.next_button));
test('should check that the step number is equal to "1" ', () => client.checkTextValue(OnBoarding.welcomeSteps.tooltip_step, '1/2', 'contain', 1000));
test('should check the first onboarding-tooltip message', () => client.checkTextValue(OnBoarding.welcomeSteps.message_value, 'A good way to start is to add your own logo here!'));
test('should check that the step number is equal to "1" ', () => client.checkTextValue(OnBoarding.welcomeSteps.tooltip_step, '1/2', 'contain', 4000));
test('should check the first onboarding-tooltip message', () => client.checkTextValue(OnBoarding.welcomeSteps.message_value, 'A good way to start is to add your own logo here!'));
test('should upload the header logo', () => client.uploadPicture('image_test.jpg', OnBoarding.welcomeSteps.header_logo));
test('should click on "Next" button', () => client.scrollWaitForExistAndClick(OnBoarding.welcomeSteps.next_button));
}, 'common_client');

scenario('Step 2/2', client => {
test('should check that the step number is equal to "2"', () => client.checkTextValue(OnBoarding.welcomeSteps.tooltip_step, '2/2', 'contain', 2000));
test('should check that the step number is equal to "2"', () => client.checkTextValue(OnBoarding.welcomeSteps.tooltip_step, '2/2', 'contain', 4000));
test('should check the second onboarding-tooltip message', () => client.checkTextValue(OnBoarding.welcomeSteps.message_value, 'If you want something really special, have a look at the theme catalog!'));
test('should click on "Next" button', () => client.waitForExistAndClick(OnBoarding.welcomeSteps.next_button));
}, 'common_client');
Expand Down
Expand Up @@ -5,11 +5,11 @@ const commonFeature = require('../../common_scenarios/feature');
const commonProduct = require('../../common_scenarios/product');

let productData = {
name: 'Feat',
name: 'Feat2',
quantity: "10",
price: '5',
image_name: 'image_test.jpg',
reference: 'feat',
reference: 'feat2',
feature: {
name: 'Feature',
value: 'Feature Value'
Expand Down
2 changes: 1 addition & 1 deletion tests/E2E/test/campaigns/high/10_module/1_Zip_module.js
Expand Up @@ -27,7 +27,7 @@ scenario('Install "PrestaShop Security" module', () => {
}, 'common_client');
scenario('Check Configuration page of "PrestaShop Security" module', client => {
module_common_scenarios.checkConfigPage(client, ModulePage, "prestafraud");
}, 'common_client');
}, 'module');
scenario('Uninstall "PrestaShop Security" module', client => {
module_common_scenarios.uninstallModule(client, ModulePage, AddProductPage, "prestafraud");
}, 'common_client');
Expand Down
Expand Up @@ -19,13 +19,13 @@ scenario('Install and Uninstall Module from cross selling', () => {
}, 'common_client');
scenario('Check Configuration page of "' + module_tech_name + '"', client => {
module_common_scenarios.checkConfigPage(client, ModulePage, module_tech_name);
}, 'common_client');
}, 'module');
scenario('Disable Module "' + module_tech_name + '"', client => {
module_common_scenarios.disableModule(client, ModulePage, AddProductPage, module_tech_name);
}, 'common_client');
}, 'module');
scenario('Enable Module " ' + module_tech_name + '"', client => {
module_common_scenarios.enableModule(client, ModulePage, AddProductPage, module_tech_name);
}, 'common_client');
}, 'module');
scenario('Uninstall "' + module_tech_name + '"', client => {
module_common_scenarios.uninstallModule(client, ModulePage, AddProductPage, module_tech_name);
}, 'common_client');
Expand All @@ -37,13 +37,13 @@ scenario('Install,disable,enable and Uninstall "PayPal" module', () => {
}, 'common_client');
scenario('Check Configuration page of "PayPal" module', client => {
module_common_scenarios.checkConfigPage(client, ModulePage, "paypal");
}, 'common_client');
}, 'module');
scenario('Disable Module', client => {
module_common_scenarios.disableModule(client, ModulePage, AddProductPage, "paypal");
}, 'common_client');
}, 'module');
scenario('Enable Module', client => {
module_common_scenarios.enableModule(client, ModulePage, AddProductPage, "paypal");
}, 'common_client');
}, 'module');
scenario('Uninstall "PayPal" module', client => {
module_common_scenarios.uninstallModule(client, ModulePage, AddProductPage, "paypal");
}, 'common_client');
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions tests/E2E/test/campaigns/high/13_employee/1_employee.js
@@ -1,10 +1,11 @@
const {AccessPageBO} = require('../../../selectors/BO/access_page');
const {Employee} = require('../../../selectors/BO/employee_page');
const {Menu} = require('../../../selectors/BO/menu.js');

scenario('Create employee', client => {
test('should open the browser', () => client.open());
test('should login successfully in the Back Office', () => client.signInBO(AccessPageBO));
test('should go to "Team" menu', () => client.goToSubtabMenuPage(Employee.advanced_menu, Employee.employee_menu));
test('should go to "Team" menu', () => client.goToSubtabMenuPage(Menu.Configure.AdvancedParameters.advanced_parameters_menu, Menu.Configure.AdvancedParameters.team_submenu));
test('should click on "Add new employee" button', () => client.waitForExistAndClick(Employee.new_employee_button));
test('should set "First name" input', () => client.waitAndSetValue(Employee.first_name_input, 'Demo'));
test('should set "Last name" input', () => client.waitAndSetValue(Employee.last_name_input, 'Prestashop'));
Expand Down Expand Up @@ -38,7 +39,7 @@ scenario('Login with the new employee account', client => {

scenario('Delete an employee', client => {
test('should login successfully in the Back Office', () => client.signInBO(AccessPageBO));
test('should go to "Team" menu', () => client.goToSubtabMenuPage(Employee.advanced_menu, Employee.employee_menu));
test('should go to "Team" menu', () => client.goToSubtabMenuPage(Menu.Configure.AdvancedParameters.advanced_parameters_menu, Menu.Configure.AdvancedParameters.team_submenu));
test('should search the created employee', () => client.waitAndSetValue(Employee.email_search_input, 'demo' + date_time + '@prestashop.com'));
test('should click on "Search" button', () => client.waitForExistAndClick(Employee.search_button_team));
test('should check the result', () => client.checkTextValue(Employee.search_result,"1"));
Expand Down
66 changes: 65 additions & 1 deletion tests/E2E/test/clients/module.js
@@ -1,5 +1,5 @@
var CommonClient = require('./common_client');

let buttonText;
global.moduleObject = {
"data-name": '',
"data-tech-name": '',
Expand Down Expand Up @@ -84,6 +84,70 @@ class Module extends CommonClient {
}, 1000 * length)
});
}

getInstalledModulesNumber(ModulePage) {
return this.client
.getText(ModulePage.installed_module_span).then(function (text) {
global.nbrModule = parseInt(text[0]);
})
.getText(ModulePage.built_in_module_span).then(function (text) {
global.nbrBuilt = parseInt(text[0]);
})
.getText(ModulePage.theme_module_span).then(function (text) {
global.nbrTheme = parseInt(text[0]);
})
}

getModuleButtonName(ModulePage) {
if (nbrModule === 1)
return this.client.getText(ModulePage.action_module_installed_button).then(function (text) {
buttonText = text.toUpperCase();
});
else if (nbrBuilt === 1)
return this.client.getText(ModulePage.action_module_built_in_button).then(function (text) {
buttonText = text.toUpperCase();
});
else return this.client.getText(ModulePage.action_module_theme_button).then(function (text) {
buttonText = text.toUpperCase();
})
}

clickOnConfigureModuleButton(ModulePage, moduleTechName) {
if (buttonText === "CONFIGURE")
return this.client
.waitForExistAndClick(ModulePage.configure_module_button.split('%moduleTechName').join(moduleTechName));
else return this.client
.waitForExistAndClick(ModulePage.actions_module_dropdown)
.waitForExistAndClick(ModulePage.configure_module_button.split('%moduleTechName').join(moduleTechName))
}

clickOnEnableModuleButton(ModulePage, moduleTechName) {
if (buttonText === "ENABLE") {
return this.client
.waitForExistAndClick(ModulePage.enable_module.split('%moduleTechName').join(moduleTechName))
} else if (buttonText === "DISABLE" || buttonText === "CONFIGURE")
return this.client.pause(1000);
else {
return this.client
.waitForExistAndClick(ModulePage.actions_module_dropdown)
.waitForExistAndClick(ModulePage.enable_module.split('%moduleTechName').join(moduleTechName), 3000)
}
}

clickOnDisableModuleButton(ModulePage, moduleTechName) {
if (buttonText === "DISABLE") {
return this.client
.waitForExistAndClick(ModulePage.disable_module.split('%moduleTechName').join(moduleTechName))
}
else if (buttonText === "ENABLE")
return this.client.pause(1000);
else {
return this.client
.waitForExistAndClick(ModulePage.actions_module_dropdown)
.waitForExistAndClick(ModulePage.disable_module.split('%moduleTechName').join(moduleTechName), 3000)
}
}

}

module.exports = Module;
4 changes: 2 additions & 2 deletions tests/E2E/test/clients/product/product.js
Expand Up @@ -127,10 +127,10 @@ class Product extends CommonClient {

selectFeature(addProductPage, name, value) {
return this.client
.scrollWaitForExistAndClick(addProductPage.feature_select)
.scrollWaitForExistAndClick(addProductPage.feature_select, 150, 2000)
.waitAndSetValue(addProductPage.select_feature_created, name)
.waitForExistAndClick(addProductPage.result_feature_select.replace('%ID', 0))
.pause(2000)
.pause(4000)
.selectByVisibleText(addProductPage.feature_value_select, value);
}

Expand Down
Expand Up @@ -5,7 +5,7 @@ module.exports = {
image_input: '//*[@id="logo"]',
meta_title_input: '//*[@id="meta_title_1"]',
meta_description_input: '//*[@id="meta_description_1"]',
meta_keywords_input:'//*[@id="fieldset_0"]/div[2]/div[7]/div/div/div[1]/div[1]/div/input', // '//*[@id="manufacturer_form"]/div/div[2]/div[7]/div/div/input',
meta_keywords_input:'//*[@id="fieldset_0"]/div[2]/div[7]/div/div/div[1]/div[1]/div/input',
active_button: '//*[@id="manufacturer_form"]/div/div[2]/div[8]/div/span/label[1]',
save_button: '//*[@id="manufacturer_form_submit_btn"]',
short_description_input: '(//*[@id="manufacturer_form"]//div[@class="mce-tinymce mce-container mce-panel"])[1]',
Expand Down
2 changes: 0 additions & 2 deletions tests/E2E/test/selectors/BO/employee_page.js
@@ -1,7 +1,5 @@
module.exports = {
Employee:{
advanced_menu: '//*[@id="subtab-AdminAdvancedParameters"]/a',
employee_menu: '//*[@id="subtab-AdminParentEmployees"]/a',
new_employee_button: '#page-header-desc-employee-new_employee',
first_name_input: '#firstname',
last_name_input: '#lastname',
Expand Down

0 comments on commit 9170a3d

Please sign in to comment.