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. 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."