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

Check the created customer in the front office and delete customer with both mode #9124

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
28 changes: 28 additions & 0 deletions tests/E2E/test/campaigns/common_scenarios/address.js
@@ -0,0 +1,28 @@
const {Menu} = require('../../selectors/BO/menu.js');
const {Addresses} = require('../../selectors/BO/customers/addresses');
const {BO} = require('../../selectors/BO/customers/index');

module.exports = {
createCustomerAddress: function (customerData) {
scenario('Create a new "Address"', client => {
test('should go to the "Customers" page', () => client.goToSubtabMenuPage(Menu.Sell.Customers.customers_menu, Menu.Sell.Customers.addresses_submenu));
test('should click on add new address', () => client.waitForExistAndClick(Addresses.new_address_button));
test('should set "Email" input', () => client.waitAndSetValue(Addresses.email_input, date_time+customerData.email_address));
test('should set "Identification number" input', () => client.waitAndSetValue(Addresses.id_number_input, '0123456789'));
test('should set "Address alias" input', () => client.waitAndSetValue(Addresses.address_alias_input, 'Ma super addresse'));
test('should check that the "First name" input is "'+customerData.first_name+'"', () => client.checkAttributeValue(Addresses.first_name_input, 'value', customerData.first_name));
test('should check that the "Last name" input is "'+customerData.last_name+'"', () => client.checkAttributeValue(Addresses.last_name_input, 'value', customerData.last_name));
test('should set "Company" input', () => client.waitAndSetValue(Addresses.company, 'Presta'));
test('should set "VAT number" input', () => client.waitAndSetValue(Addresses.VAT_number_input, '0123456789'));
test('should set "Address" input', () => client.waitAndSetValue(Addresses.address_input, "12 rue d'amsterdam" + date_time));
test('should set "Second address" input', () => client.waitAndSetValue(Addresses.address_second_input, "RDC"));
test('should set "Postal code" input', () => client.waitAndSetValue(Addresses.zip_code_input, "75009"));
test('should set "City" input', () => client.waitAndSetValue(Addresses.city_input, "Paris"));
test('should set "Pays" input', () => client.waitAndSelectByValue(Addresses.country_input, "8"));
test('should set "Home phone" input', () => client.waitAndSetValue(Addresses.phone_input, "0123456789"));
test('should set "Other information" input', () => client.waitAndSetValue(Addresses.other_input, "azerty"));
test('should click on "Save" button', () => client.scrollWaitForExistAndClick(Addresses.save_button, 50));
test('should verify the appearance of the green validation', () => client.checkTextValue(BO.success_panel, '×\nSuccessful creation.'));
}, 'customer');
}
};
10 changes: 9 additions & 1 deletion tests/E2E/test/campaigns/common_scenarios/customer.js
@@ -1,5 +1,6 @@
const {Menu} = require('../../selectors/BO/menu.js');
const {Customer} = require('../../selectors/BO/customers/customer');
const {accountPage} = require('../../selectors/FO/add_account_page');
const {BO} = require('../../selectors/BO/customers/index');

let promise = Promise.resolve();
Expand Down Expand Up @@ -34,12 +35,13 @@ module.exports = {
.then(() => client.waitAndSelectByValue(Customer.month_select, customerData.birthday.month))
.then(() => client.waitAndSelectByValue(Customer.years_select, customerData.birthday.year));
});
test('should activate "Partner offers" option ', () => client.waitForExistAndClick(Customer.Partner_offers));
test('should click on "Save" button', () => client.waitForExistAndClick(Customer.save_button));
test('should verify the appearance of the green validation', () => client.checkTextValue(BO.success_panel, '×\nSuccessful creation.'));
}, 'customer');
},
checkCustomerBO: function (customerData) {
scenario('Check the customer creation in the back office', client => {
scenario('Check the customer creation in the Back Office', client => {
test('should check the email existence in the "Customers list"', () => {
return promise
.then(() => client.isVisible(Customer.customer_filter_by_email_input))
Expand Down Expand Up @@ -113,5 +115,11 @@ module.exports = {
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.'));
}, 'customer');
},
checkCustomerFO: function (client, customerData) {
test('should check the customer "First name"', () => client.checkAttributeValue(accountPage.firstname_input, 'value', customerData.first_name));
test('should check the customer "Last name"', () => client.checkAttributeValue(accountPage.lastname_input, 'value', customerData.last_name));
test('should check that the customer "Email" is equal to "' + date_time + customerData.email_address + '"', () => client.checkAttributeValue(accountPage.email_input, 'value', date_time + customerData.email_address));
test('should check that the customer "Birthday" is equal to "' + customerData.birthday.month + '/' + customerData.birthday.day + '/' + customerData.birthday.year + '"', () => client.checkAttributeValue(accountPage.birthday_input, 'value', customerData.birthday.month + '/' + customerData.birthday.day + '/' + customerData.birthday.year, "contain"));
}
};
2 changes: 1 addition & 1 deletion tests/E2E/test/campaigns/common_scenarios/order.js
Expand Up @@ -41,7 +41,7 @@ module.exports = {

if (authentication === "create_account" || authentication === "guest") {
scenario('Create new account', client => {
test('should choose a "Social title"', () => client.waitForExistAndClick(accountPage.radio_button_gender));
test('should choose a "Social title"', () => client.waitForExistAndClick(accountPage.gender_radio_button));
test('should set the "First name" input', () => client.waitAndSetValue(accountPage.firstname_input, data.customer.firstname));
test('should set the "Last name" input', () => client.waitAndSetValue(accountPage.lastname_input, data.customer.lastname));
if (authentication === "create_account") {
Expand Down

This file was deleted.

This file was deleted.

@@ -0,0 +1,155 @@
const {AccessPageBO} = require('../../../../selectors/BO/access_page');
const {AccessPageFO} = require('../../../../selectors/FO/access_page');
const {accountPage} = require('../../../../selectors/FO/add_account_page');
const {Menu} = require('../../../../selectors/BO/menu.js');
const {Customer} = require('../../../../selectors/BO/customers/customer');
const {Addresses} = require('../../../../selectors/BO/customers/addresses');
const {BO} = require('../../../../selectors/BO/customers/index');
const common_scenarios = require('../../../common_scenarios/customer');
const common_scenarios_address = require('../../../common_scenarios/address');
let promise = Promise.resolve();

let customerData = {
first_name: 'demo',
last_name: 'demo',
email_address: global.adminEmail,
password: '123456789',
birthday: {
day: '18',
month: '12',
year: '1991'
}
};

let editCustomerData = {
first_name: 'customerFirstName',
last_name: 'customerLastName',
email_address: 'customeremail@prestashop.com',
password: '123456789',
birthday: {
day: '31',
month: '10',
year: '1994'
}
};

scenario('Create, Edit, delete "Customer"', () => {
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));
}, 'customer');

common_scenarios.createCustomer(customerData);
common_scenarios.checkCustomerBO(customerData);

scenario('Check the customer creation in the Front Office', client => {
test('should open the Front Office in new window', () => {
return promise
.then(() => client.waitForExistAndClick(AccessPageBO.shopname))
.then(() => client.switchWindow(1));
});
test('should set the shop language to "English"', () => client.changeLanguage());
test('should click on "sign in" button', () => client.waitForExistAndClick(AccessPageFO.sign_in_button));
test('should set the "Email" input', () => client.waitAndSetValue(AccessPageFO.login_input, date_time + customerData.email_address));
test('should set the "Password" input', () => client.waitAndSetValue(AccessPageFO.password_inputFO, customerData.password));
test('should click on "Sign In" button', () => client.waitForExistAndClick(AccessPageFO.login_button));
test('should click on "Information" button', () => client.waitForExistAndClick(AccessPageFO.identity_link));
common_scenarios.checkCustomerFO(client, customerData);
test('should go to the Back Office', () => client.switchWindow(0));
}, 'customer');

common_scenarios.editCustomer(customerData.email_address, editCustomerData);
common_scenarios.checkCustomerBO(editCustomerData);

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());
common_scenarios.checkCustomerFO(client, editCustomerData);
test('should go to the Back Office', () => client.switchWindow(0));
}, 'customer');

common_scenarios_address.createCustomerAddress(editCustomerData);
scenario('Check the address creation', client => {
test('should check the existence of the filter address input', () => client.isVisible(Addresses.filter_by_address_input));
test('should search the customer by address', () => client.searchByAddress(Addresses, date_time));
}, 'customer');
scenario('Open addresses menu in a new window', client => {
test('should open the menu "Customers - Addresses"', () => client.middleClick(Menu.Sell.Customers.addresses_submenu));
}, 'customer');

common_scenarios.deleteCustomer(editCustomerData.email_address);

scenario('Check the customer deletion in the Back Office', client => {
test('should go to "Customers" page', () => client.goToSubtabMenuPage(Menu.Sell.Customers.customers_menu, Menu.Sell.Customers.customers_submenu));
test('should search for the customer email in the "Customers list"', () => {
return promise
.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));
}, 'customer');

scenario('Verify that the address related to the deleted customer doesn\'t exist', client => {
test('should go to "Addresses" page', () => client.switchWindow(2));
test('should refresh the page', () => client.refresh());
test('should check that the deleted customer address doesn\'t exist', () => client.isNotExisting(Customer.customer_link.replace('%ID', date_time)));
test('should go to Customers page', () => client.switchWindow(1));
}, 'customer');

scenario('Check the ability to create the same deleted customer from the Front Office', client => {
test('should click on shop logo', () => client.waitForExistAndClick(AccessPageFO.logo_home_page));
test('should set the language of shop to "English"', () => client.changeLanguage());
test('should click on "Sign In" button', () => client.waitForExistAndClick(AccessPageFO.sign_in_button));
test('should click on "No account? Create one here" button', () => client.waitForExistAndClick(AccessPageFO.create_account_button));
test('should check "Mrs" radio button', () => client.waitForExistAndClick(accountPage.gender_radio_button));
test('should set the "First Name" input', () => client.waitAndSetValue(accountPage.firstname_input, editCustomerData.first_name));
test('should set the "Last Name" input', () => client.waitAndSetValue(accountPage.lastname_input, editCustomerData.last_name));
test('should set the "Email" input', () => client.waitAndSetValue(accountPage.email_input, date_time + editCustomerData.email_address));
test('should set the "Password" input', () => client.waitAndSetValue(accountPage.password_input, editCustomerData.password));
test('should set the "Birthday" input', () => client.waitAndSetValue(accountPage.birthday_input, editCustomerData.birthday.month + '/' + editCustomerData.birthday.day + '/' + editCustomerData.birthday.year));
test('should click on "Save" button', () => client.waitForExistAndClick(accountPage.save_account_button));
}, 'customer');

scenario('Delete the created customer ', client => {
test('should go to "Addresses" page', () => client.switchWindow(0));
test('should go to "Customers" page', () => client.goToSubtabMenuPage(Menu.Sell.Customers.customers_menu, Menu.Sell.Customers.customers_submenu));
test('should search for the customer email in the "Customers list"', () => {
return promise
.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 click on "Delete" button', () => {
return promise
.then(() => client.waitForExistAndClick(Customer.dropdown_toggle))
.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 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.'));
test('should go to the Front Office', () => client.switchWindow(1));
}, 'customer');

scenario('Check the ability to create the same deleted customer from the Front Office', client => {
test('should click on shop logo', () => client.waitForExistAndClick(AccessPageFO.logo_home_page));
test('should set the language of shop to "English"', () => client.changeLanguage());
test('should click on "Sign In" button', () => client.waitForExistAndClick(AccessPageFO.sign_in_button));
test('should click on "No account? Create one here" button', () => client.waitForExistAndClick(AccessPageFO.create_account_button));
test('should set the "Social title" to Mrs', () => client.waitForExistAndClick(accountPage.gender_radio_button));
test('should set the "First Name" input', () => client.waitAndSetValue(accountPage.firstname_input, editCustomerData.first_name));
test('should set the "Last Name" input', () => client.waitAndSetValue(accountPage.lastname_input, editCustomerData.last_name));
test('should set the "Email" input', () => client.waitAndSetValue(accountPage.email_input, date_time + editCustomerData.email_address));
test('should set the "Password" input', () => client.waitAndSetValue(accountPage.password_input, editCustomerData.password));
test('should set the "Birthday" input', () => client.waitAndSetValue(accountPage.birthday_input, editCustomerData.birthday.month + '/' + editCustomerData.birthday.day + '/' + editCustomerData.birthday.year));
test('should click on the "Save" button', () => client.waitForExistAndClick(accountPage.save_account_button));
test('should check that the warning message appears', () => client.checkTextValue(accountPage.danger_alert, 'is already used', 'contain'));
test('should go to the Back Office', () => client.switchWindow(0));
}, 'customer');

common_scenarios.createCustomer(editCustomerData);
common_scenarios.deleteCustomerWithBulkActions(editCustomerData.email_address);

scenario('Logout from the Back Office', client => {
test('should logout successfully from the Back Office', () => client.signOutBO());
}, 'customer');
}, 'customer', true);

This file was deleted.

Expand Up @@ -109,7 +109,7 @@ scenario('Create, edit, delete "CMS page"', () => {
common_scenarios.deletePage();
scenario('Check the review page', client => {
test('should go to the review page in the Front Office', () => client.switchWindow(1));
test('should check that "page-not-found" appear', () => client.checkTextValue(AccessPageFO.not_found_erreur_message, 'The page you are looking for was not found.'));
test('should check that "page-not-found" appear', () => client.checkTextValue(AccessPageFO.not_found_error_message, 'The page you are looking for was not found.'));
test('should go to the Back Office', () => client.switchWindow(0));
}, 'design');
}, 'design');
Expand Down
29 changes: 11 additions & 18 deletions tests/E2E/test/campaigns/high/09_customer/2_create_address.js
@@ -1,22 +1,12 @@
const {AccessPageBO} = require('../../../selectors/BO/access_page');
const {Addresses} = require('../../../selectors/BO/customers/addresses');

const common_scenarios = require('../../common_scenarios/addresses');
const common_scenarios = require('../../common_scenarios/address');

let addressData = {
email: 'pub@prestashop.com',
id_number: '123456789',
address_alias: 'Ma super address',
first_name: 'John',
last_name: 'DOE',
company: 'prestashop',
vat_number: '0123456789',
address: '12 rue d\'amsterdam',
second_address: 'RDC',
ZIP: '75009',
city: 'Paris',
country: 'France',
home_phone: '0123456789',
other: 'azerty'
let customerData = {
first_name: 'demo',
last_name: 'demo',
email_address: 'demo@prestashop.com',
};

scenario('Create "Address"', () => {
Expand All @@ -25,9 +15,12 @@ scenario('Create "Address"', () => {
test('should login successfully in the Back Office', () => client.signInBO(AccessPageBO));
}, 'customer');

common_scenarios.createAddress(addressData);
common_scenarios.checkAddressBO(addressData);
common_scenarios.createCustomerAddress(customerData);

scenario('Check the address creation', client => {
test('should check the existence of the filter address input', () => client.isVisible(Addresses.filter_by_address_input));
test('should search the customer by address', () => client.searchByAddress(Addresses, date_time));
}, 'customer');
scenario('Logout from the Back Office', client => {
test('should logout successfully from the Back Office', () => client.signOutBO());
}, 'customer');
Expand Down