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