def testEditCustomer(self): alt_first_name = self.configuration['customer_tests']['alt_first_name'] # Edit the customer's first name edit_page = CustomerEdit(self.browser, self.configuration['base_url']) edit_page.open(self.customer_id) edit_page.change_fields(first_name=alt_first_name) edit_page.save_changes() # Verify that the customer's first name was changed edit_page.open(self.customer_id) fields = edit_page.get_fields() assert fields['first_name'] == alt_first_name, \ "Could not verify that customer was edited."
def testDeleteCustomer(self): # Count the number of customers before creation. target_url = self.configuration['base_url'] + "/admin/order_manager/customer/" index_page = CustomerIndex(self.browser, target_url) num_customers_before_deletion = index_page.count_customers() # Delete the customer target_url = "%s/admin/order_manager/customer/%d" % (self.configuration['base_url'], self.customer_id) edit_page = CustomerEdit(self.browser, target_url) edit_page.delete_customer() edit_page.wait_for_text_to_load_in_element(css_selector="div#content > h1", text_to_wait_for="Select customer to change") # Verify that the customer is gone from the index page num_customers_after_deletion = index_page.count_customers() self.validate((num_customers_after_deletion == num_customers_before_deletion - 1), error_message="Could not verify that customer was deleted.")
def testEditCustomer(self): alt_first_name = self.configuration['customer_tests']['alt_first_name'] # Edit the customer's first name target_url = "%s/admin/order_manager/customer/%d" % ( self.configuration['base_url'], self.customer_id) edit_page = CustomerEdit(self.browser, target_url) edit_page.change_input_field_by_id(field_id='id_first_name', new_value=alt_first_name) edit_page.save_changes() # Verify that the customer's first name was changed edit_page.refresh() first_name = edit_page.get_input_field_by_id('id_first_name') self.validate( (first_name == alt_first_name), error_message="Could not verify that customer was edited.")
def testEditCustomer(self): alt_first_name = self.configuration['customer_tests']['alt_first_name'] # Edit the customer's first name target_url = "%s/admin/order_manager/customer/%d" % (self.configuration['base_url'], self.customer_id) edit_page = CustomerEdit(self.browser, target_url) edit_page.change_input_field_by_id(field_id='id_first_name', new_value=alt_first_name) edit_page.save_changes() # Verify that the customer's first name was changed edit_page.refresh() first_name = edit_page.get_input_field_by_id('id_first_name') self.validate((first_name == alt_first_name), error_message="Could not verify that customer was edited.")
def testDeleteCustomer(self): # Count the number of customers before creation. index_page = CustomerIndex(self.browser, self.configuration['base_url']) index_page.open() customers_before_deletion = index_page.get_customer_elements() # Delete the customer edit_page = CustomerEdit(self.browser, self.configuration['base_url']) edit_page.open(self.customer_id) edit_page.delete_customer() # Wait for index page to load WebDriverWait(self.browser, 20).until( EC.text_to_be_present_in_element( (By.CSS_SELECTOR, "div#content > h1"), "Select customer to change" ) ) # Verify that the customer is gone from the index page customers_after_deletion = index_page.get_customer_elements() assert len(customers_after_deletion) == len(customers_before_deletion) - 1, \ "Could not verify that customer was deleted."
def testDeleteCustomer(self): # Count the number of customers before creation. target_url = self.configuration[ 'base_url'] + "/admin/order_manager/customer/" index_page = CustomerIndex(self.browser, target_url) num_customers_before_deletion = index_page.count_customers() # Delete the customer target_url = "%s/admin/order_manager/customer/%d" % ( self.configuration['base_url'], self.customer_id) edit_page = CustomerEdit(self.browser, target_url) edit_page.delete_customer() edit_page.wait_for_text_to_load_in_element( css_selector="div#content > h1", text_to_wait_for="Select customer to change") # Verify that the customer is gone from the index page num_customers_after_deletion = index_page.count_customers() self.validate( (num_customers_after_deletion == num_customers_before_deletion - 1), error_message="Could not verify that customer was deleted.")