def test_wait_for_element_with_on_screenshoting(): try: settings.screenshot_on_element_fail = True s("#i-do-not-exist").insist() raise Exception("ExpiredWaitingException must be") except ExpiredWaitingException as e: assert 'settings.screenshot_on_element_fail = False' not in e.message finally: settings.screenshot_on_element_fail = False
def test_has_text_for_not_populated_locator(): assert not s('.css').has_text()
def test_is_present_for_existent_locator(): assert s('.css').is_present()
def test_is_present_for_not_existent_locator(): assert not s('.dddh').is_present()
def test_is_visible_for_visible_locator(): assert s('.css').is_visible()
def test_is_visible_for_hidden_locator(): assert not s('h', By.ID).is_visible()
def test_find_element_by_name(): s('last_name', By.NAME).insist()
def test_present_condition(): s('.css').insist(present)
def test_find_element_by_id(): s('item_31', By.ID).insist()
def test_find_element_by_css_for_existent_locator(): s('.css').insist()
def test_find_element_by_css_for_not_existent_locator(): with pytest.raises(ExpiredWaitingException): s("#i-do-not-exist").insist()
def test_wait_for_element_which_does_not_exist(): with pytest.raises(ExpiredWaitingException): s("#i-do-not-exist").insist()
def init(self): self.details = self.Details('#order_details') self.add_item = s('#add_item') self.items = ss('[id^="item"]').of(self.Item)
def test_has_test_condition(): s('ol > li').insist(has_text)
def test_has_test_for_populated_locator(): assert s('ol > li').has_text()
def test_find_element_by_xpath(): s('//input[@id="item_31"]', By.XPATH).insist()
def test_collection_of_elements_loading_with_custom_time(): try: s("#i-do-not-exist", loading_time=0.2).insist() raise Exception("ExpiredWaitingException must be") except ExpiredWaitingException as e: assert 'During: 0.2s' in e.message
def test_absent_condition(): s('.ffff').insist(absent)