Best Python code snippet using toolium_python
test_new_custom_image_page.py
Source:test_new_custom_image_page.py
...92 image with name image_name is listed there93 """94 url = reverse('projectcustomimages', args=(self.project.id,))95 self.get(url)96 self.wait_until_visible('#customimagestable')97 element = self.find('#customimagestable td[class="name"] a')98 msg = 'should be a custom image link with text %s' % image_name99 self.assertEqual(element.text.strip(), image_name, msg)100 def test_new_image(self):101 """102 Should be able to create a new custom image103 """104 custom_image_name = 'boo-image'105 self._create_custom_image(custom_image_name)106 self.wait_until_visible('#image-created-notification')107 self._check_for_custom_image(custom_image_name)108 def test_new_duplicates_other_project_image(self):109 """110 Should be able to create a new custom image if its name is the same111 as a custom image in another project112 """113 self._create_custom_image(self.CUSTOM_IMAGE_NAME)114 self.wait_until_visible('#image-created-notification')115 self._check_for_custom_image(self.CUSTOM_IMAGE_NAME)116 def test_new_duplicates_non_image_recipe(self):117 """118 Should not be able to create a new custom image whose name is the119 same as an existing non-image recipe120 """121 self._create_custom_image(self.recipe.name)122 element = self.wait_until_visible('#invalid-name-help')123 self.assertRegexpMatches(element.text.strip(),124 'recipe with this name already exists')125 def test_new_duplicates_project_image(self):126 """127 Should not be able to create a new custom image whose name is the same128 as a custom image in this project129 """130 # create the image131 custom_image_name = 'doh-image'132 self._create_custom_image(custom_image_name)133 self.wait_until_visible('#image-created-notification')134 self._check_for_custom_image(custom_image_name)135 # try to create an image with the same name136 self._create_custom_image(custom_image_name)137 element = self.wait_until_visible('#invalid-name-help')138 expected = 'An image with this name already exists in this project'...
test_script.py
Source:test_script.py
...17# start = datetime.datetime.now()18#19# for win in self.sel.window_handles:20# self.sel.switch_to_window(win)21# self.wait_until_visible('#session_security_warning')22# self.assert_visible('#session_security_warning')23#24# end = datetime.datetime.now()25# delta = end - start26#27# self.assertGreaterEqual(delta.seconds, self.min_warn_after)28# self.assertLessEqual(delta.seconds, self.max_warn_after)29#30# for win in self.sel.window_handles:31# self.sel.switch_to_window(win)32# self.wait_until_visible('#id_password')33#34# delta = datetime.datetime.now() - start35# self.assertGreaterEqual(delta.seconds, self.min_expire_after)36# self.assertLessEqual(delta.seconds, self.max_expire_after)37#38# def test_activity_hides_warning(self):39# self.wait_until_visible('#session_security_warning')40# self.press_space()41#42# for win in self.sel.window_handles:43# self.sel.switch_to_window(win)44# self.wait_until_hidden('#session_security_warning')45# self.assert_not_visible('#session_security_warning')46#47# def test_activity_prevents_warning(self):48# time.sleep(self.min_warn_after * .7)49# self.press_space()50#51# start = datetime.datetime.now()52# for win in self.sel.window_handles:53# self.sel.switch_to_window(win)54# self.wait_until_visible('#session_security_warning')55# self.assert_visible('#session_security_warning')56# delta = datetime.datetime.now() - start...
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!