def test_load_new_message(self):
		success = False
		while not success:
			click("Click here")
			failure = Text("Action unsuccesful, please try again").exists()
			success = Text("Action successful").exists()
			self.assertTrue(failure or success)
 def test_load_new_message(self):
     success = False
     while not success:
         click("Click here")
         failure = Text("Action unsuccesful, please try again").exists()
         success = Text("Action successful").exists()
         self.assertTrue(failure or success)
	def test_open_new_window(self):
		windows = find_all(Window())
		self.assertEqual(len(windows), 1)
		self.assertTrue(Text("Opening a new window").exists())
		main_window = windows[0]
		click("Click Here")
		windows = find_all(Window())
		self.assertEqual(len(windows), 2)
		self.assertTrue(Text("New Window").exists())
		switch_to(main_window)
		self.assertTrue(Text("Opening a new window").exists())
Exemplo n.º 4
0
	def test_table_sorting_example2(self):
		last_names = [
			txt.web_element.text for txt in find_all(S("td.last-name"))
		]
		self.assertTrue(len(last_names) == 4)
		# assert its not sorted
		self.assertNotEqual(last_names, sorted(last_names))
		click(S("span.last-name"))
		sorted_last_names = [
			elem.web_element.text for elem in find_all(S("td.last-name"))
		]
		self.assertEqual(sorted_last_names, sorted(last_names))
 def test_retrieve_password(self):
     email_address = self._get_temporary_email_address()
     write(email_address, into="E-mail")
     click("Retrieve Password")
     self.assertTrue(Text("Your e-mail's been sent!").exists())
     set_driver(self.emailbox_driver)
     wait_until(self._refresh_and_check_if_exists,
                timeout_secs=60,
                interval_secs=1)
     self.assertTrue(Text("*****@*****.**").exists())
     kill_browser()
     set_driver(self.test_case_driver)
Exemplo n.º 6
0
	def test_menu_navigation(self):
		self.assertTrue(Text("JQueryUI - Menu").exists())
		hover("Enabled")
		click("Back to JQuery UI")
		self.assertFalse(Text("JQueryUI - Menu").exists())
		self.assertTrue(
			Text(
				"JQuery UI is many things, but one thing specifically that "
				"causes automation challenges is their set of Widgets"
			).exists()
		)
		click("Menu")
		self.assertTrue(Text("JQueryUI - Menu").exists())
	def test_retrieve_password(self):
		email_address = self._get_temporary_email_address()
		write(email_address, into="E-mail")
		click("Retrieve Password")
		self.assertTrue(Text("Your e-mail's been sent!").exists())
		set_driver(self.emailbox_driver)
		wait_until(
			self._refresh_and_check_if_exists,
			timeout_secs=60, interval_secs=1
		)
		self.assertTrue(Text("*****@*****.**").exists())
		kill_browser()
		set_driver(self.test_case_driver)
Exemplo n.º 8
0
	def test_table_sorting_example1(self):
		last_names = [
			txt.value
			for txt in find_all(Text(below="Last Name", above="Example 2"))
		]
		self.assertTrue(len(last_names) == 4)
		# assert its not sorted
		self.assertNotEqual(last_names, sorted(last_names))
		click("Last Name")
		sorted_last_names = [
			txt.value
			for txt in find_all(Text(below="Last Name", above="Example 2"))
		]
		self.assertEqual(sorted_last_names, sorted(last_names))
Exemplo n.º 9
0
 def test_fake_geolocation(self):
     get_driver().execute_script(
         'window.navigator.geolocation.getCurrentPosition = '
         'function(success){ '
         'var position = {"coords" : { '
         '"latitude": "1", '
         '"longitude": "2"'
         '}'
         '}; '
         'success(position);}')
     click('Where am I?')
     latitude = S("#lat-value").web_element.text
     self.assertEqual(latitude, u"1")
     longitude = S("#long-value").web_element.text
     self.assertEqual(longitude, u"2")
	def test_fake_geolocation(self):
		get_driver().execute_script(
			'window.navigator.geolocation.getCurrentPosition = '
				'function(success){ '
					'var position = {"coords" : { '
						'"latitude": "1", '
						'"longitude": "2"'
						'}'
				'}; '
			'success(position);}'
		)
		click('Where am I?')
		latitude = S("#lat-value").web_element.text
		self.assertEqual(latitude, u"1")
		longitude = S("#long-value").web_element.text
		self.assertEqual(longitude, u"2")
Exemplo n.º 11
0
	def test_no_credentials(self):
		click("Login")
		self.assertTrue(Text("Your username is invalid!").exists())
	def test_nested_frames(self):
		click("Nested Frames")
		self.assertTrue(Text("LEFT").exists())
		self.assertTrue(Text("MIDDLE").exists())
		self.assertTrue(Text("RIGHT").exists())
		self.assertTrue(Text("BOTTOM").exists())
	def test_iframe(self):
		click("iFrame")
		self.assertTrue(Text("Your content goes here.").exists())
Exemplo n.º 14
0
 def test_upload_file(self):
     attach_file(
         __file__,
         "Choose a file here on your system that you would like to upload!")
     click("Upload")
     self.assertTrue(Text("File Uploaded!").exists())
	def test_element_on_page_that_is_hidden(self):
		click("Example 1: Element on page that is hidden")
		self._load_and_assert()
Exemplo n.º 16
0
 def _load_and_assert(self):
     click("Start")
     wait_until(lambda: not Text("Loading...").exists())
     self.assertTrue(Text("Hello World!").exists())
Exemplo n.º 17
0
 def test_element_rendered_after_the_fact(self):
     click("Example 2: Element rendered after the fact")
     self._load_and_assert()
 def test_use_wysiwyg_editor(self):
     self.assertTrue(Text("Your content goes here.").exists())
     click("File")
     click("New document")
     write("Hello Helium!")
     self.assertTrue(Text("Hello Helium!").exists())
	def test_element_rendered_after_the_fact(self):
		click("Example 2: Element rendered after the fact")
		self._load_and_assert()
Exemplo n.º 20
0
	def _logout(self):
		click("Logout")
		self.assertTrue(Text("You logged out of the secure area!").exists())
Exemplo n.º 21
0
 def test_element_on_page_that_is_hidden(self):
     click("Example 1: Element on page that is hidden")
     self._load_and_assert()
	def _load_and_assert(self):
		click("Start")
		wait_until(lambda: not Text("Loading...").exists())
		self.assertTrue(Text("Hello World!").exists())
	def _refresh_and_check_if_exists(self):
		click("Refresh")
		return Link("Forgot Password from the").exists()
	def test_upload_file(self):
		attach_file(__file__, "Choose a file here on your system that you would like to upload!")
		click("Upload")
		self.assertTrue(Text("File Uploaded!").exists())
 def _refresh_and_check_if_exists(self):
     click("Refresh")
     return Link("Forgot Password from the").exists()
Exemplo n.º 26
0
 def test_iframe(self):
     click("iFrame")
     self.assertTrue(Text("Your content goes here.").exists())
	def test_use_wysiwyg_editor(self):
		self.assertTrue(Text("Your content goes here.").exists())
		click("File")
		click("New document")
		write("Hello Helium!")
		self.assertTrue(Text("Hello Helium!").exists())
Exemplo n.º 28
0
 def test_nested_frames(self):
     click("Nested Frames")
     self.assertTrue(Text("LEFT").exists())
     self.assertTrue(Text("MIDDLE").exists())
     self.assertTrue(Text("RIGHT").exists())
     self.assertTrue(Text("BOTTOM").exists())