def test_dismiss_alert_prompt(data): actions.navigate(data.env.url + 'prompt/') actions.click('#prompt-button') actions.verify_alert_present() actions.dismiss_alert() actions.verify_alert_not_present() actions.verify_element_text('#result', 'DISMISSED')
def test_dismiss_alert_confirm(data): actions.navigate(data.env.url + 'confirm/') actions.click('#confirm-button') actions.verify_alert_present() actions.dismiss_alert() actions.verify_alert_not_present() actions.verify_element_text('#result', 'NOT CONFIRMED')
def test_verify_alert_present(data): actions.navigate(data.env.url + 'alert/') actions.verify_alert_present() golem_steps.assert_last_step_message('Verify an alert is present') golem_steps.assert_last_error('an alert was not present') actions.click('#alert-button') actions.verify_alert_present() actions.dismiss_alert()
def test_dismiss_alert(data): actions.navigate(data.env.url+'alert/') actions.click('#alert-button') actions.verify_alert_present() actions.dismiss_alert() golem_steps.assert_last_step_message('Dismiss alert') actions.verify_alert_not_present() actions.verify_element_text('#result', '1')
def test(data): actions.navigate(data.env.url + 'alert/') try: actions.verify_alert_present() except Exception as e: assert 'an alert was not present' in e.args[0] actions.click('#alert-button') actions.verify_alert_present() actions.dismiss_alert()
def test(data): actions.navigate(data.env.url + 'alert/') actions.click('#alert-delay-button') actions.wait_for_alert_present(10) actions.verify_alert_present() actions.dismiss_alert() actions.click('#alert-delay-button') try: actions.wait_for_alert_present(3) except Exception as e: "Timeout waiting for alert to be present" in e.args[0] actions.dismiss_alert(ignore_not_present=True)
def test(data): actions.navigate(data.env.url+'alert/') actions.click('#alert-delay-button') actions.wait_for_alert_present(5) golem_steps.assert_last_step_message('Wait for alert to be present') actions.verify_alert_present() actions.dismiss_alert() actions.click('#alert-delay-button') with expected_exception(TimeoutException, "Timeout waiting for alert to be present"): actions.wait_for_alert_present(2) actions.wait_for_alert_present(5) actions.dismiss_alert(ignore_not_present=True)
def test(data): actions.navigate(data.env.url + 'alert/') actions.click('#alert-delay-button') browser = actions.get_browser() browser.wait_for_alert_present(5) actions.verify_alert_present() actions.dismiss_alert() actions.click('#alert-delay-button') with expected_exception(Exception, "Timeout waiting for alert to be present"): browser.wait_for_alert_present(2) browser.wait_for_alert_present(5) actions.dismiss_alert(ignore_not_present=True)
def test(data): # alert actions.navigate(data.env.url + 'alert/') actions.click('#alert-button') actions.verify_alert_present() actions.dismiss_alert() actions.verify_alert_not_present() actions.verify_text_in_element('#result', '1') # confirm actions.navigate(data.env.url + 'confirm/') actions.click('#confirm-button') actions.verify_alert_present() actions.dismiss_alert() actions.verify_alert_not_present() actions.verify_text_in_element('#result', 'NOT CONFIRMED') # prompt actions.navigate(data.env.url + 'prompt/') actions.click('#prompt-button') actions.verify_alert_present() actions.dismiss_alert() actions.verify_alert_not_present() actions.verify_text_in_element('#result', 'DISMISSED')
def test_accept_alert(data): # alert actions.navigate(data.env.url + 'alert/') actions.click('#alert-button') actions.verify_alert_present() actions.accept_alert() assert golem_logger.last_info_log_line_contains('Accept alert') actions.verify_alert_not_present() actions.verify_element_text('#result', '1') # confirm actions.navigate(data.env.url + 'confirm/') actions.click('#confirm-button') actions.verify_alert_present() actions.accept_alert() actions.verify_alert_not_present() actions.verify_element_text('#result', 'CONFIRMED') # prompt actions.navigate(data.env.url + 'prompt/') actions.click('#prompt-button') actions.verify_alert_present() actions.accept_alert() actions.verify_alert_not_present() actions.verify_element_text('#result', 'EMPTY')
def test(data): # alert actions.navigate(data.env.url + 'alert/') actions.click('#alert-button') actions.verify_alert_present() actions.dismiss_alert() golem_steps.assert_last_step_message('Dismiss alert') actions.verify_alert_not_present() actions.verify_element_text('#result', '1') # confirm actions.navigate(data.env.url + 'confirm/') actions.click('#confirm-button') actions.verify_alert_present() actions.dismiss_alert() actions.verify_alert_not_present() actions.verify_element_text('#result', 'NOT CONFIRMED') # prompt actions.navigate(data.env.url + 'prompt/') actions.click('#prompt-button') actions.verify_alert_present() actions.dismiss_alert() actions.verify_alert_not_present() actions.verify_element_text('#result', 'DISMISSED')