Esempio n. 1
0
	def delete_invoice(self):
		"""
		Delete the invoice!
		"""
        	try:
        		self.driver.find_element_by_id(RepeatingInvoicePageLocators.get_delete_button_locator_id()).click()
            		self.driver.find_element_by_id(RepeatingInvoicePageLocators.get_modal_ok_button()).click()
        	except NoSuchElementException:
			return False

		if self.driver.find_element_by_class_name(RepeatingInvoicePageLocators.get_invoice_deleted_locator()).text == '1 repeating transaction deleted':
			return True

		return False
Esempio n. 2
0
	def new_invoice_created(self):
		"""
		Verify that a new invoice has been created.
		If yes, return True; False otherwise.

		Observe the parent and child paths here. I had
		to split my XPath query into two because of the way
		the page was built.
		"""
		try:
			if self.is_visible(RepeatingInvoicePageLocators.get_new_invoice_created_locator()):
				parentPath = self.driver.find_element_by_xpath(RepeatingInvoicePageLocators.get_new_invoice_created_locator())
				childPath = parentPath.find_element_by_xpath('.//p[contains(@id, "ext-")]')
		except NoSuchElementException:
			return False

		# The childPath element (locator) is introduced because of the weirdness
		# and inconsistencies of the way the UI behaves!
		if childPath.text == 'Repeating Template Saved. Click to view.':
			return True

		return False
Esempio n. 3
0
	def find_invoice(self):
		"""
		Select the first instance of 'Sherlock Holmes!'
        	If the delete button (see XPath above) is present

        	If you rid yourself of the break, you select all
		invoices with the key word.
		"""
		if self.is_visible(RepeatingInvoicePageLocators.get_delete_button_locator_xpath()):
			rows = self.driver.find_elements(By.TAG_NAME, 'tr')

			for row in rows:
				if row.find_element_by_xpath('.//td[2]/a').text == 'Sherlock Holmes':
					row.find_element_by_xpath('.//td[1]/input').click()
					break
		else:
			assert False
Esempio n. 4
0
	def create_new_invoice(self):
		if self.is_visible(RepeatingInvoicePageLocators.get_create_new_invoice_locator_xpath()):
			self.driver.find_element(By.PARTIAL_LINK_TEXT, RepeatingInvoicePageLocators.get_create_new_invoice_locator_linktext()).click()