def _test_happy_case(browser): browser.wait_for( XPathWithSubstringLocator(tag='button', displayed_substring='update')) browser.send_inputs('boundless') browser.click_button('update') browser.wait_for( XPathWithSubstringLocator(tag='p', displayed_substring='boundless')) assert len(browser.pngs) == 3
def _test_happy_case(browser): browser.wait_for( XPathWithSubstringLocator(tag="button", displayed_substring="update")) browser.send_inputs("boundless") browser.click_button("update") browser.wait_for( XPathWithSubstringLocator(tag="p", displayed_substring="boundless")) assert len(browser.pngs) == 3
def test_run_commands(browser, load_page): browser.run_commands([ ("send_inputs", "boundless"), ("click_button", "update"), ( "wait_for", XPathWithSubstringLocator(tag="p", displayed_substring="boundless"), ), ])
def be_boundless_and_wait(browser: Chrome, capture_delay: int = 0) -> NoReturn: """ A convenience function for testing the same interactive path under different circumstances. :param browser: :param capture_delay: :return: """ return _fill_in_and_wait(browser, value='be boundless', locator=XPathWithSubstringLocator( tag='p', displayed_substring='be boundless'), capture_delay=capture_delay)
def test_run_commands(browser): browser.run_commands([ ('send_inputs', 'boundless'), ('click_button', 'update'), ('wait_for', XPathWithSubstringLocator(tag='p', displayed_substring='boundless')) ])
def be_boundless_and_wait(browser: Chrome, capture_delay: int = 0) -> NoReturn: """ A convenience function for testing the same interactive path under different circumstances. :param browser: :param capture_delay: :return: """ return _fill_in_and_wait(browser, value='be boundless', locator=XPathWithSubstringLocator( tag='p', displayed_substring='be boundless'), capture_delay=capture_delay) @pytest.mark.parametrize('locator', [ XPathWithSubstringLocator(tag='p', displayed_substring='be boundless'), Locator(search_method=SearchMethod.CSS_SELECTOR, search_value='div#outputDiv'), Locator(search_method=SearchMethod.ID, search_value='outputDiv') ]) def test_wait_for(locator, browser): element = _fill_in_and_wait(browser, 'be boundless', locator) assert element.text == 'be boundless' def test_wait_for_tag(browser): browser.send_inputs('be boundless') browser.click_button('update') assert browser.wait_for_tag('p', 'be boundless')
:param capture_delay: :return: """ return _fill_in_and_wait( browser, value="be boundless", locator=XPathWithSubstringLocator(tag="p", displayed_substring="be boundless"), capture_delay=capture_delay, ) @pytest.mark.parametrize( "locator", [ XPathWithSubstringLocator(tag="p", displayed_substring="be boundless"), Locator(search_method=By.CSS_SELECTOR, search_value="div#outputDiv"), Locator(search_method=By.ID, search_value="outputDiv"), ], ) def test_wait_for(locator, browser, load_page): element = _fill_in_and_wait(browser, "be boundless", locator) assert element.text == "be boundless" def test_wait_for_tag(browser, load_page): """Ensure that when wait_for is called using a tag with text, the element is found.""" browser.send_inputs("be boundless") browser.click_button("update") assert browser.wait_for_tag("p", "be boundless")