Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Click on read more #8941

Merged
merged 1 commit into from Sep 13, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
29 changes: 29 additions & 0 deletions tests/E2E/test/campaigns/common_scenarios/module.js
Expand Up @@ -79,5 +79,34 @@ module.exports = {
.then(() => client.checkSortDesc((parseInt((tab["modules_number"].match(/[0-9]+/g)[0])))))
}
});
},
clickOnReadMore: function(ModulePage, moduleName, moduleTechName) {
scenario('Check that the click on "Read more" button is working well', client => {
test('should go to "Module catalog" page', () => client.goToSubtabMenuPage(Menu.Improve.Modules.modules_menu, Menu.Improve.Modules.modules_catalog_submenu));
test('should search for the module "' + moduleName + '"', () => {
return promise
.then(() => client.waitAndSetValue(ModulePage.module_selection_input, moduleTechName))
.then(() => client.waitForExistAndClick(ModulePage.modules_search_button));
});
test('should click on "Read more" link', () => client.waitForExistAndClick(ModulePage.ReadMoreModal.read_more_link.replace("%moduleTechName", moduleTechName)));
test('should check that the modal is well opened', () => client.waitForVisible(ModulePage.ReadMoreModal.overview_content.replace("%moduleTechName", moduleTechName)));
/**
* This scenario is based on the bug described in this ticket
* http://forge.prestashop.com/browse/BOOM-4951
*/
test('should check that the content of "Overview" tab is not empty', () => client.checkTextValue(ModulePage.ReadMoreModal.overview_content.replace("%moduleTechName", moduleTechName), '', 'notequal', 1000));
/**
* End
*/
test('should click on "Additional information" tab in the modal', () => client.waitForExistAndClick(ModulePage.ReadMoreModal.module_readmore_tabs.replace("%moduleTechName", moduleTechName).replace('%NAME', 'Additional information')));
test('should check that the content of "Additional information" tab is not empty', () => client.checkTextValue(ModulePage.ReadMoreModal.additional_content.replace("%moduleTechName", moduleTechName), '', 'notequal', 1000));
test('should click on "Overview" tab in the modal', () => client.waitForExistAndClick(ModulePage.ReadMoreModal.module_readmore_tabs.replace("%moduleTechName", moduleTechName).replace('%NAME', 'Overview')));
test('should check that the content of "Overview" tab is not empty', () => client.checkTextValue(ModulePage.ReadMoreModal.overview_content.replace("%moduleTechName", moduleTechName), '', 'notequal', 1000));
test('should click on "Features" tab in the modal', () => client.waitForExistAndClick(ModulePage.ReadMoreModal.module_readmore_tabs.replace("%moduleTechName", moduleTechName).replace('%NAME', 'Features')));
test('should check that the content of "Features" tab is not empty', () => client.checkTextValue(ModulePage.ReadMoreModal.features_content.replace("%moduleTechName", moduleTechName), '', 'notequal', 1000));
test('should click on "Changelog" tab in the modal', () => client.waitForExistAndClick(ModulePage.ReadMoreModal.module_readmore_tabs.replace("%moduleTechName", moduleTechName).replace('%NAME', 'Changelog')));
test('should check that the content of "Changelog" tab is not empty', () => client.checkTextValue(ModulePage.ReadMoreModal.changelog_content.replace("%moduleTechName", moduleTechName), '', 'notequal', 1000));
test('should click on "Close" button in the modal', () => client.waitForExistAndClick(ModulePage.ReadMoreModal.close_modal_button.replace("%moduleTechName", moduleTechName), 2000));
}, 'common_client');
}
};
74 changes: 74 additions & 0 deletions tests/E2E/test/campaigns/full/10_module/8_read_more_module.js
@@ -0,0 +1,74 @@
const {AccessPageBO} = require('../../../selectors/BO/access_page');
const {ModulePage} = require('../../../selectors/BO/module_page');
const {Menu} = require('../../../selectors/BO/menu');
const {AddProductPage} = require('../../../selectors/BO/add_product_page');
const commonModule = require('../../common_scenarios/module');
let promise = Promise.resolve();

scenario('Check the click on "Read more" button', () => {
scenario('Login in the Back Office', client => {
test('should open the browser', () => client.open());
test('should login successfully in the Back Office', () => client.signInBO(AccessPageBO));
}, 'common_client');

scenario('Install MBO module if it\'s not installed', client => {
test('should go to "Module manager" page', () => client.goToSubtabMenuPage(Menu.Improve.Modules.modules_menu, Menu.Improve.Modules.modules_catalog_submenu));
test('should set the name of the module in the search input', () => client.waitAndSetValue(ModulePage.module_selection_input, 'ps_mbo'));
test('should click on "Search" button', () => client.waitForExistAndClick(ModulePage.selection_search_button));
test('should install the module if it\'s exist', () => {
return promise
.then(() => client.isVisible(ModulePage.install_button.replace("%moduleTechName", 'ps_mbo')))
.then(() => {
if (global.isVisible) {
scenario('Install module', client => {
test('should click on "Install" button', () => client.waitForExistAndClick(ModulePage.install_button.replace("%moduleTechName", 'ps_mbo')));
test('should check that the success alert message is well displayed', () => client.waitForExistAndClick(AddProductPage.close_validation_button));
test('should click on "Installed Modules"', () => client.waitForVisibleAndClick(Menu.Improve.Modules.installed_modules_tabs));
test('should search for "ps_mbo" module in the installed module tab', () => client.waitAndSetValue(ModulePage.modules_search_input, 'ps_mbo'));
test('should click on "Search" button', () => client.waitForExistAndClick(ModulePage.modules_search_button));
test('should check if the module "ps_mbo" was installed', () => client.isExisting(ModulePage.installed_module_div.replace('%moduleTechName', 'ps_mbo')));
}, 'common_client');
} else {
return promise.then(() => client.pause(0));
}
});
});
}, 'common_client');
commonModule.clickOnReadMore(ModulePage, "Mailchimp", module_tech_name);

scenario('Uninstall MBO module if it\'s installed', client => {
test('should go to "Module manager" page', () => {
return promise
.then(() => client.pause(3000))
.then(() => client.goToSubtabMenuPage(Menu.Improve.Modules.modules_menu, Menu.Improve.Modules.modules_services_submenu));
});
test('should search for the module "ps_mbo"', () => {
return promise
.then(() => client.waitAndSetValue(ModulePage.module_selection_input, 'ps_mbo'))
.then(() => client.waitForExistAndClick(ModulePage.modules_search_button));
});
test('should uninstall the module if it\'s exist', () => {
return promise
.then(() => client.isVisible(ModulePage.action_dropdown.replace('%moduleTechName', 'ps_mbo')))
.then(() => {
if (global.isVisible) {
scenario('Uninstall module', client => {
test('should click on module dropdown', () => client.waitForVisibleAndClick(ModulePage.action_dropdown.replace('%moduleTechName', 'ps_mbo')));
test('should click on "Uninstall" button', () => client.waitForExistAndClick(ModulePage.uninstall_button.split('%moduleTechName').join('ps_mbo')));
test('should click on "Yes, uninstall it" button', () => client.waitForVisibleAndClick(ModulePage.uninstall_module_modal));
test('should check that the success alert message is well displayed', () => client.waitForExistAndClick(AddProductPage.close_validation_button));
test('should check that the backdrop is hidden', () => client.checkIsNotVisible(ModulePage.backdrop_modale));
test('should check if the module "ps_mbo" was uninstalled', () => client.checkTextValue(ModulePage.built_in_module_span, "0", "contain"));
}, 'common_client');
} else {
return promise.then(() => client.pause(0));
}
});
});
}, 'common_client');
commonModule.clickOnReadMore(ModulePage, "Mailchimp", module_tech_name);

scenario('Logout from the Back Office', client => {
test('should logout successfully from the Back Office', () => client.signOutBO());
}, 'common_client');
}, 'common_client', true);
4 changes: 2 additions & 2 deletions tests/E2E/test/selectors/BO/menu.js
Expand Up @@ -38,7 +38,7 @@ module.exports = {
merchandise_returns_submenu: '#subtab-AdminReturn'
},
Stats: {
stats_menu: '//*[@id="subtab-AdminStats"]/a',
stats_menu: '//*[@id="subtab-AdminStats"]/a'
}
},
Improve: {
Expand All @@ -48,7 +48,7 @@ module.exports = {
installed_modules_tabs: '//*[@id="subtab-AdminModulesManage"]',
notifications_tabs: '//*[@id="subtab-AdminModulesNotifications"]',
selection_tab: '//*[@id="subtab-AdminModulesCatalog"]',
modules_catalog_submenu: '#subtab-AdminAddonsCatalog',
modules_catalog_submenu: '#subtab-AdminParentModulesCatalog'
},
Design: {
design_menu: '//*[@id="subtab-AdminParentThemes"]/a',
Expand Down
9 changes: 9 additions & 0 deletions tests/E2E/test/selectors/BO/module_page.js
Expand Up @@ -72,6 +72,15 @@ module.exports = {
selected_item_list : '//*[@id="items"]//option[@value="CAT%ID"]',
save_button: '//*[@id="module_form_submit_btn"]'
},
ReadMoreModal: {
read_more_link: '//*[@id="modules-list-container-all"]/div[contains(@data-tech-name, "%moduleTechName")]//a[text()="Read more"]',
overview_content: '//*[@id="overview-%moduleTechName"]/p',
additional_content: '//*[@id="additional-%moduleTechName"]//li',
features_content: '//*[@id="features-%moduleTechName"]//li',
changelog_content: '//*[@id="changelog-%moduleTechName"]//li',
module_readmore_tabs: '//*[@id="modules-list-container-all"]/div[contains(@data-tech-name, "%moduleTechName")]//a[contains(text(), "%NAME")]',
close_modal_button: '//*[@id="module-modal-read-more-%moduleTechName"]//button[@class="close"]'
},

//Module name in "addons.prestashop.com" after clicking on "Dicover" button
module_name: '//*[@id="product_content"]/div[@class="product_head"]//h1'
Expand Down