示例#1
0
def wait_for_element_by_selector(self, selector, seconds):
    """
    Assert an element exists matching the given selector within the given time
    period.
    """
    wait_for(
        lambda: assert_true(find_elements_by_jquery(world.browser, selector)),
    )(timeout=int(seconds))
示例#2
0
def should_see_id_in_seconds(self, element_id, timeout):
    """
    Assert an element with the given ``id`` is visible within n seconds.
    """

    wait_for(lambda: assert_true(ElementSelector(
        world.browser,
        'id("%s")' % element_id,
        filter_displayed=True,
    )))(timeout=int(timeout))
示例#3
0
def should_see_in_seconds(self, text, timeout):
    """
    Assert provided text is visible within n seconds.

    Be aware this text could be anywhere on the screen. Also be aware that
    it might cross several HTML nodes. No determination is made between
    block and inline nodes. Whitespace can be affected.
    """
    wait_for(
        lambda: assert_true(contains_content(world.browser, text)),
    )(timeout=int(timeout))
示例#4
0
def wait_for_element_by_selector(self, selector, seconds):
    """
    Assert an element exists matching the given selector within the given time
    period.
    """
    def assert_element_present():
        """Assert an element matching the given selector exists."""
        if not find_elements_by_jquery(world.browser, selector):
            raise AssertionError("Expected a matching element.")

    wait_for(assert_element_present)(timeout=int(seconds))
示例#5
0
def wait_for_element_by_selector(self, selector, seconds):
    """
    Assert an element exists matching the given selector within the given time
    period.
    """

    def assert_element_present():
        """Assert an element matching the given selector exists."""
        if not find_elements_by_jquery(world.browser, selector):
            raise AssertionError("Expected a matching element.")

    wait_for(assert_element_present)(timeout=int(seconds))
示例#6
0
def should_see_id_in_seconds(self, element_id, timeout):
    """
    Assert an element with the given ``id`` is visible within n seconds.
    """
    def check_element():
        """Check for the element with the given id."""

        assert ElementSelector(
            world.browser,
            'id("%s")' % element_id,
            filter_displayed=True,
        ), "Expected element with given id."

    wait_for(check_element)(timeout=int(timeout))
示例#7
0
def should_see_id_in_seconds(self, element_id, timeout):
    """
    Assert an element with the given ``id`` is visible within n seconds.
    """

    def check_element():
        """Check for the element with the given id."""

        assert ElementSelector(
            world.browser,
            'id("%s")' % element_id,
            filter_displayed=True,
        ), "Expected element with given id."

    wait_for(check_element)(timeout=int(timeout))
示例#8
0
def should_see_in_seconds(self, text, timeout):
    """
    Assert provided text is visible within n seconds.

    Be aware this text could be anywhere on the screen. Also be aware that
    it might cross several HTML nodes. No determination is made between
    block and inline nodes. Whitespace can be affected.
    """
    def check_element():
        """Check for an element with the given content."""

        assert contains_content(world.browser, text), \
            "Expected element with the given text."

    wait_for(check_element)(timeout=int(timeout))
示例#9
0
def should_see_in_seconds(self, text, timeout):
    """
    Assert provided text is visible within n seconds.

    Be aware this text could be anywhere on the screen. Also be aware that
    it might cross several HTML nodes. No determination is made between
    block and inline nodes. Whitespace can be affected.
    """

    def check_element():
        """Check for an element with the given content."""

        assert contains_content(world.browser, text), \
            "Expected element with the given text."

    wait_for(check_element)(timeout=int(timeout))