Beispiel #1
0
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
Beispiel #2
0
def test_has_text_for_not_populated_locator():
    assert not s('.css').has_text()
Beispiel #3
0
def test_is_present_for_existent_locator():
    assert s('.css').is_present()
Beispiel #4
0
def test_is_present_for_not_existent_locator():
    assert not s('.dddh').is_present()
Beispiel #5
0
def test_is_visible_for_visible_locator():
    assert s('.css').is_visible()
Beispiel #6
0
def test_is_visible_for_hidden_locator():
    assert not s('h', By.ID).is_visible()
Beispiel #7
0
def test_find_element_by_name():
    s('last_name', By.NAME).insist()
Beispiel #8
0
def test_present_condition():
    s('.css').insist(present)
Beispiel #9
0
def test_find_element_by_id():
    s('item_31', By.ID).insist()
Beispiel #10
0
def test_find_element_by_css_for_existent_locator():
    s('.css').insist()
Beispiel #11
0
def test_find_element_by_css_for_not_existent_locator():
    with pytest.raises(ExpiredWaitingException):
        s("#i-do-not-exist").insist()
Beispiel #12
0
def test_wait_for_element_which_does_not_exist():
    with pytest.raises(ExpiredWaitingException):
        s("#i-do-not-exist").insist()
Beispiel #13
0
 def init(self):
     self.details = self.Details('#order_details')
     self.add_item = s('#add_item')
     self.items = ss('[id^="item"]').of(self.Item)
Beispiel #14
0
def test_has_test_condition():
    s('ol > li').insist(has_text)
Beispiel #15
0
def test_has_test_for_populated_locator():
    assert s('ol > li').has_text()
Beispiel #16
0
def test_find_element_by_xpath():
    s('//input[@id="item_31"]', By.XPATH).insist()
Beispiel #17
0
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
Beispiel #18
0
def test_absent_condition():
    s('.ffff').insist(absent)