def test_C130_CheckNoDuplicateEntriesAllowed(self): # fails because duplication is allowed # Setup product_name = StringMethods.get_unique_name('product_name_') display = StringMethods.get_unique_name('pn_') sage = StringMethods.get_unique_digit() default_cut = DefaultCut.whole expected_error = 'Duplicate entries are not allowed.' # Action self.products_page.add_entry(product_name, display, sage, default_cut) confirmation_dialog = ConfirmationMessageDialog(self.driver) confirmation_dialog.ok_button.click() PrintMessage('Product created.') products_page = ProductsPage(self.driver) products_page.add_button.click() add_dialog = ProductsAddDialog(self.driver) add_dialog.name.send_keys(product_name) add_dialog.display.send_keys(display) add_dialog.sage.send_keys(sage) add_dialog.default_cut.select_input(default_cut) add_dialog.save_button.click() # Assert add_dialog.is_text_present(expected_error) add_dialog.cancel_button.click() products_page.remove_entry(product_name)
def test_C67_CheckNoProductNameValidation(self): # fails because no cancel button # Setup expected_error = 'Product name is required' # Action self.products_page.add_button.click() add_dialog = ProductsAddDialog(self.driver) add_dialog.name.click() add_dialog.save_button.click() # Assert add_dialog.is_text_present(expected_error) add_dialog.cancel_button.click()
def test_C68_CheckIncorrectProductNameValidation(self): # fails because no cancel button # Setup product_name = '@' expected_error = 'Please enter a name of at least 3 characters' # Action self.products_page.add_button.click() add_dialog = ProductsAddDialog(self.driver) add_dialog.name.send_keys(product_name) add_dialog.save_button.click() # Assert add_dialog.is_text_present(expected_error) add_dialog.cancel_button.click()
def test_C69_CheckNoDisplayValidation(self): # fails because no cancel button # Setup expected_error = 'Display name is required' product_name = StringMethods.get_unique_name('product_name_') # Action self.products_page.add_button.click() add_dialog = ProductsAddDialog(self.driver) add_dialog.name.send_keys(product_name) add_dialog.display.click() add_dialog.save_button.click() # Assert add_dialog.is_text_present(expected_error) add_dialog.cancel_button.click()
def test_C71_CheckNoDefaultCutValidation(self): # fails because no cancel button and no error message # Setup expected_error = 'The default cut is required' product_name = StringMethods.get_unique_name('product_name_') display = StringMethods.get_unique_name('pn_') sage = StringMethods.get_unique_digit() # Action self.products_page.add_button.click() add_dialog = ProductsAddDialog(self.driver) add_dialog.name.send_keys(product_name) add_dialog.display.send_keys(display) add_dialog.sage.send_keys(sage) add_dialog.default_cut.click() add_dialog.save_button.click() # Assert add_dialog.is_text_present(expected_error) add_dialog.cancel_button.click()