Bug 1470098 - [wdspec] Add tests for confirm, and prompt for the Execute (Async) Script commands. r=ato

MozReview-Commit-ID: 5VNykQGobtx

--HG--
extra : rebase_source : ef2c4a0dcf8e2d2c72f14d549f1d73e04bc075c5
This commit is contained in:
Henrik Skupin 2018-07-05 13:34:31 +02:00
parent 694d2fe02c
commit cd72137f9a
4 changed files with 102 additions and 36 deletions

View File

@ -1,16 +1,41 @@
[user_prompts.py]
disabled:
if webrender: bug 1425588
[test_handle_prompt_accept[capabilities0\]]
[test_handle_prompt_accept[capabilities0-alert\]]
expected: FAIL
[test_handle_prompt_dismiss[capabilities0\]]
[test_handle_prompt_accept[capabilities0-confirm\]]
expected: FAIL
[test_handle_prompt_ignore[capabilities0\]]
[test_handle_prompt_accept[capabilities0-prompt\]]
expected: FAIL
[test_handle_prompt_twice[capabilities0\]]
[test_handle_prompt_dismiss[capabilities0-alert\]]
expected: FAIL
[test_handle_prompt_dismiss[capabilities0-confirm\]]
expected: FAIL
[test_handle_prompt_dismiss[capabilities0-prompt\]]
expected: FAIL
[test_handle_prompt_ignore[capabilities0-alert\]]
expected: FAIL
[test_handle_prompt_ignore[capabilities0-confirm\]]
expected: FAIL
[test_handle_prompt_ignore[capabilities0-prompt\]]
expected: FAIL
[test_handle_prompt_twice[capabilities0-alert\]]
expected: FAIL
disabled: Bug 1459118
[test_handle_prompt_twice[capabilities0-confirm\]]
expected: FAIL
disabled: Bug 1459118
[test_handle_prompt_twice[capabilities0-prompt\]]
expected: FAIL
disabled: Bug 1459118

View File

@ -1,16 +1,41 @@
[user_prompts.py]
disabled:
if webrender: bug 1425588
[test_handle_prompt_accept[capabilities0\]]
[test_handle_prompt_accept[capabilities0-alert\]]
expected: FAIL
[test_handle_prompt_dismiss[capabilities0\]]
[test_handle_prompt_accept[capabilities0-confirm\]]
expected: FAIL
[test_handle_prompt_ignore[capabilities0\]]
[test_handle_prompt_accept[capabilities0-prompt\]]
expected: FAIL
[test_handle_prompt_twice[capabilities0\]]
[test_handle_prompt_dismiss[capabilities0-alert\]]
expected: FAIL
[test_handle_prompt_dismiss[capabilities0-confirm\]]
expected: FAIL
[test_handle_prompt_dismiss[capabilities0-prompt\]]
expected: FAIL
[test_handle_prompt_ignore[capabilities0-alert\]]
expected: FAIL
[test_handle_prompt_ignore[capabilities0-confirm\]]
expected: FAIL
[test_handle_prompt_ignore[capabilities0-prompt\]]
expected: FAIL
[test_handle_prompt_twice[capabilities0-alert\]]
expected: FAIL
disabled: Bug 1459118
[test_handle_prompt_twice[capabilities0-confirm\]]
expected: FAIL
disabled: Bug 1459118
[test_handle_prompt_twice[capabilities0-prompt\]]
expected: FAIL
disabled: Bug 1459118

View File

@ -18,8 +18,9 @@ def execute_async_script(session, script, args=None):
@pytest.mark.capabilities({"unhandledPromptBehavior": "accept"})
def test_handle_prompt_accept(session):
response = execute_async_script(session, "window.alert('Hello');")
@pytest.mark.parametrize("dialog_type", ["alert", "confirm", "prompt"])
def test_handle_prompt_accept(session, dialog_type):
response = execute_async_script(session, "window.{}('Hello');".format(dialog_type))
assert_success(response, None)
session.title
@ -28,8 +29,9 @@ def test_handle_prompt_accept(session):
@pytest.mark.capabilities({"unhandledPromptBehavior": "accept and notify"})
def test_handle_prompt_accept_and_notify(session):
response = execute_async_script(session, "window.alert('Hello');")
@pytest.mark.parametrize("dialog_type", ["alert", "confirm", "prompt"])
def test_handle_prompt_accept_and_notify(session, dialog_type):
response = execute_async_script(session, "window.{}('Hello');".format(dialog_type))
assert_success(response, None)
with pytest.raises(error.UnexpectedAlertOpenException):
@ -39,8 +41,9 @@ def test_handle_prompt_accept_and_notify(session):
@pytest.mark.capabilities({"unhandledPromptBehavior": "dismiss"})
def test_handle_prompt_dismiss(session):
response = execute_async_script(session, "window.alert('Hello');")
@pytest.mark.parametrize("dialog_type", ["alert", "confirm", "prompt"])
def test_handle_prompt_dismiss(session, dialog_type):
response = execute_async_script(session, "window.{}('Hello');".format(dialog_type))
assert_success(response, None)
session.title
@ -49,8 +52,9 @@ def test_handle_prompt_dismiss(session):
@pytest.mark.capabilities({"unhandledPromptBehavior": "dismiss and notify"})
def test_handle_prompt_dismiss_and_notify(session):
response = execute_async_script(session, "window.alert('Hello');")
@pytest.mark.parametrize("dialog_type", ["alert", "confirm", "prompt"])
def test_handle_prompt_dismiss_and_notify(session, dialog_type):
response = execute_async_script(session, "window.{}('Hello');".format(dialog_type))
assert_success(response, None)
with pytest.raises(error.UnexpectedAlertOpenException):
@ -60,8 +64,9 @@ def test_handle_prompt_dismiss_and_notify(session):
@pytest.mark.capabilities({"unhandledPromptBehavior": "ignore"})
def test_handle_prompt_ignore(session):
response = execute_async_script(session, "window.alert('Hello');")
@pytest.mark.parametrize("dialog_type", ["alert", "confirm", "prompt"])
def test_handle_prompt_ignore(session, dialog_type):
response = execute_async_script(session, "window.{}('Hello');".format(dialog_type))
assert_success(response, None)
with pytest.raises(error.UnexpectedAlertOpenException):
@ -69,8 +74,9 @@ def test_handle_prompt_ignore(session):
session.alert.dismiss()
def test_handle_prompt_default(session):
response = execute_async_script(session, "window.alert('Hello');")
@pytest.mark.parametrize("dialog_type", ["alert", "confirm", "prompt"])
def test_handle_prompt_default(session, dialog_type):
response = execute_async_script(session, "window.{}('Hello');".format(dialog_type))
assert_success(response, None)
with pytest.raises(error.UnexpectedAlertOpenException):
@ -80,8 +86,10 @@ def test_handle_prompt_default(session):
@pytest.mark.capabilities({"unhandledPromptBehavior": "accept"})
def test_handle_prompt_twice(session):
response = execute_async_script(session, "window.alert('Hello');window.alert('Bye');")
@pytest.mark.parametrize("dialog_type", ["alert", "confirm", "prompt"])
def test_handle_prompt_twice(session, dialog_type):
response = execute_async_script(
session, "window.{0}('Hello');window.{0}('Bye');".format(dialog_type))
assert_success(response, None)
session.alert.dismiss()

View File

@ -19,8 +19,9 @@ def execute_script(session, script, args=None):
@pytest.mark.capabilities({"unhandledPromptBehavior": "accept"})
def test_handle_prompt_accept(session):
response = execute_script(session, "window.alert('Hello');")
@pytest.mark.parametrize("dialog_type", ["alert", "confirm", "prompt"])
def test_handle_prompt_accept(session, dialog_type):
response = execute_script(session, "window.{}('Hello');".format(dialog_type))
assert_success(response, None)
session.title
@ -29,8 +30,9 @@ def test_handle_prompt_accept(session):
@pytest.mark.capabilities({"unhandledPromptBehavior": "accept and notify"})
def test_handle_prompt_accept_and_notify(session):
response = execute_script(session, "window.alert('Hello');")
@pytest.mark.parametrize("dialog_type", ["alert", "confirm", "prompt"])
def test_handle_prompt_accept_and_notify(session, dialog_type):
response = execute_script(session, "window.{}('Hello');".format(dialog_type))
assert_success(response, None)
with pytest.raises(error.UnexpectedAlertOpenException):
@ -40,8 +42,9 @@ def test_handle_prompt_accept_and_notify(session):
@pytest.mark.capabilities({"unhandledPromptBehavior": "dismiss"})
def test_handle_prompt_dismiss(session):
response = execute_script(session, "window.alert('Hello');")
@pytest.mark.parametrize("dialog_type", ["alert", "confirm", "prompt"])
def test_handle_prompt_dismiss(session, dialog_type):
response = execute_script(session, "window.{}('Hello');".format(dialog_type))
assert_success(response, None)
session.title
@ -50,8 +53,9 @@ def test_handle_prompt_dismiss(session):
@pytest.mark.capabilities({"unhandledPromptBehavior": "dismiss and notify"})
def test_handle_prompt_dismiss_and_notify(session):
response = execute_script(session, "window.alert('Hello');")
@pytest.mark.parametrize("dialog_type", ["alert", "confirm", "prompt"])
def test_handle_prompt_dismiss_and_notify(session, dialog_type):
response = execute_script(session, "window.{}('Hello');".format(dialog_type))
assert_success(response, None)
with pytest.raises(error.UnexpectedAlertOpenException):
@ -61,8 +65,9 @@ def test_handle_prompt_dismiss_and_notify(session):
@pytest.mark.capabilities({"unhandledPromptBehavior": "ignore"})
def test_handle_prompt_ignore(session):
response = execute_script(session, "window.alert('Hello');")
@pytest.mark.parametrize("dialog_type", ["alert", "confirm", "prompt"])
def test_handle_prompt_ignore(session, dialog_type):
response = execute_script(session, "window.{}('Hello');".format(dialog_type))
assert_success(response, None)
with pytest.raises(error.UnexpectedAlertOpenException):
@ -70,8 +75,9 @@ def test_handle_prompt_ignore(session):
session.alert.dismiss()
def test_handle_prompt_default(session):
response = execute_script(session, "window.alert('Hello');")
@pytest.mark.parametrize("dialog_type", ["alert", "confirm", "prompt"])
def test_handle_prompt_default(session, dialog_type):
response = execute_script(session, "window.{}('Hello');".format(dialog_type))
assert_success(response, None)
with pytest.raises(error.UnexpectedAlertOpenException):
@ -81,8 +87,10 @@ def test_handle_prompt_default(session):
@pytest.mark.capabilities({"unhandledPromptBehavior": "accept"})
def test_handle_prompt_twice(session):
response = execute_script(session, "window.alert('Hello');window.alert('Bye');")
@pytest.mark.parametrize("dialog_type", ["alert", "confirm", "prompt"])
def test_handle_prompt_twice(session, dialog_type):
response = execute_script(
session, "window.{0}('Hello');window.{0}('Bye');".format(dialog_type))
assert_success(response, None)
session.alert.dismiss()