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

Fix broken selectors and logic for the test suite 9 (customer) #13570

Merged
merged 9 commits into from
Apr 29, 2019
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
* International Registered Trademark & Property of PrestaShop SA
*#}

<div class="text-center">
<div class="text-center grid-table-empty">
<p class="mb-0 mt-2"><i class="material-icons">warning</i></p>
<p class="mb-2">{{ 'No records found'|trans({}, 'Admin.Global') }}</p>
</div>
19 changes: 9 additions & 10 deletions tests/E2E/test/campaigns/common_scenarios/customer.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ module.exports = {
});
test('should activate "Partner offers" option ', () => client.waitForExistAndClick(Customer.Partner_offers));
test('should click on "Save" button', () => client.scrollWaitForExistAndClick(Customer.save_button));
test('should verify the appearance of the green validation', () => client.checkTextValue(BO.success_panel, '×\nSuccessful creation.'));
test('should verify the appearance of the green validation', () => client.checkTextValue(BO.success_panel, 'Successful creation.'));
}, 'customer');
},
checkCustomerBO: function (customerData) {
Expand All @@ -67,7 +67,7 @@ module.exports = {
.then(() => client.isVisible(Customer.customer_filter_by_email_input))
.then(() => client.search(Customer.customer_filter_by_email_input, date_time + customerEmail));
});
test('should click on "Edit" button', () => client.waitForExistAndClick(Customer.edit_button));
test('should click on "Edit" button', () => client.waitForExistAndClickJs(Customer.edit_button));
test('should choose the "Social title" radio', () => client.waitForExistAndClick(Customer.social_title_button));
test('should set the new "First name" input', () => client.waitAndSetValue(Customer.first_name_input, editCustomerData.first_name));
test('should set the new "Last name" input', () => client.waitAndSetValue(Customer.last_name_input, editCustomerData.last_name));
Expand All @@ -80,7 +80,7 @@ module.exports = {
.then(() => client.waitAndSelectByValue(Customer.years_select, editCustomerData.birthday.year));
});
test('should click on "Save" button', () => client.scrollWaitForExistAndClick(Customer.save_button));
test('should verify the appearance of the green validation', () => client.checkTextValue(BO.success_panel, '×\nSuccessful update.'));
test('should verify the appearance of the green validation', () => client.checkTextValue(BO.success_panel, 'Successful update.'));
}, 'customer');
},
deleteCustomer: function (customerEmail) {
Expand All @@ -94,12 +94,12 @@ module.exports = {
test('should click on "Delete" button', () => {
return promise
.then(() => client.scrollWaitForExistAndClick(Customer.dropdown_toggle, 50, 2000))
.then(() => client.waitForExistAndClick(Customer.delete_button, 1000));
.then(() => client.waitForExistAndClickJs(Customer.delete_button, 1000));
});
test('should accept the currently displayed alert dialog', () => client.alertAccept());
test('should choose the option that allows customers to register again with the same email address', () => client.waitForExistAndClick(Customer.delete_first_option));
//test('should accept the currently displayed alert dialog', () => client.alertAccept());
test('should choose the option that allows customers to register again with the same email address', () => client.waitForVisibleAndClick(Customer.delete_first_option));
test('should click on "Delete" button', () => client.waitForExistAndClick(Customer.delete_confirmation_button));
test('should verify the appearance of the green validation', () => client.checkTextValue(BO.success_panel, '×\nSuccessful deletion.', 'equal', 2000));
test('should verify the appearance of the green validation', () => client.checkTextValue(BO.success_panel, 'Successful deletion.', 'equal', 2000));
}, 'customer');
},
deleteCustomerWithBulkActions: function (customerEmail) {
Expand All @@ -113,10 +113,9 @@ module.exports = {
test('should select the searched client', () => client.waitForExistAndClick(Customer.select_customer));
test('should click on the "Bulk actions" button', () => client.waitForExistAndClick(Customer.bulk_actions_button));
test('should click on the "Delete selected" button', () => client.waitForExistAndClick(Customer.bulk_actions_delete_button));
test('should accept the currently displayed alert dialog', () => client.alertAccept());
test('should choose the option that allows customers to register again with the same email address', () => client.waitForExistAndClick(Customer.delete_first_option));
test('should choose the option that allows customers to register again with the same email address', () => client.waitForVisibleAndClick(Customer.delete_first_option));
test('should click on "Delete" button', () => client.waitForExistAndClick(Customer.delete_confirmation_button));
test('should verify the appearance of the green validation', () => client.checkTextValue(BO.success_panel, '×\nThe selection has been successfully deleted.'));
test('should verify the appearance of the green validation', () => client.checkTextValue(BO.success_panel, 'The selection has been successfully deleted.'));
}, 'customer');
},
checkCustomerFO: function (client, customerData) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,9 @@ scenario('Create, Edit, delete "Customer"', () => {

scenario('Check that the customer information is updated in the Front Office', client => {
test('should go to the Front Office', () => client.switchWindow(1));
test('should refresh the page', () => client.refresh());
test('should set the "Email" input', () => client.waitAndSetValue(AccessPageFO.login_input, date_time + editCustomerData.email_address));
test('should set the "Password" input', () => client.waitAndSetValue(AccessPageFO.password_inputFO, editCustomerData.password));
test('should click on "Sign In" button', () => client.waitForExistAndClick(AccessPageFO.login_button));
common_scenarios.checkCustomerFO(client, editCustomerData);
test('should go to the Back Office', () => client.switchWindow(0));
}, 'customer');
Expand All @@ -93,7 +95,7 @@ scenario('Create, Edit, delete "Customer"', () => {
.then(() => client.isVisible(Customer.customer_filter_by_email_input))
.then(() => client.search(Customer.customer_filter_by_email_input, date_time + editCustomerData.email_address));
});
test('should check that there is no result', () => client.isExisting(Customer.empty_list_icon));
test('should check that there is no result', () => client.checkTextValue(Customer.empty_list_icon, "No records found", "equal", 500));
}, 'customer');

scenario('Verify that the address related to the deleted customer doesn\'t exist', client => {
Expand Down Expand Up @@ -130,10 +132,9 @@ scenario('Create, Edit, delete "Customer"', () => {
.then(() => client.scrollWaitForExistAndClick(Customer.dropdown_toggle, 50, 1000))
.then(() => client.waitForExistAndClick(Customer.delete_button, 1000));
});
test('should accept the currently displayed alert dialog', () => client.alertAccept());
test('should choose the option that Doesn\'t allows customers to register again with the same email address', () => client.waitForExistAndClick(Customer.delete_second_option));
test('should choose the option that doesn\'t allow customers to register again with the same email address', () => client.waitForVisibleAndClick(Customer.delete_second_option));
test('should click on "Delete" button', () => client.waitForExistAndClick(Customer.delete_confirmation_button, 2000));
test('should verify the appearance of the green validation', () => client.checkTextValue(BO.success_panel, '×\nSuccessful deletion.', 'equal', 2000));
test('should verify the appearance of the green validation', () => client.checkTextValue(BO.success_panel, 'Successful deletion.', 'equal', 2000));
test('should go to the Front Office', () => client.switchWindow(1));
}, 'customer');

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,15 @@ scenario('Configure shop in the Back Office', () => {
test('should set the "Enable shop" parameter to "NO"', () => client.waitForExistAndClick(ShopParameters.enable_shop.replace("%ID", '0')));
test('should set the "Custom maintenance" textarea', () => client.setEditorText(ShopParameters.textarea_input.replace("%ID", 1), 'We are currently disabled our shop and will be back really soon.'));
test('should switch to the "French" language', () => client.waitForExistAndClick(ShopParameters.language_option.replace("%LANG", 'Fr').replace("%ID", "1")));
test('should set the "Custom maintenance" textarea', () => client.setEditorText(ShopParameters.textarea_input.replace("%ID", 2), 'Nous avons actuellement désactivés notre boutique et serons de retour très bientôt.'));
test('should set the "Custom maintenance" textarea', () => client.setEditorText(ShopParameters.textarea_input.replace("%ID", 2), 'Nous avons actuellement désactivé notre boutique et serons de retour très bientôt.'));
test('should click on "Save" button', () => client.waitForExistAndClick(ShopParameters.save_button));
test('should verify the appearance of the green validation', () => client.checkTextValue(ShopParameters.success_box, "Successful update."));
test('should go to the front office', () => {
return promise
.then(() => client.waitForExistAndClick(AccessPageBO.shopname))
.then(() => client.switchWindow(1));
});
test('should check that the shop is disabled', () => client.checkTextValue(ShopParameters.maintenance_message, 'Nous avons actuellement désactivés notre boutique et serons de retour très bientôt.', 'contain'));
test('should check that the shop is disabled', () => client.checkTextValue(ShopParameters.maintenance_message, 'Nous avons actuellement désactivé notre boutique et serons de retour très bientôt.', 'contain'));
}, 'common_client');

scenario('Enable shop in the Back Office', client => {
Expand Down
26 changes: 13 additions & 13 deletions tests/E2E/test/selectors/BO/customers/customer.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,21 @@ module.exports = {
password_input: '//*[@id="customer_password"]',
days_select: '//*[@id="customer_birthday_day"]',
month_select: '//*[@id="customer_birthday_month"]',
years_select: '//*[@id="customere_birthday_year"]',
years_select: '//*[@id="customer_birthday_year"]',
save_button: '//*[@id="main-div"]//button[contains(text(),"Save")]',
customer_filter_by_email_input: '//*[@id="form-customer"]//input[@name="customerFilter_email"]',
email_address_value: '//*[@id="form-customer"]//td[%ID]',
customer_filter_by_email_input: '//*[@id="customer_email"]',
email_address_value: '//*[@id="customer_filter_form"]//tbody//td[%ID]',
reset_button: '//*[@id="table-customer"]//button[@name="submitResetcustomer"]',
edit_button: '//*[@id="form-customer"]//a[@title="Edit"]',
dropdown_toggle: '//*[@id="form-customer"]//button[@data-toggle="dropdown"]',
delete_button: '//*[@id="form-customer"]//a[@title="Delete"]',
delete_first_option: '//*[@id="deleteMode_real"]',
delete_second_option: '//*[@id="deleteMode_deleted"]',
delete_confirmation_button: '//*[@id="content"]//input[@value="Delete"]',
select_customer: '//*[@id="form-customer"]//input[@name="customerBox[]"]',
bulk_actions_button: '//*[@id="bulk_action_menu_customer"]',
bulk_actions_delete_button: '//*[@id="form-customer"]//div[contains(@class,"bulk-actions")]//a[contains(@onclick,"submitBulkdeletecustomer")]',
empty_list_icon: '//*[@id="table-customer"]//div[contains(@class,"list-empty-msg")]',
edit_button: '//*[@id="customer_grid_table"]//a[@data-original-title="Edit"]',
dropdown_toggle: '//*[@id="customer_grid_table"]//a[@data-toggle="dropdown"]',
delete_button: '//*[@id="customer_grid_table"]//a[contains(@class,"js-delete-customer-row-action")]',
delete_first_option: '//input[@id="delete_customers_delete_method_0"]',
delete_second_option: '//input[@id="delete_customers_delete_method_1"]',
delete_confirmation_button: '//*[@id="customer_grid_delete_customers_modal"]//button[contains(@class, "js-submit-delete-customers")]',
select_customer: '//table[@id="customer_grid_table"]//td[contains(@class, "bulk_action-type")]/div/label',
bulk_actions_button: '//button[contains(@class, "js-bulk-actions-btn")]',
bulk_actions_delete_button: '//button[@id="customer_grid_bulk_action_delete_selection"]',
empty_list_icon: '//*[@id="customer_grid_table"]//div[contains(@class, "grid-table-empty")]/p[2]',
customer_link: '//*[@id="table-address"]//td[contains(text(),"%ID")]',
Partner_offers: '//label[contains(@for,"customer_is_partner_offers_subscribed_1")]',
first_name_value:'//*[@id="table-customer"]//tr[%ID]/td[4]',
Expand Down
16 changes: 8 additions & 8 deletions tests/E2E/test/selectors/BO/pages_form.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,19 @@ module.exports = {
},
Catalog: {
product_form: '//*[@id="product_catalog_list"]',
category_form: '//*[@id="form-category"]',
category_form: '//*[@id="category_grid"]',
empty_category_form: '//*[@id="form-empty_categories"]',
attribute_form: '//*[@id="form-attribute_group"]',
feature_form: '//*[@id="form-feature"]',
manufacturer_form: '//*[@id="form-manufacturer"]',
manufacturer_form: '//*[@id="manufacturer_grid"]',
supplier_form: '//*[@id="subtab-AdminSuppliers"]',
attachment_form: '//*[@id="form-attachment"]',
cart_rule_form: '//*[@id="form-cart_rule"]',
cart_price_rule_form: '//*[@id="form-specific_price_rule"]',
search_box: '//*[@id="search"]' // Search products in stock and movements page
},
Customers: {
customer_form: '//*[@id="form-customer"]',
customer_form: '//*[@id="customer_grid"]',
address_form: '//*[@id="form-address"]'
},
CustomerService: {
Expand All @@ -44,7 +44,7 @@ module.exports = {
design_form: '//*[@id="configuration_form"]',
catalog_theme: '//div[contains(@class, "addons-catalog-theme")]/div[1]',
configuration_fieldset: '//*[@id="configuration_fieldset_appearance"] | //*[@id="main-div"]//form[@name="shop_logos"]',
cms_category_form: '//*[@id="form-cms_category"]',
cms_category_form: '//*[@id="cms_page_category_grid"]',
position_module_form: '//*[@id="module-positions-form"]',
image_type_form: '//*[@id="form-image_type"]',
configuration_link_form: '//*[@id="configuration_form"]',
Expand All @@ -68,7 +68,7 @@ module.exports = {
zone_form: '//*[@id="form-zone"]',
country_form: '//*[@id="form-country"]',
state_form: '//*[@id="form-state"]',
tax_from: '//*[@id="form-tax"]',
tax_from: '//*[@id="tax_grid"]',
tax_rules_from: '//*[@id="form-tax_rules_group"]',
translation_form: '//*[@id="main-div"]//form[@name="modify_translations"]',
},
Expand All @@ -81,7 +81,7 @@ module.exports = {
customers_form: '//*[@id="configuration_form"]',
groups_form: '//*[@id="form-group"]',
titles_form: '//*[@id="form-gender"]',
contact_form: '//*[@id="form-contact"]',
contact_form: '//*[@id="contact_grid"]',
stores_form: '//*[@id="form-store"]',
meta_form: '//*[@id="form-meta"]', //SEO & URLs form
search_engine_form: '//*[@id="form-search_engine"]',
Expand All @@ -97,8 +97,8 @@ module.exports = {
administration_form: '//form[contains(@class, "form-horizontal")]',
mail_form: '//*[@id="email_logs_grid_panel"] | //*[@id="form_mail"]',
preview_import_form: '//form[contains(@class, "import")]',
employee_form: '//*[@id="form-employee"]', //team page
profiles_form: '//*[@id="form-profile"]',
employee_form: '//*[@id="employee_grid"]', //team page
profiles_form: '//*[@id="profile_grid"]',
permissions_form: '//*[@id="access_form"]',
request_sql_form: '//*[@id="sql_request_grid_panel"]', //database page
log_form: '//*[@id="logs_grid_panel"]',
Expand Down