def add_entry(self, date, no_boxes, kg, cost, species, market, market_door, boat): self.wait() self.add_button.click() add_dialog = PurchasesAddDialog(self.webdriver) add_dialog.add_entry_and_save(date, no_boxes, kg, cost, species, market, market_door, boat) confirmation_dialog = ConfirmationMessageDialog(self.webdriver) confirmation_dialog.ok_button.click() PrintMessage('Purchase created.')
def test_C140_CheckNoMarketValidation(self): # Setup expected_error = 'The market_id field is required.' no_boxes = StringMethods.get_unique_digit() kg = StringMethods.get_unique_digit() cost = StringMethods.get_unique_digit() # Action self.add_species(self.species_name) self.add_office(self.office_name) self.add_boat(self.boat_name, self.office_name) purchases_page = PurchasesAllPage(self.driver) purchases_page.add_button.click() add_dialog = PurchasesAddDialog(self.driver) add_dialog.no_boxes.send_keys(no_boxes) add_dialog.kg.send_keys(kg) add_dialog.cost.send_keys(cost) add_dialog.species.select_input_enter(self.species_name) add_dialog.boat.select_input_enter(self.boat_name) add_dialog.save_button.click() # Assert self.assertEqual(expected_error, add_dialog.error) add_dialog.cancel_button.click() self.remove_species(self.species_name) self.remove_boat(self.boat_name)
def test_C142_CheckIncorrectMarkDoorValidation(self): # fails because we cannot add a market and the errror message is not displayed # Setup expected_error = 'Please enter' # to be completed with the correct error no_boxes = StringMethods.get_unique_digit() kg = StringMethods.get_unique_digit() cost = StringMethods.get_unique_digit() mark_door = '@' # Action self.add_species(self.species_name) self.add_office(self.office_name) self.add_boat(self.boat_name, self.office_name) self.add_market(self.market_name, self.number_of_doors) purchases_page = PurchasesAllPage(self.driver) purchases_page.add_button.click() add_dialog = PurchasesAddDialog(self.driver) add_dialog.no_boxes.send_keys(no_boxes) add_dialog.kg.send_keys(kg) add_dialog.cost.send_keys(cost) add_dialog.species.select_input_enter(self.species_name) add_dialog.boat.select_input_enter(self.boat_name) add_dialog.market.select_input_enter(self.market_name) add_dialog.market_door.send_keys(mark_door) add_dialog.save_button.click() # Assert add_dialog.is_text_present(expected_error) add_dialog.cancel_button.click() self.remove_market(self.market_name) self.remove_species(self.species_name) self.remove_boat(self.boat_name) self.remove_office(self.office_name)
def test_C133_CheckNoPurchaseDateValidation(self): # fails because no error message # Setup expected_error = 'Purchase date is required.' no_boxes = StringMethods.get_unique_digit() # Action self.all_page.add_button.click() add_dialog = PurchasesAddDialog(self.driver) add_dialog.date.click() add_dialog.date.clear() add_dialog.no_boxes.send_keys(no_boxes) add_dialog.save_button.click() # Assert self.assertEqual(expected_error, add_dialog.error) add_dialog.cancel_button.click()
def test_C139_CheckNoSpeciesValidation(self): # Setup expected_error = 'The species_id field is required.' no_boxes = StringMethods.get_unique_digit() kg = StringMethods.get_unique_digit() cost = StringMethods.get_unique_digit() # Action self.all_page.add_button.click() add_dialog = PurchasesAddDialog(self.driver) add_dialog.no_boxes.send_keys(no_boxes) add_dialog.kg.send_keys(kg) add_dialog.cost.send_keys(cost) add_dialog.save_button.click() # Assert self.assertEqual(expected_error, add_dialog.error) add_dialog.cancel_button.click()
def test_C134_CheckIncorrectPurchaseDateValidation(self): # fails because no error message # Setup expected_error = 'Please enter a purchase date in the correct format.' no_boxes = StringMethods.get_unique_digit() date = '@' # Action self.all_page.add_button.click() add_dialog = PurchasesAddDialog(self.driver) add_dialog.date.click() add_dialog.date.clear() add_dialog.date.send_keys(date) add_dialog.no_boxes.send_keys(no_boxes) add_dialog.save_button.click() # Assert self.assertEqual(expected_error, add_dialog.error) add_dialog.cancel_button.click()