mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-19 08:15:31 +00:00
Backed out changeset f8d681cc1d4c (bug 1473814) for marionette failures on /marionette_harness/tests/unit/test_switch_frame.py. CLOSED TREE
--HG-- rename : testing/web-platform/tests/webdriver/tests/get_page_source/__init__.py => testing/web-platform/tests/webdriver/tests/page_source/__init__.py rename : testing/web-platform/tests/webdriver/tests/get_page_source/source.py => testing/web-platform/tests/webdriver/tests/page_source/source.py
This commit is contained in:
parent
c3b40a9a26
commit
e3c842dd79
@ -84,7 +84,6 @@ class TestSwitchFrame(MarionetteTestCase):
|
||||
self.marionette.switch_to_frame(self.marionette.find_element(By.ID, 'iframe1'))
|
||||
kill_iframe = self.marionette.find_element(By.ID, "killIframe")
|
||||
kill_iframe.click()
|
||||
self.marionette.find_element(By.ID, "killIframe")
|
||||
self.marionette.switch_to_frame()
|
||||
self.assertEqual(0, len(self.marionette.find_elements(By.ID, "iframe1")))
|
||||
|
||||
|
@ -431882,14 +431882,6 @@
|
||||
{}
|
||||
]
|
||||
],
|
||||
"webdriver/tests/add_cookie/user_prompts.py": [
|
||||
[
|
||||
"/webdriver/tests/add_cookie/user_prompts.py",
|
||||
{
|
||||
"timeout": "long"
|
||||
}
|
||||
]
|
||||
],
|
||||
"webdriver/tests/back/back.py": [
|
||||
[
|
||||
"/webdriver/tests/back/back.py",
|
||||
@ -431924,14 +431916,6 @@
|
||||
{}
|
||||
]
|
||||
],
|
||||
"webdriver/tests/delete_all_cookies/user_prompts.py": [
|
||||
[
|
||||
"/webdriver/tests/delete_all_cookies/user_prompts.py",
|
||||
{
|
||||
"timeout": "long"
|
||||
}
|
||||
]
|
||||
],
|
||||
"webdriver/tests/delete_cookie/delete.py": [
|
||||
[
|
||||
"/webdriver/tests/delete_cookie/delete.py",
|
||||
@ -431966,14 +431950,6 @@
|
||||
}
|
||||
]
|
||||
],
|
||||
"webdriver/tests/element_clear/user_prompts.py": [
|
||||
[
|
||||
"/webdriver/tests/element_clear/user_prompts.py",
|
||||
{
|
||||
"timeout": "long"
|
||||
}
|
||||
]
|
||||
],
|
||||
"webdriver/tests/element_click/bubbling.py": [
|
||||
[
|
||||
"/webdriver/tests/element_click/bubbling.py",
|
||||
@ -432022,14 +431998,6 @@
|
||||
{}
|
||||
]
|
||||
],
|
||||
"webdriver/tests/element_click/user_prompts.py": [
|
||||
[
|
||||
"/webdriver/tests/element_click/user_prompts.py",
|
||||
{
|
||||
"timeout": "long"
|
||||
}
|
||||
]
|
||||
],
|
||||
"webdriver/tests/element_send_keys/content_editable.py": [
|
||||
[
|
||||
"/webdriver/tests/element_send_keys/content_editable.py",
|
||||
@ -432190,14 +432158,6 @@
|
||||
{}
|
||||
]
|
||||
],
|
||||
"webdriver/tests/get_active_element/user_prompts.py": [
|
||||
[
|
||||
"/webdriver/tests/get_active_element/user_prompts.py",
|
||||
{
|
||||
"timeout": "long"
|
||||
}
|
||||
]
|
||||
],
|
||||
"webdriver/tests/get_alert_text/get.py": [
|
||||
[
|
||||
"/webdriver/tests/get_alert_text/get.py",
|
||||
@ -432224,14 +432184,6 @@
|
||||
{}
|
||||
]
|
||||
],
|
||||
"webdriver/tests/get_element_attribute/user_prompts.py": [
|
||||
[
|
||||
"/webdriver/tests/get_element_attribute/user_prompts.py",
|
||||
{
|
||||
"timeout": "long"
|
||||
}
|
||||
]
|
||||
],
|
||||
"webdriver/tests/get_element_css_value/get.py": [
|
||||
[
|
||||
"/webdriver/tests/get_element_css_value/get.py",
|
||||
@ -662199,10 +662151,6 @@
|
||||
"24ac645029e0dc57327b62ad3d24fbab1640ad2c",
|
||||
"wdspec"
|
||||
],
|
||||
"webdriver/tests/add_cookie/user_prompts.py": [
|
||||
"f58aacd02a71d73112fcb6140c6b766919f9b85f",
|
||||
"wdspec"
|
||||
],
|
||||
"webdriver/tests/back/__init__.py": [
|
||||
"e69de29bb2d1d6434b8b29ae775ad8c2e48c5391",
|
||||
"support"
|
||||
@ -662243,10 +662191,6 @@
|
||||
"e0947b6a75724ac8e298d09d77ae940ea82e98d9",
|
||||
"wdspec"
|
||||
],
|
||||
"webdriver/tests/delete_all_cookies/user_prompts.py": [
|
||||
"dca4f3c8bf6473e7fb767519d7f4a9417503f044",
|
||||
"wdspec"
|
||||
],
|
||||
"webdriver/tests/delete_cookie/__init__.py": [
|
||||
"e69de29bb2d1d6434b8b29ae775ad8c2e48c5391",
|
||||
"support"
|
||||
@ -662283,10 +662227,6 @@
|
||||
"bc74af4b61624d2e9d155ef9438043e09dbf1622",
|
||||
"wdspec"
|
||||
],
|
||||
"webdriver/tests/element_clear/user_prompts.py": [
|
||||
"cfb850e08d5afe1e06266694c27b4bbfdbc66b17",
|
||||
"wdspec"
|
||||
],
|
||||
"webdriver/tests/element_click/__init__.py": [
|
||||
"e69de29bb2d1d6434b8b29ae775ad8c2e48c5391",
|
||||
"support"
|
||||
@ -662331,10 +662271,6 @@
|
||||
"e2c6dadd1218e0a7d8b7d243a1c49b7f47092d77",
|
||||
"support"
|
||||
],
|
||||
"webdriver/tests/element_click/user_prompts.py": [
|
||||
"b3706fe4af164c643d3857fa5a056445ab597b51",
|
||||
"wdspec"
|
||||
],
|
||||
"webdriver/tests/element_send_keys/__init__.py": [
|
||||
"a7facf6fcf70309251757e3fb90b89255e13133f",
|
||||
"support"
|
||||
@ -662480,11 +662416,7 @@
|
||||
"support"
|
||||
],
|
||||
"webdriver/tests/get_active_element/get.py": [
|
||||
"1fea56a0d7ae9f765d97927c307d2195c04ff93a",
|
||||
"wdspec"
|
||||
],
|
||||
"webdriver/tests/get_active_element/user_prompts.py": [
|
||||
"7fa7be1dde994bfb41a0212b5c997c220b273d37",
|
||||
"ac4f14d37c0b9b8cf4afa1d1af4ce1c8027c77c9",
|
||||
"wdspec"
|
||||
],
|
||||
"webdriver/tests/get_alert_text/__init__.py": [
|
||||
@ -662515,10 +662447,6 @@
|
||||
"02a155bcee6626037f424fbf387458ea46e6c206",
|
||||
"wdspec"
|
||||
],
|
||||
"webdriver/tests/get_element_attribute/user_prompts.py": [
|
||||
"5ee7929afdf8447772ca78ce4cdc532144945f0c",
|
||||
"wdspec"
|
||||
],
|
||||
"webdriver/tests/get_element_css_value/__init__.py": [
|
||||
"e69de29bb2d1d6434b8b29ae775ad8c2e48c5391",
|
||||
"support"
|
||||
@ -662928,7 +662856,7 @@
|
||||
"support"
|
||||
],
|
||||
"webdriver/tests/support/asserts.py": [
|
||||
"cdf313bc04b3e96e999b559de506b5595efe8419",
|
||||
"2d305a0f3bec08d6b773541e556258416e737f7f",
|
||||
"support"
|
||||
],
|
||||
"webdriver/tests/support/defaults.py": [
|
||||
|
@ -1,137 +0,0 @@
|
||||
# META: timeout=long
|
||||
|
||||
import pytest
|
||||
|
||||
from webdriver.error import NoSuchCookieException
|
||||
|
||||
from tests.support.asserts import assert_dialog_handled, assert_error, assert_success
|
||||
|
||||
|
||||
def add_cookie(session, cookie):
|
||||
return session.transport.send(
|
||||
"POST", "session/{session_id}/cookie".format(**vars(session)),
|
||||
{"cookie": cookie})
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def check_user_prompt_closed_without_exception(session, url, create_dialog):
|
||||
def check_user_prompt_closed_without_exception(dialog_type, retval):
|
||||
new_cookie = {
|
||||
"name": "foo",
|
||||
"value": "bar",
|
||||
}
|
||||
|
||||
session.url = url("/common/blank.html")
|
||||
|
||||
create_dialog(dialog_type, text=dialog_type)
|
||||
|
||||
response = add_cookie(session, new_cookie)
|
||||
assert_success(response)
|
||||
|
||||
assert_dialog_handled(session, expected_text=dialog_type, expected_retval=retval)
|
||||
|
||||
assert session.cookies("foo")
|
||||
|
||||
return check_user_prompt_closed_without_exception
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def check_user_prompt_closed_with_exception(session, url, create_dialog):
|
||||
def check_user_prompt_closed_with_exception(dialog_type, retval):
|
||||
new_cookie = {
|
||||
"name": "foo",
|
||||
"value": "bar",
|
||||
}
|
||||
|
||||
session.url = url("/common/blank.html")
|
||||
|
||||
create_dialog(dialog_type, text=dialog_type)
|
||||
|
||||
response = add_cookie(session, new_cookie)
|
||||
assert_error(response, "unexpected alert open")
|
||||
|
||||
assert_dialog_handled(session, expected_text=dialog_type, expected_retval=retval)
|
||||
|
||||
with pytest.raises(NoSuchCookieException):
|
||||
assert session.cookies("foo")
|
||||
|
||||
return check_user_prompt_closed_with_exception
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def check_user_prompt_not_closed_but_exception(session, url, create_dialog):
|
||||
def check_user_prompt_not_closed_but_exception(dialog_type):
|
||||
new_cookie = {
|
||||
"name": "foo",
|
||||
"value": "bar",
|
||||
}
|
||||
|
||||
session.url = url("/common/blank.html")
|
||||
|
||||
create_dialog(dialog_type, text=dialog_type)
|
||||
|
||||
response = add_cookie(session, new_cookie)
|
||||
assert_error(response, "unexpected alert open")
|
||||
|
||||
assert session.alert.text == dialog_type
|
||||
session.alert.dismiss()
|
||||
|
||||
with pytest.raises(NoSuchCookieException):
|
||||
assert session.cookies("foo")
|
||||
|
||||
return check_user_prompt_not_closed_but_exception
|
||||
|
||||
|
||||
@pytest.mark.capabilities({"unhandledPromptBehavior": "accept"})
|
||||
@pytest.mark.parametrize("dialog_type, retval", [
|
||||
("alert", None),
|
||||
("confirm", True),
|
||||
("prompt", ""),
|
||||
])
|
||||
def test_accept(check_user_prompt_closed_without_exception, dialog_type, retval):
|
||||
check_user_prompt_closed_without_exception(dialog_type, retval)
|
||||
|
||||
|
||||
@pytest.mark.capabilities({"unhandledPromptBehavior": "accept and notify"})
|
||||
@pytest.mark.parametrize("dialog_type, retval", [
|
||||
("alert", None),
|
||||
("confirm", True),
|
||||
("prompt", ""),
|
||||
])
|
||||
def test_accept_and_notify(check_user_prompt_closed_with_exception, dialog_type, retval):
|
||||
check_user_prompt_closed_with_exception(dialog_type, retval)
|
||||
|
||||
|
||||
@pytest.mark.capabilities({"unhandledPromptBehavior": "dismiss"})
|
||||
@pytest.mark.parametrize("dialog_type, retval", [
|
||||
("alert", None),
|
||||
("confirm", False),
|
||||
("prompt", None),
|
||||
])
|
||||
def test_dismiss(check_user_prompt_closed_without_exception, dialog_type, retval):
|
||||
check_user_prompt_closed_without_exception(dialog_type, retval)
|
||||
|
||||
|
||||
@pytest.mark.capabilities({"unhandledPromptBehavior": "dismiss and notify"})
|
||||
@pytest.mark.parametrize("dialog_type, retval", [
|
||||
("alert", None),
|
||||
("confirm", False),
|
||||
("prompt", None),
|
||||
])
|
||||
def test_dismiss_and_notify(check_user_prompt_closed_with_exception, dialog_type, retval):
|
||||
check_user_prompt_closed_with_exception(dialog_type, retval)
|
||||
|
||||
|
||||
@pytest.mark.capabilities({"unhandledPromptBehavior": "ignore"})
|
||||
@pytest.mark.parametrize("dialog_type", ["alert", "confirm", "prompt"])
|
||||
def test_ignore(check_user_prompt_not_closed_but_exception, dialog_type):
|
||||
check_user_prompt_not_closed_but_exception(dialog_type)
|
||||
|
||||
|
||||
@pytest.mark.parametrize("dialog_type, retval", [
|
||||
("alert", None),
|
||||
("confirm", False),
|
||||
("prompt", None),
|
||||
])
|
||||
def test_default(check_user_prompt_closed_with_exception, dialog_type, retval):
|
||||
check_user_prompt_closed_with_exception(dialog_type, retval)
|
@ -1,119 +0,0 @@
|
||||
# META: timeout=long
|
||||
|
||||
import pytest
|
||||
|
||||
from webdriver.error import NoSuchCookieException
|
||||
|
||||
from tests.support.asserts import assert_dialog_handled, assert_error, assert_success
|
||||
|
||||
|
||||
def delete_all_cookies(session):
|
||||
return session.transport.send(
|
||||
"DELETE", "/session/{session_id}/cookie".format(**vars(session)))
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def check_user_prompt_closed_without_exception(session, create_dialog, create_cookie):
|
||||
def check_user_prompt_closed_without_exception(dialog_type, retval):
|
||||
create_cookie("foo", value="bar", path="/common/blank.html")
|
||||
|
||||
create_dialog(dialog_type, text=dialog_type)
|
||||
|
||||
response = delete_all_cookies(session)
|
||||
assert_success(response)
|
||||
|
||||
assert_dialog_handled(session, expected_text=dialog_type, expected_retval=retval)
|
||||
|
||||
assert session.cookies() == []
|
||||
|
||||
return check_user_prompt_closed_without_exception
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def check_user_prompt_closed_with_exception(session, create_dialog, create_cookie):
|
||||
def check_user_prompt_closed_with_exception(dialog_type, retval):
|
||||
create_cookie("foo", value="bar", path="/common/blank.html")
|
||||
|
||||
create_dialog(dialog_type, text=dialog_type)
|
||||
|
||||
response = delete_all_cookies(session)
|
||||
assert_error(response, "unexpected alert open")
|
||||
|
||||
assert_dialog_handled(session, expected_text=dialog_type, expected_retval=retval)
|
||||
|
||||
assert session.cookies() != []
|
||||
|
||||
return check_user_prompt_closed_with_exception
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def check_user_prompt_not_closed_but_exception(session, create_dialog, create_cookie):
|
||||
def check_user_prompt_not_closed_but_exception(dialog_type):
|
||||
create_cookie("foo", value="bar", path="/common/blank.html")
|
||||
|
||||
create_dialog(dialog_type, text=dialog_type)
|
||||
|
||||
response = delete_all_cookies(session)
|
||||
assert_error(response, "unexpected alert open")
|
||||
|
||||
assert session.alert.text == dialog_type
|
||||
session.alert.dismiss()
|
||||
|
||||
assert session.cookies() != []
|
||||
|
||||
return check_user_prompt_not_closed_but_exception
|
||||
|
||||
|
||||
@pytest.mark.capabilities({"unhandledPromptBehavior": "accept"})
|
||||
@pytest.mark.parametrize("dialog_type, retval", [
|
||||
("alert", None),
|
||||
("confirm", True),
|
||||
("prompt", ""),
|
||||
])
|
||||
def test_accept(check_user_prompt_closed_without_exception, dialog_type, retval):
|
||||
check_user_prompt_closed_without_exception(dialog_type, retval)
|
||||
|
||||
|
||||
@pytest.mark.capabilities({"unhandledPromptBehavior": "accept and notify"})
|
||||
@pytest.mark.parametrize("dialog_type, retval", [
|
||||
("alert", None),
|
||||
("confirm", True),
|
||||
("prompt", ""),
|
||||
])
|
||||
def test_accept_and_notify(check_user_prompt_closed_with_exception, dialog_type, retval):
|
||||
check_user_prompt_closed_with_exception(dialog_type, retval)
|
||||
|
||||
|
||||
@pytest.mark.capabilities({"unhandledPromptBehavior": "dismiss"})
|
||||
@pytest.mark.parametrize("dialog_type, retval", [
|
||||
("alert", None),
|
||||
("confirm", False),
|
||||
("prompt", None),
|
||||
])
|
||||
def test_dismiss(check_user_prompt_closed_without_exception, dialog_type, retval):
|
||||
check_user_prompt_closed_without_exception(dialog_type, retval)
|
||||
|
||||
|
||||
@pytest.mark.capabilities({"unhandledPromptBehavior": "dismiss and notify"})
|
||||
@pytest.mark.parametrize("dialog_type, retval", [
|
||||
("alert", None),
|
||||
("confirm", False),
|
||||
("prompt", None),
|
||||
])
|
||||
def test_dismiss_and_notify(check_user_prompt_closed_with_exception, dialog_type, retval):
|
||||
check_user_prompt_closed_with_exception(dialog_type, retval)
|
||||
|
||||
|
||||
@pytest.mark.capabilities({"unhandledPromptBehavior": "ignore"})
|
||||
@pytest.mark.parametrize("dialog_type", ["alert", "confirm", "prompt"])
|
||||
def test_ignore(check_user_prompt_not_closed_but_exception, dialog_type):
|
||||
check_user_prompt_not_closed_but_exception(dialog_type)
|
||||
|
||||
|
||||
@pytest.mark.parametrize("dialog_type, retval", [
|
||||
("alert", None),
|
||||
("confirm", False),
|
||||
("prompt", None),
|
||||
])
|
||||
def test_default(check_user_prompt_closed_with_exception, dialog_type, retval):
|
||||
check_user_prompt_closed_with_exception(dialog_type, retval)
|
@ -1,132 +0,0 @@
|
||||
# META: timeout=long
|
||||
|
||||
import pytest
|
||||
|
||||
from tests.support.asserts import assert_dialog_handled, assert_error, assert_success
|
||||
from tests.support.inline import inline
|
||||
|
||||
|
||||
def element_clear(session, element):
|
||||
return session.transport.send(
|
||||
"POST", "/session/{session_id}/element/{element_id}/clear".format(
|
||||
session_id=session.session_id,
|
||||
element_id=element.id))
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def check_user_prompt_closed_without_exception(session, create_dialog):
|
||||
def check_user_prompt_closed_without_exception(dialog_type, retval):
|
||||
session.url = inline("<input type=text>")
|
||||
element = session.find.css("input", all=False)
|
||||
element.send_keys("foo")
|
||||
|
||||
assert element.property("value") == "foo"
|
||||
|
||||
create_dialog(dialog_type, text=dialog_type)
|
||||
|
||||
response = element_clear(session, element)
|
||||
assert_success(response)
|
||||
|
||||
assert_dialog_handled(session, expected_text=dialog_type, expected_retval=retval)
|
||||
|
||||
assert element.property("value") == ""
|
||||
|
||||
return check_user_prompt_closed_without_exception
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def check_user_prompt_closed_with_exception(session, create_dialog):
|
||||
def check_user_prompt_closed_with_exception(dialog_type, retval):
|
||||
session.url = inline("<input type=text>")
|
||||
element = session.find.css("input", all=False)
|
||||
element.send_keys("foo")
|
||||
|
||||
assert element.property("value") == "foo"
|
||||
|
||||
create_dialog(dialog_type, text=dialog_type)
|
||||
|
||||
response = element_clear(session, element)
|
||||
assert_error(response, "unexpected alert open")
|
||||
|
||||
assert_dialog_handled(session, expected_text=dialog_type, expected_retval=retval)
|
||||
|
||||
assert element.property("value") == "foo"
|
||||
|
||||
return check_user_prompt_closed_with_exception
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def check_user_prompt_not_closed_but_exception(session, create_dialog):
|
||||
def check_user_prompt_not_closed_but_exception(dialog_type):
|
||||
session.url = inline("<input type=text>")
|
||||
element = session.find.css("input", all=False)
|
||||
element.send_keys("foo")
|
||||
|
||||
assert element.property("value") == "foo"
|
||||
|
||||
create_dialog(dialog_type, text=dialog_type)
|
||||
|
||||
response = element_clear(session, element)
|
||||
assert_error(response, "unexpected alert open")
|
||||
|
||||
assert session.alert.text == dialog_type
|
||||
session.alert.dismiss()
|
||||
|
||||
assert element.property("value") == "foo"
|
||||
|
||||
return check_user_prompt_not_closed_but_exception
|
||||
|
||||
|
||||
@pytest.mark.capabilities({"unhandledPromptBehavior": "accept"})
|
||||
@pytest.mark.parametrize("dialog_type, retval", [
|
||||
("alert", None),
|
||||
("confirm", True),
|
||||
("prompt", ""),
|
||||
])
|
||||
def test_accept(check_user_prompt_closed_without_exception, dialog_type, retval):
|
||||
check_user_prompt_closed_without_exception(dialog_type, retval)
|
||||
|
||||
|
||||
@pytest.mark.capabilities({"unhandledPromptBehavior": "accept and notify"})
|
||||
@pytest.mark.parametrize("dialog_type, retval", [
|
||||
("alert", None),
|
||||
("confirm", True),
|
||||
("prompt", ""),
|
||||
])
|
||||
def test_accept_and_notify(check_user_prompt_closed_with_exception, dialog_type, retval):
|
||||
check_user_prompt_closed_with_exception(dialog_type, retval)
|
||||
|
||||
|
||||
@pytest.mark.capabilities({"unhandledPromptBehavior": "dismiss"})
|
||||
@pytest.mark.parametrize("dialog_type, retval", [
|
||||
("alert", None),
|
||||
("confirm", False),
|
||||
("prompt", None),
|
||||
])
|
||||
def test_dismiss(check_user_prompt_closed_without_exception, dialog_type, retval):
|
||||
check_user_prompt_closed_without_exception(dialog_type, retval)
|
||||
|
||||
|
||||
@pytest.mark.capabilities({"unhandledPromptBehavior": "dismiss and notify"})
|
||||
@pytest.mark.parametrize("dialog_type, retval", [
|
||||
("alert", None),
|
||||
("confirm", False),
|
||||
("prompt", None),
|
||||
])
|
||||
def test_dismiss_and_notify(check_user_prompt_closed_with_exception, dialog_type, retval):
|
||||
check_user_prompt_closed_with_exception(dialog_type, retval)
|
||||
|
||||
|
||||
@pytest.mark.capabilities({"unhandledPromptBehavior": "ignore"})
|
||||
@pytest.mark.parametrize("dialog_type", ["alert", "confirm", "prompt"])
|
||||
def test_ignore(check_user_prompt_not_closed_but_exception, dialog_type):
|
||||
check_user_prompt_not_closed_but_exception(dialog_type)
|
||||
|
||||
|
||||
@pytest.mark.parametrize("dialog_type, retval", [
|
||||
("alert", None),
|
||||
("confirm", False),
|
||||
("prompt", None),
|
||||
])
|
||||
def test_default(check_user_prompt_closed_with_exception, dialog_type, retval):
|
||||
check_user_prompt_closed_with_exception(dialog_type, retval)
|
@ -1,123 +0,0 @@
|
||||
# META: timeout=long
|
||||
|
||||
import pytest
|
||||
|
||||
from tests.support.asserts import assert_dialog_handled, assert_error, assert_success
|
||||
from tests.support.inline import inline
|
||||
|
||||
|
||||
def element_click(session, element):
|
||||
return session.transport.send(
|
||||
"POST", "session/{session_id}/element/{element_id}/click".format(
|
||||
session_id=session.session_id,
|
||||
element_id=element.id))
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def check_user_prompt_closed_without_exception(session, create_dialog):
|
||||
def check_user_prompt_closed_without_exception(dialog_type, retval):
|
||||
session.url = inline("<input type=text>")
|
||||
element = session.find.css("input", all=False)
|
||||
|
||||
create_dialog(dialog_type, text=dialog_type)
|
||||
|
||||
response = element_click(session, element)
|
||||
assert_success(response)
|
||||
|
||||
assert_dialog_handled(session, expected_text=dialog_type, expected_retval=retval)
|
||||
|
||||
assert session.active_element == element
|
||||
|
||||
return check_user_prompt_closed_without_exception
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def check_user_prompt_closed_with_exception(session, create_dialog):
|
||||
def check_user_prompt_closed_with_exception(dialog_type, retval):
|
||||
session.url = inline("<input type=text>")
|
||||
element = session.find.css("input", all=False)
|
||||
|
||||
create_dialog(dialog_type, text=dialog_type)
|
||||
|
||||
response = element_click(session, element)
|
||||
assert_error(response, "unexpected alert open")
|
||||
|
||||
assert_dialog_handled(session, expected_text=dialog_type, expected_retval=retval)
|
||||
|
||||
assert session.active_element != element
|
||||
|
||||
return check_user_prompt_closed_with_exception
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def check_user_prompt_not_closed_but_exception(session, create_dialog):
|
||||
def check_user_prompt_not_closed_but_exception(dialog_type):
|
||||
session.url = inline("<input type=text>")
|
||||
element = session.find.css("input", all=False)
|
||||
|
||||
create_dialog(dialog_type, text=dialog_type)
|
||||
|
||||
response = element_click(session, element)
|
||||
assert_error(response, "unexpected alert open")
|
||||
|
||||
assert session.alert.text == dialog_type
|
||||
session.alert.dismiss()
|
||||
|
||||
assert session.active_element != element
|
||||
|
||||
return check_user_prompt_not_closed_but_exception
|
||||
|
||||
|
||||
@pytest.mark.capabilities({"unhandledPromptBehavior": "accept"})
|
||||
@pytest.mark.parametrize("dialog_type, retval", [
|
||||
("alert", None),
|
||||
("confirm", True),
|
||||
("prompt", ""),
|
||||
])
|
||||
def test_accept(check_user_prompt_closed_without_exception, dialog_type, retval):
|
||||
check_user_prompt_closed_without_exception(dialog_type, retval)
|
||||
|
||||
|
||||
@pytest.mark.capabilities({"unhandledPromptBehavior": "accept and notify"})
|
||||
@pytest.mark.parametrize("dialog_type, retval", [
|
||||
("alert", None),
|
||||
("confirm", True),
|
||||
("prompt", ""),
|
||||
])
|
||||
def test_accept_and_notify(check_user_prompt_closed_with_exception, dialog_type, retval):
|
||||
check_user_prompt_closed_with_exception(dialog_type, retval)
|
||||
|
||||
|
||||
@pytest.mark.capabilities({"unhandledPromptBehavior": "dismiss"})
|
||||
@pytest.mark.parametrize("dialog_type, retval", [
|
||||
("alert", None),
|
||||
("confirm", False),
|
||||
("prompt", None),
|
||||
])
|
||||
def test_dismiss(check_user_prompt_closed_without_exception, dialog_type, retval):
|
||||
check_user_prompt_closed_without_exception(dialog_type, retval)
|
||||
|
||||
|
||||
@pytest.mark.capabilities({"unhandledPromptBehavior": "dismiss and notify"})
|
||||
@pytest.mark.parametrize("dialog_type, retval", [
|
||||
("alert", None),
|
||||
("confirm", False),
|
||||
("prompt", None),
|
||||
])
|
||||
def test_dismiss_and_notify(check_user_prompt_closed_with_exception, dialog_type, retval):
|
||||
check_user_prompt_closed_with_exception(dialog_type, retval)
|
||||
|
||||
|
||||
@pytest.mark.capabilities({"unhandledPromptBehavior": "ignore"})
|
||||
@pytest.mark.parametrize("dialog_type", ["alert", "confirm", "prompt"])
|
||||
def test_ignore(check_user_prompt_not_closed_but_exception, dialog_type):
|
||||
check_user_prompt_not_closed_but_exception(dialog_type)
|
||||
|
||||
|
||||
@pytest.mark.parametrize("dialog_type, retval", [
|
||||
("alert", None),
|
||||
("confirm", False),
|
||||
("prompt", None),
|
||||
])
|
||||
def test_default(check_user_prompt_closed_with_exception, dialog_type, retval):
|
||||
check_user_prompt_closed_with_exception(dialog_type, retval)
|
@ -1,4 +1,4 @@
|
||||
from tests.support.asserts import assert_error, assert_is_active_element, assert_success
|
||||
from tests.support.asserts import assert_error, assert_same_element
|
||||
from tests.support.inline import inline
|
||||
|
||||
|
||||
@ -11,12 +11,37 @@ def get_active_element(session):
|
||||
"GET", "session/{session_id}/element/active".format(**vars(session)))
|
||||
|
||||
|
||||
def assert_is_active_element(session, response):
|
||||
"""Ensure that the provided object is a successful WebDriver
|
||||
response describing an element reference and that the referenced
|
||||
element matches the element returned by the `activeElement`
|
||||
attribute of the current browsing context's active document.
|
||||
|
||||
"""
|
||||
assert response.status == 200
|
||||
assert "value" in response.body
|
||||
|
||||
from_js = session.execute_script("return document.activeElement")
|
||||
|
||||
if response.body["value"] is None:
|
||||
assert from_js is None
|
||||
else:
|
||||
assert_same_element(session, response.body["value"], from_js)
|
||||
|
||||
|
||||
def test_no_browsing_context(session, closed_window):
|
||||
response = get_active_element(session)
|
||||
assert_error(response, "no such window")
|
||||
|
||||
|
||||
def test_success_document(session):
|
||||
"""
|
||||
> [...]
|
||||
> 3. Let active element be the active element of the current browsing
|
||||
> context's document element.
|
||||
> 4. Let active web element be the JSON Serialization of active element.
|
||||
> 5. Return success with data active web element.
|
||||
"""
|
||||
session.url = inline("""
|
||||
<body>
|
||||
<h1>Heading</h1>
|
||||
@ -25,10 +50,8 @@ def test_success_document(session):
|
||||
<input style="opacity: 0" />
|
||||
<p>Another element</p>
|
||||
</body>""")
|
||||
|
||||
response = get_active_element(session)
|
||||
element = assert_success(response)
|
||||
assert_is_active_element(session, element)
|
||||
assert_is_active_element(session, response)
|
||||
|
||||
|
||||
def test_sucess_input(session):
|
||||
@ -39,10 +62,8 @@ def test_sucess_input(session):
|
||||
<input style="opacity: 0" />
|
||||
<p>Another element</p>
|
||||
</body>""")
|
||||
|
||||
response = get_active_element(session)
|
||||
element = assert_success(response)
|
||||
assert_is_active_element(session, element)
|
||||
assert_is_active_element(session, response)
|
||||
|
||||
|
||||
def test_sucess_input_non_interactable(session):
|
||||
@ -53,10 +74,8 @@ def test_sucess_input_non_interactable(session):
|
||||
<input style="opacity: 0" autofocus />
|
||||
<p>Another element</p>
|
||||
</body>""")
|
||||
|
||||
response = get_active_element(session)
|
||||
element = assert_success(response)
|
||||
assert_is_active_element(session, element)
|
||||
assert_is_active_element(session, response)
|
||||
|
||||
|
||||
def test_success_explicit_focus(session):
|
||||
@ -69,18 +88,15 @@ def test_success_explicit_focus(session):
|
||||
|
||||
session.execute_script("document.body.getElementsByTagName('h1')[0].focus()")
|
||||
response = get_active_element(session)
|
||||
element = assert_success(response)
|
||||
assert_is_active_element(session, element)
|
||||
assert_is_active_element(session, response)
|
||||
|
||||
session.execute_script("document.body.getElementsByTagName('input')[0].focus()")
|
||||
response = get_active_element(session)
|
||||
element = assert_success(response)
|
||||
assert_is_active_element(session, element)
|
||||
assert_is_active_element(session, response)
|
||||
|
||||
session.execute_script("document.body.getElementsByTagName('iframe')[0].focus()")
|
||||
response = get_active_element(session)
|
||||
element = assert_success(response)
|
||||
assert_is_active_element(session, element)
|
||||
assert_is_active_element(session, response)
|
||||
|
||||
session.execute_script("document.body.getElementsByTagName('iframe')[0].focus();")
|
||||
session.execute_script("""
|
||||
@ -91,13 +107,11 @@ def test_success_explicit_focus(session):
|
||||
iframe.removeNode(true);
|
||||
}""")
|
||||
response = get_active_element(session)
|
||||
element = assert_success(response)
|
||||
assert_is_active_element(session, element)
|
||||
assert_is_active_element(session, response)
|
||||
|
||||
session.execute_script("document.body.appendChild(document.createElement('textarea'))")
|
||||
response = get_active_element(session)
|
||||
element = assert_success(response)
|
||||
assert_is_active_element(session, element)
|
||||
assert_is_active_element(session, response)
|
||||
|
||||
|
||||
def test_success_iframe_content(session):
|
||||
@ -111,8 +125,7 @@ def test_success_iframe_content(session):
|
||||
""")
|
||||
|
||||
response = get_active_element(session)
|
||||
element = assert_success(response)
|
||||
assert_is_active_element(session, element)
|
||||
assert_is_active_element(session, response)
|
||||
|
||||
|
||||
def test_missing_document_element(session):
|
||||
|
@ -1,119 +0,0 @@
|
||||
# META: timeout=long
|
||||
|
||||
import pytest
|
||||
|
||||
from tests.support.asserts import (
|
||||
assert_dialog_handled,
|
||||
assert_error,
|
||||
assert_is_active_element,
|
||||
assert_success
|
||||
)
|
||||
from tests.support.inline import inline
|
||||
|
||||
|
||||
def get_active_element(session):
|
||||
return session.transport.send(
|
||||
"GET", "session/{session_id}/element/active".format(**vars(session)))
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def check_user_prompt_closed_without_exception(session, create_dialog):
|
||||
def check_user_prompt_closed_without_exception(dialog_type, retval):
|
||||
session.url = inline("<input type=text>")
|
||||
|
||||
create_dialog(dialog_type, text=dialog_type)
|
||||
|
||||
response = get_active_element(session)
|
||||
element = assert_success(response)
|
||||
|
||||
assert_dialog_handled(session, expected_text=dialog_type, expected_retval=retval)
|
||||
|
||||
assert_is_active_element(session, element)
|
||||
|
||||
return check_user_prompt_closed_without_exception
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def check_user_prompt_closed_with_exception(session, create_dialog):
|
||||
def check_user_prompt_closed_with_exception(dialog_type, retval):
|
||||
session.url = inline("<input type=text>")
|
||||
|
||||
create_dialog(dialog_type, text=dialog_type)
|
||||
|
||||
response = get_active_element(session)
|
||||
assert_error(response, "unexpected alert open")
|
||||
|
||||
assert_dialog_handled(session, expected_text=dialog_type, expected_retval=retval)
|
||||
|
||||
return check_user_prompt_closed_with_exception
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def check_user_prompt_not_closed_but_exception(session, create_dialog):
|
||||
def check_user_prompt_not_closed_but_exception(dialog_type):
|
||||
session.url = inline("<input type=text>")
|
||||
|
||||
create_dialog(dialog_type, text=dialog_type)
|
||||
|
||||
response = get_active_element(session)
|
||||
assert_error(response, "unexpected alert open")
|
||||
|
||||
assert session.alert.text == dialog_type
|
||||
session.alert.dismiss()
|
||||
|
||||
return check_user_prompt_not_closed_but_exception
|
||||
|
||||
|
||||
@pytest.mark.capabilities({"unhandledPromptBehavior": "accept"})
|
||||
@pytest.mark.parametrize("dialog_type, retval", [
|
||||
("alert", None),
|
||||
("confirm", True),
|
||||
("prompt", ""),
|
||||
])
|
||||
def test_accept(check_user_prompt_closed_without_exception, dialog_type, retval):
|
||||
check_user_prompt_closed_without_exception(dialog_type, retval)
|
||||
|
||||
|
||||
@pytest.mark.capabilities({"unhandledPromptBehavior": "accept and notify"})
|
||||
@pytest.mark.parametrize("dialog_type, retval", [
|
||||
("alert", None),
|
||||
("confirm", True),
|
||||
("prompt", ""),
|
||||
])
|
||||
def test_accept_and_notify(check_user_prompt_closed_with_exception, dialog_type, retval):
|
||||
check_user_prompt_closed_with_exception(dialog_type, retval)
|
||||
|
||||
|
||||
@pytest.mark.capabilities({"unhandledPromptBehavior": "dismiss"})
|
||||
@pytest.mark.parametrize("dialog_type, retval", [
|
||||
("alert", None),
|
||||
("confirm", False),
|
||||
("prompt", None),
|
||||
])
|
||||
def test_dismiss(check_user_prompt_closed_without_exception, dialog_type, retval):
|
||||
check_user_prompt_closed_without_exception(dialog_type, retval)
|
||||
|
||||
|
||||
@pytest.mark.capabilities({"unhandledPromptBehavior": "dismiss and notify"})
|
||||
@pytest.mark.parametrize("dialog_type, retval", [
|
||||
("alert", None),
|
||||
("confirm", False),
|
||||
("prompt", None),
|
||||
])
|
||||
def test_dismiss_and_notify(check_user_prompt_closed_with_exception, dialog_type, retval):
|
||||
check_user_prompt_closed_with_exception(dialog_type, retval)
|
||||
|
||||
|
||||
@pytest.mark.capabilities({"unhandledPromptBehavior": "ignore"})
|
||||
@pytest.mark.parametrize("dialog_type", ["alert", "confirm", "prompt"])
|
||||
def test_ignore(check_user_prompt_not_closed_but_exception, dialog_type):
|
||||
check_user_prompt_not_closed_but_exception(dialog_type)
|
||||
|
||||
|
||||
@pytest.mark.parametrize("dialog_type, retval", [
|
||||
("alert", None),
|
||||
("confirm", False),
|
||||
("prompt", None),
|
||||
])
|
||||
def test_default(check_user_prompt_closed_with_exception, dialog_type, retval):
|
||||
check_user_prompt_closed_with_exception(dialog_type, retval)
|
@ -1,118 +0,0 @@
|
||||
# META: timeout=long
|
||||
|
||||
import pytest
|
||||
|
||||
from tests.support.asserts import assert_error, assert_success, assert_dialog_handled
|
||||
from tests.support.inline import inline
|
||||
|
||||
|
||||
def get_element_attribute(session, element, attr):
|
||||
return session.transport.send(
|
||||
"GET", "session/{session_id}/element/{element_id}/attribute/{attr}".format(
|
||||
session_id=session.session_id,
|
||||
element_id=element,
|
||||
attr=attr))
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def check_user_prompt_closed_without_exception(session, create_dialog):
|
||||
def check_user_prompt_closed_without_exception(dialog_type, retval):
|
||||
session.url = inline("<input id=foo>")
|
||||
element = session.find.css("#foo", all=False)
|
||||
|
||||
create_dialog(dialog_type, text=dialog_type)
|
||||
|
||||
response = get_element_attribute(session, element.id, "id")
|
||||
assert_success(response, "foo")
|
||||
|
||||
assert_dialog_handled(session, expected_text=dialog_type, expected_retval=retval)
|
||||
|
||||
return check_user_prompt_closed_without_exception
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def check_user_prompt_closed_with_exception(session, create_dialog):
|
||||
def check_user_prompt_closed_with_exception(dialog_type, retval):
|
||||
session.url = inline("<input id=foo>")
|
||||
element = session.find.css("#foo", all=False)
|
||||
|
||||
create_dialog(dialog_type, text=dialog_type)
|
||||
|
||||
response = get_element_attribute(session, element.id, "id")
|
||||
assert_error(response, "unexpected alert open")
|
||||
|
||||
assert_dialog_handled(session, expected_text=dialog_type, expected_retval=retval)
|
||||
|
||||
return check_user_prompt_closed_with_exception
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def check_user_prompt_not_closed_but_exception(session, create_dialog):
|
||||
def check_user_prompt_not_closed_but_exception(dialog_type):
|
||||
session.url = inline("<input id=foo>")
|
||||
element = session.find.css("#foo", all=False)
|
||||
|
||||
create_dialog(dialog_type, text=dialog_type)
|
||||
|
||||
response = get_element_attribute(session, element.id, "id")
|
||||
assert_error(response, "unexpected alert open")
|
||||
|
||||
assert session.alert.text == dialog_type
|
||||
session.alert.dismiss()
|
||||
|
||||
return check_user_prompt_not_closed_but_exception
|
||||
|
||||
|
||||
@pytest.mark.capabilities({"unhandledPromptBehavior": "accept"})
|
||||
@pytest.mark.parametrize("dialog_type, retval", [
|
||||
("alert", None),
|
||||
("confirm", True),
|
||||
("prompt", ""),
|
||||
])
|
||||
def test_accept(check_user_prompt_closed_without_exception, dialog_type, retval):
|
||||
check_user_prompt_closed_without_exception(dialog_type, retval)
|
||||
|
||||
|
||||
@pytest.mark.capabilities({"unhandledPromptBehavior": "accept and notify"})
|
||||
@pytest.mark.parametrize("dialog_type, retval", [
|
||||
("alert", None),
|
||||
("confirm", True),
|
||||
("prompt", ""),
|
||||
])
|
||||
def test_accept_and_notify(check_user_prompt_closed_with_exception, dialog_type, retval):
|
||||
check_user_prompt_closed_with_exception(dialog_type, retval)
|
||||
|
||||
|
||||
@pytest.mark.capabilities({"unhandledPromptBehavior": "dismiss"})
|
||||
@pytest.mark.parametrize("dialog_type, retval", [
|
||||
("alert", None),
|
||||
("confirm", False),
|
||||
("prompt", None),
|
||||
])
|
||||
def test_dismiss(check_user_prompt_closed_without_exception, dialog_type, retval):
|
||||
check_user_prompt_closed_without_exception(dialog_type, retval)
|
||||
|
||||
|
||||
@pytest.mark.capabilities({"unhandledPromptBehavior": "dismiss and notify"})
|
||||
@pytest.mark.parametrize("dialog_type, retval", [
|
||||
("alert", None),
|
||||
("confirm", False),
|
||||
("prompt", None),
|
||||
])
|
||||
def test_dismiss_and_notify(check_user_prompt_closed_with_exception, dialog_type, retval):
|
||||
check_user_prompt_closed_with_exception(dialog_type, retval)
|
||||
|
||||
|
||||
@pytest.mark.capabilities({"unhandledPromptBehavior": "ignore"})
|
||||
@pytest.mark.parametrize("dialog_type", ["alert", "confirm", "prompt"])
|
||||
def test_ignore(check_user_prompt_not_closed_but_exception, dialog_type):
|
||||
check_user_prompt_not_closed_but_exception(dialog_type)
|
||||
|
||||
|
||||
@pytest.mark.parametrize("dialog_type, retval", [
|
||||
("alert", None),
|
||||
("confirm", False),
|
||||
("prompt", None),
|
||||
])
|
||||
def test_default(check_user_prompt_closed_with_exception, dialog_type, retval):
|
||||
check_user_prompt_closed_with_exception(dialog_type, retval)
|
@ -1,117 +0,0 @@
|
||||
# META: timeout=long
|
||||
|
||||
import pytest
|
||||
|
||||
from tests.support.asserts import assert_error, assert_success, assert_dialog_handled
|
||||
from tests.support.inline import inline
|
||||
|
||||
|
||||
def get_element_text(session, element_id):
|
||||
return session.transport.send(
|
||||
"GET", "session/{session_id}/element/{element_id}/text".format(
|
||||
session_id=session.session_id,
|
||||
element_id=element_id))
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def check_user_prompt_closed_without_exception(session, create_dialog):
|
||||
def check_user_prompt_closed_without_exception(dialog_type, retval):
|
||||
session.url = inline("<p id=foo>bar</p>")
|
||||
element = session.find.css("#foo", all=False)
|
||||
|
||||
create_dialog(dialog_type, text=dialog_type)
|
||||
|
||||
response = get_element_text(session, element.id)
|
||||
assert_success(response, "bar")
|
||||
|
||||
assert_dialog_handled(session, expected_text=dialog_type, expected_retval=retval)
|
||||
|
||||
return check_user_prompt_closed_without_exception
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def check_user_prompt_closed_with_exception(session, create_dialog):
|
||||
def check_user_prompt_closed_with_exception(dialog_type, retval):
|
||||
session.url = inline("<p id=foo>bar</p>")
|
||||
element = session.find.css("#foo", all=False)
|
||||
|
||||
create_dialog(dialog_type, text=dialog_type)
|
||||
|
||||
response = get_element_text(session, element.id)
|
||||
assert_error(response, "unexpected alert open")
|
||||
|
||||
assert_dialog_handled(session, expected_text=dialog_type, expected_retval=retval)
|
||||
|
||||
return check_user_prompt_closed_with_exception
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def check_user_prompt_not_closed_but_exception(session, create_dialog):
|
||||
def check_user_prompt_not_closed_but_exception(dialog_type):
|
||||
session.url = inline("<p id=foo>bar</p>")
|
||||
element = session.find.css("#foo", all=False)
|
||||
|
||||
create_dialog(dialog_type, text=dialog_type)
|
||||
|
||||
response = get_element_text(session, element.id)
|
||||
assert_error(response, "unexpected alert open")
|
||||
|
||||
assert session.alert.text == dialog_type
|
||||
session.alert.dismiss()
|
||||
|
||||
return check_user_prompt_not_closed_but_exception
|
||||
|
||||
|
||||
@pytest.mark.capabilities({"unhandledPromptBehavior": "accept"})
|
||||
@pytest.mark.parametrize("dialog_type, retval", [
|
||||
("alert", None),
|
||||
("confirm", True),
|
||||
("prompt", ""),
|
||||
])
|
||||
def test_accept(check_user_prompt_closed_without_exception, dialog_type, retval):
|
||||
check_user_prompt_closed_without_exception(dialog_type, retval)
|
||||
|
||||
|
||||
@pytest.mark.capabilities({"unhandledPromptBehavior": "accept and notify"})
|
||||
@pytest.mark.parametrize("dialog_type, retval", [
|
||||
("alert", None),
|
||||
("confirm", True),
|
||||
("prompt", ""),
|
||||
])
|
||||
def test_accept_and_notify(check_user_prompt_closed_with_exception, dialog_type, retval):
|
||||
check_user_prompt_closed_with_exception(dialog_type, retval)
|
||||
|
||||
|
||||
@pytest.mark.capabilities({"unhandledPromptBehavior": "dismiss"})
|
||||
@pytest.mark.parametrize("dialog_type, retval", [
|
||||
("alert", None),
|
||||
("confirm", False),
|
||||
("prompt", None),
|
||||
])
|
||||
def test_dismiss(check_user_prompt_closed_without_exception, dialog_type, retval):
|
||||
check_user_prompt_closed_without_exception(dialog_type, retval)
|
||||
|
||||
|
||||
@pytest.mark.capabilities({"unhandledPromptBehavior": "dismiss and notify"})
|
||||
@pytest.mark.parametrize("dialog_type, retval", [
|
||||
("alert", None),
|
||||
("confirm", False),
|
||||
("prompt", None),
|
||||
])
|
||||
def test_dismiss_and_notify(check_user_prompt_closed_with_exception, dialog_type, retval):
|
||||
check_user_prompt_closed_with_exception(dialog_type, retval)
|
||||
|
||||
|
||||
@pytest.mark.capabilities({"unhandledPromptBehavior": "ignore"})
|
||||
@pytest.mark.parametrize("dialog_type", ["alert", "confirm", "prompt"])
|
||||
def test_ignore(check_user_prompt_not_closed_but_exception, dialog_type):
|
||||
check_user_prompt_not_closed_but_exception(dialog_type)
|
||||
|
||||
|
||||
@pytest.mark.parametrize("dialog_type, retval", [
|
||||
("alert", None),
|
||||
("confirm", False),
|
||||
("prompt", None),
|
||||
])
|
||||
def test_default(check_user_prompt_closed_with_exception, dialog_type, retval):
|
||||
check_user_prompt_closed_with_exception(dialog_type, retval)
|
@ -1,118 +0,0 @@
|
||||
# META: timeout=long
|
||||
|
||||
import pytest
|
||||
|
||||
from webdriver.error import NoSuchCookieException
|
||||
|
||||
from tests.support.asserts import assert_dialog_handled, assert_error, assert_success
|
||||
|
||||
|
||||
def get_named_cookie(session, name):
|
||||
return session.transport.send(
|
||||
"GET", "session/{session_id}/cookie/{name}".format(
|
||||
session_id=session.session_id,
|
||||
name=name))
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def check_user_prompt_closed_without_exception(session, create_dialog, create_cookie):
|
||||
def check_user_prompt_closed_without_exception(dialog_type, retval):
|
||||
create_cookie("foo", value="bar", path="/common/blank.html")
|
||||
|
||||
create_dialog(dialog_type, text=dialog_type)
|
||||
|
||||
response = get_named_cookie(session, "foo")
|
||||
cookie = assert_success(response)
|
||||
|
||||
assert_dialog_handled(session, expected_text=dialog_type, expected_retval=retval)
|
||||
|
||||
assert cookie["name"] == "foo"
|
||||
assert cookie["value"] == "bar"
|
||||
|
||||
return check_user_prompt_closed_without_exception
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def check_user_prompt_closed_with_exception(session, create_dialog, create_cookie):
|
||||
def check_user_prompt_closed_with_exception(dialog_type, retval):
|
||||
create_cookie("foo", value="bar", path="/common/blank.html")
|
||||
|
||||
create_dialog(dialog_type, text=dialog_type)
|
||||
|
||||
response = get_named_cookie(session, "foo")
|
||||
assert_error(response, "unexpected alert open")
|
||||
|
||||
assert_dialog_handled(session, expected_text=dialog_type, expected_retval=retval)
|
||||
|
||||
return check_user_prompt_closed_with_exception
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def check_user_prompt_not_closed_but_exception(session, create_dialog, create_cookie):
|
||||
def check_user_prompt_not_closed_but_exception(dialog_type):
|
||||
create_cookie("foo", value="bar", path="/common/blank.html")
|
||||
|
||||
create_dialog(dialog_type, text=dialog_type)
|
||||
|
||||
response = get_named_cookie(session, "foo")
|
||||
assert_error(response, "unexpected alert open")
|
||||
|
||||
assert session.alert.text == dialog_type
|
||||
session.alert.dismiss()
|
||||
|
||||
return check_user_prompt_not_closed_but_exception
|
||||
|
||||
|
||||
@pytest.mark.capabilities({"unhandledPromptBehavior": "accept"})
|
||||
@pytest.mark.parametrize("dialog_type, retval", [
|
||||
("alert", None),
|
||||
("confirm", True),
|
||||
("prompt", ""),
|
||||
])
|
||||
def test_accept(check_user_prompt_closed_without_exception, dialog_type, retval):
|
||||
check_user_prompt_closed_without_exception(dialog_type, retval)
|
||||
|
||||
|
||||
@pytest.mark.capabilities({"unhandledPromptBehavior": "accept and notify"})
|
||||
@pytest.mark.parametrize("dialog_type, retval", [
|
||||
("alert", None),
|
||||
("confirm", True),
|
||||
("prompt", ""),
|
||||
])
|
||||
def test_accept_and_notify(check_user_prompt_closed_with_exception, dialog_type, retval):
|
||||
check_user_prompt_closed_with_exception(dialog_type, retval)
|
||||
|
||||
|
||||
@pytest.mark.capabilities({"unhandledPromptBehavior": "dismiss"})
|
||||
@pytest.mark.parametrize("dialog_type, retval", [
|
||||
("alert", None),
|
||||
("confirm", False),
|
||||
("prompt", None),
|
||||
])
|
||||
def test_dismiss(check_user_prompt_closed_without_exception, dialog_type, retval):
|
||||
check_user_prompt_closed_without_exception(dialog_type, retval)
|
||||
|
||||
|
||||
@pytest.mark.capabilities({"unhandledPromptBehavior": "dismiss and notify"})
|
||||
@pytest.mark.parametrize("dialog_type, retval", [
|
||||
("alert", None),
|
||||
("confirm", False),
|
||||
("prompt", None),
|
||||
])
|
||||
def test_dismiss_and_notify(check_user_prompt_closed_with_exception, dialog_type, retval):
|
||||
check_user_prompt_closed_with_exception(dialog_type, retval)
|
||||
|
||||
|
||||
@pytest.mark.capabilities({"unhandledPromptBehavior": "ignore"})
|
||||
@pytest.mark.parametrize("dialog_type", ["alert", "confirm", "prompt"])
|
||||
def test_ignore(check_user_prompt_not_closed_but_exception, dialog_type):
|
||||
check_user_prompt_not_closed_but_exception(dialog_type)
|
||||
|
||||
|
||||
@pytest.mark.parametrize("dialog_type, retval", [
|
||||
("alert", None),
|
||||
("confirm", False),
|
||||
("prompt", None),
|
||||
])
|
||||
def test_default(check_user_prompt_closed_with_exception, dialog_type, retval):
|
||||
check_user_prompt_closed_with_exception(dialog_type, retval)
|
@ -1,113 +0,0 @@
|
||||
# META: timeout=long
|
||||
|
||||
import pytest
|
||||
|
||||
from tests.support.asserts import assert_error, assert_success, assert_dialog_handled
|
||||
from tests.support.inline import inline
|
||||
|
||||
|
||||
def get_page_source(session):
|
||||
return session.transport.send(
|
||||
"GET", "session/{session_id}/source".format(**vars(session)))
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def check_user_prompt_closed_without_exception(session, create_dialog):
|
||||
def check_user_prompt_closed_without_exception(dialog_type, retval):
|
||||
session.url = inline("<div/>")
|
||||
expected = session.execute_script("return document.documentElement.outerHTML")
|
||||
|
||||
create_dialog(dialog_type, text=dialog_type)
|
||||
|
||||
response = get_page_source(session)
|
||||
assert_success(response, expected)
|
||||
|
||||
assert_dialog_handled(session, expected_text=dialog_type, expected_retval=retval)
|
||||
|
||||
return check_user_prompt_closed_without_exception
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def check_user_prompt_closed_with_exception(session, create_dialog):
|
||||
def check_user_prompt_closed_with_exception(dialog_type, retval):
|
||||
session.url = inline("<div/>")
|
||||
|
||||
create_dialog(dialog_type, text=dialog_type)
|
||||
|
||||
response = get_page_source(session)
|
||||
assert_error(response, "unexpected alert open")
|
||||
|
||||
assert_dialog_handled(session, expected_text=dialog_type, expected_retval=retval)
|
||||
|
||||
return check_user_prompt_closed_with_exception
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def check_user_prompt_not_closed_but_exception(session, create_dialog):
|
||||
def check_user_prompt_not_closed_but_exception(dialog_type):
|
||||
session.url = inline("<div/>")
|
||||
|
||||
create_dialog(dialog_type, text=dialog_type)
|
||||
|
||||
response = get_page_source(session)
|
||||
assert_error(response, "unexpected alert open")
|
||||
|
||||
assert session.alert.text == dialog_type
|
||||
session.alert.dismiss()
|
||||
|
||||
return check_user_prompt_not_closed_but_exception
|
||||
|
||||
|
||||
@pytest.mark.capabilities({"unhandledPromptBehavior": "accept"})
|
||||
@pytest.mark.parametrize("dialog_type, retval", [
|
||||
("alert", None),
|
||||
("confirm", True),
|
||||
("prompt", ""),
|
||||
])
|
||||
def test_accept(check_user_prompt_closed_without_exception, dialog_type, retval):
|
||||
check_user_prompt_closed_without_exception(dialog_type, retval)
|
||||
|
||||
|
||||
@pytest.mark.capabilities({"unhandledPromptBehavior": "accept and notify"})
|
||||
@pytest.mark.parametrize("dialog_type, retval", [
|
||||
("alert", None),
|
||||
("confirm", True),
|
||||
("prompt", ""),
|
||||
])
|
||||
def test_accept_and_notify(check_user_prompt_closed_with_exception, dialog_type, retval):
|
||||
check_user_prompt_closed_with_exception(dialog_type, retval)
|
||||
|
||||
|
||||
@pytest.mark.capabilities({"unhandledPromptBehavior": "dismiss"})
|
||||
@pytest.mark.parametrize("dialog_type, retval", [
|
||||
("alert", None),
|
||||
("confirm", False),
|
||||
("prompt", None),
|
||||
])
|
||||
def test_dismiss(check_user_prompt_closed_without_exception, dialog_type, retval):
|
||||
check_user_prompt_closed_without_exception(dialog_type, retval)
|
||||
|
||||
|
||||
@pytest.mark.capabilities({"unhandledPromptBehavior": "dismiss and notify"})
|
||||
@pytest.mark.parametrize("dialog_type, retval", [
|
||||
("alert", None),
|
||||
("confirm", False),
|
||||
("prompt", None),
|
||||
])
|
||||
def test_dismiss_and_notify(check_user_prompt_closed_with_exception, dialog_type, retval):
|
||||
check_user_prompt_closed_with_exception(dialog_type, retval)
|
||||
|
||||
|
||||
@pytest.mark.capabilities({"unhandledPromptBehavior": "ignore"})
|
||||
@pytest.mark.parametrize("dialog_type", ["alert", "confirm", "prompt"])
|
||||
def test_ignore(check_user_prompt_not_closed_but_exception, dialog_type):
|
||||
check_user_prompt_not_closed_but_exception(dialog_type)
|
||||
|
||||
|
||||
@pytest.mark.parametrize("dialog_type, retval", [
|
||||
("alert", None),
|
||||
("confirm", False),
|
||||
("prompt", None),
|
||||
])
|
||||
def test_default(check_user_prompt_closed_with_exception, dialog_type, retval):
|
||||
check_user_prompt_closed_with_exception(dialog_type, retval)
|
@ -1,113 +0,0 @@
|
||||
# META: timeout=long
|
||||
|
||||
import pytest
|
||||
|
||||
from tests.support.asserts import assert_error, assert_success, assert_dialog_handled
|
||||
from tests.support.inline import inline
|
||||
|
||||
|
||||
def navigate_to(session, url):
|
||||
return session.transport.send(
|
||||
"POST", "session/{session_id}/url".format(**vars(session)),
|
||||
{"url": url})
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def check_user_prompt_closed_without_exception(session, create_dialog):
|
||||
def check_user_prompt_closed_without_exception(dialog_type, retval):
|
||||
url = inline("<div/>")
|
||||
|
||||
create_dialog(dialog_type, text=dialog_type)
|
||||
|
||||
response = navigate_to(session, url)
|
||||
assert_success(response)
|
||||
|
||||
assert_dialog_handled(session, expected_text=dialog_type, expected_retval=retval)
|
||||
|
||||
assert session.url == url
|
||||
|
||||
return check_user_prompt_closed_without_exception
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def check_user_prompt_closed_with_exception(session, create_dialog):
|
||||
def check_user_prompt_closed_with_exception(dialog_type, retval):
|
||||
url = inline("<div/>")
|
||||
|
||||
create_dialog(dialog_type, text=dialog_type)
|
||||
|
||||
response = navigate_to(session, url)
|
||||
assert_error(response, "unexpected alert open")
|
||||
|
||||
assert_dialog_handled(session, expected_text=dialog_type, expected_retval=retval)
|
||||
|
||||
assert session.url != url
|
||||
|
||||
return check_user_prompt_closed_with_exception
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def check_user_prompt_not_closed_but_exception(session, create_dialog):
|
||||
def check_user_prompt_not_closed_but_exception(dialog_type):
|
||||
url = inline("<div/>")
|
||||
|
||||
create_dialog(dialog_type, text=dialog_type)
|
||||
|
||||
response = navigate_to(session, url)
|
||||
assert_error(response, "unexpected alert open")
|
||||
|
||||
assert session.alert.text == dialog_type
|
||||
session.alert.dismiss()
|
||||
|
||||
assert session.url != url
|
||||
|
||||
return check_user_prompt_not_closed_but_exception
|
||||
|
||||
|
||||
@pytest.mark.capabilities({"unhandledPromptBehavior": "accept"})
|
||||
@pytest.mark.parametrize("dialog_type", ["alert", "confirm", "prompt"])
|
||||
def test_accept(check_user_prompt_closed_without_exception, dialog_type):
|
||||
# retval not testable for confirm and prompt because window is gone
|
||||
check_user_prompt_closed_without_exception(dialog_type, None)
|
||||
|
||||
|
||||
@pytest.mark.capabilities({"unhandledPromptBehavior": "accept and notify"})
|
||||
@pytest.mark.parametrize("dialog_type, retval", [
|
||||
("alert", None),
|
||||
("confirm", True),
|
||||
("prompt", ""),
|
||||
])
|
||||
def test_accept_and_notify(check_user_prompt_closed_with_exception, dialog_type, retval):
|
||||
check_user_prompt_closed_with_exception(dialog_type, retval)
|
||||
|
||||
|
||||
@pytest.mark.capabilities({"unhandledPromptBehavior": "dismiss"})
|
||||
@pytest.mark.parametrize("dialog_type", ["alert", "confirm", "prompt"])
|
||||
def test_dismiss(check_user_prompt_closed_without_exception, dialog_type):
|
||||
# retval not testable for confirm and prompt because window is gone
|
||||
check_user_prompt_closed_without_exception(dialog_type, None)
|
||||
|
||||
|
||||
@pytest.mark.capabilities({"unhandledPromptBehavior": "dismiss and notify"})
|
||||
@pytest.mark.parametrize("dialog_type, retval", [
|
||||
("alert", None),
|
||||
("confirm", False),
|
||||
("prompt", None),
|
||||
])
|
||||
def test_dismiss_and_notify(check_user_prompt_closed_with_exception, dialog_type, retval):
|
||||
check_user_prompt_closed_with_exception(dialog_type, retval)
|
||||
|
||||
|
||||
@pytest.mark.capabilities({"unhandledPromptBehavior": "ignore"})
|
||||
@pytest.mark.parametrize("dialog_type", ["alert", "confirm", "prompt"])
|
||||
def test_ignore(check_user_prompt_not_closed_but_exception, dialog_type):
|
||||
check_user_prompt_not_closed_but_exception(dialog_type)
|
||||
|
||||
|
||||
@pytest.mark.parametrize("dialog_type, retval", [
|
||||
("alert", None),
|
||||
("confirm", False),
|
||||
("prompt", None),
|
||||
])
|
||||
def test_default(check_user_prompt_closed_with_exception, dialog_type, retval):
|
||||
check_user_prompt_closed_with_exception(dialog_type, retval)
|
@ -1,124 +0,0 @@
|
||||
# META: timeout=long
|
||||
|
||||
import pytest
|
||||
|
||||
from tests.perform_actions.support.refine import get_keys
|
||||
from tests.support.asserts import assert_error, assert_success, assert_dialog_handled
|
||||
|
||||
|
||||
actions = [{
|
||||
"type": "key",
|
||||
"id": "foobar",
|
||||
"actions": [
|
||||
{"type": "keyDown", "value": "a"},
|
||||
{"type": "keyUp", "value": "a"},
|
||||
]
|
||||
}]
|
||||
|
||||
|
||||
def perform_actions(session, actions):
|
||||
return session.transport.send(
|
||||
"POST",
|
||||
"/session/{session_id}/actions".format(session_id=session.session_id),
|
||||
{"actions": actions})
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def check_user_prompt_closed_without_exception(session, create_dialog, key_chain, key_reporter):
|
||||
def check_user_prompt_closed_without_exception(dialog_type, retval):
|
||||
create_dialog(dialog_type, text=dialog_type)
|
||||
|
||||
response = perform_actions(session, actions)
|
||||
assert_success(response)
|
||||
|
||||
assert_dialog_handled(session, expected_text=dialog_type, expected_retval=retval)
|
||||
|
||||
assert get_keys(key_reporter) == "a"
|
||||
|
||||
return check_user_prompt_closed_without_exception
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def check_user_prompt_closed_with_exception(session, create_dialog, key_chain, key_reporter):
|
||||
def check_user_prompt_closed_with_exception(dialog_type, retval):
|
||||
create_dialog(dialog_type, text=dialog_type)
|
||||
|
||||
response = perform_actions(session, actions)
|
||||
assert_error(response, "unexpected alert open")
|
||||
|
||||
assert_dialog_handled(session, expected_text=dialog_type, expected_retval=retval)
|
||||
|
||||
assert get_keys(key_reporter) == ""
|
||||
|
||||
return check_user_prompt_closed_with_exception
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def check_user_prompt_not_closed_but_exception(session, create_dialog, key_reporter):
|
||||
def check_user_prompt_not_closed_but_exception(dialog_type):
|
||||
create_dialog(dialog_type, text=dialog_type)
|
||||
|
||||
response = perform_actions(session, actions)
|
||||
assert_error(response, "unexpected alert open")
|
||||
|
||||
assert session.alert.text == dialog_type
|
||||
session.alert.dismiss()
|
||||
|
||||
assert get_keys(key_reporter) == ""
|
||||
|
||||
return check_user_prompt_not_closed_but_exception
|
||||
|
||||
|
||||
@pytest.mark.capabilities({"unhandledPromptBehavior": "accept"})
|
||||
@pytest.mark.parametrize("dialog_type, retval", [
|
||||
("alert", None),
|
||||
("confirm", True),
|
||||
("prompt", ""),
|
||||
])
|
||||
def test_accept(check_user_prompt_closed_without_exception, dialog_type, retval):
|
||||
check_user_prompt_closed_without_exception(dialog_type, retval)
|
||||
|
||||
|
||||
@pytest.mark.capabilities({"unhandledPromptBehavior": "accept and notify"})
|
||||
@pytest.mark.parametrize("dialog_type, retval", [
|
||||
("alert", None),
|
||||
("confirm", True),
|
||||
("prompt", ""),
|
||||
])
|
||||
def test_accept_and_notify(check_user_prompt_closed_with_exception, dialog_type, retval):
|
||||
check_user_prompt_closed_with_exception(dialog_type, retval)
|
||||
|
||||
|
||||
@pytest.mark.capabilities({"unhandledPromptBehavior": "dismiss"})
|
||||
@pytest.mark.parametrize("dialog_type, retval", [
|
||||
("alert", None),
|
||||
("confirm", False),
|
||||
("prompt", None),
|
||||
])
|
||||
def test_dismiss(check_user_prompt_closed_without_exception, dialog_type, retval):
|
||||
check_user_prompt_closed_without_exception(dialog_type, retval)
|
||||
|
||||
|
||||
@pytest.mark.capabilities({"unhandledPromptBehavior": "dismiss and notify"})
|
||||
@pytest.mark.parametrize("dialog_type, retval", [
|
||||
("alert", None),
|
||||
("confirm", False),
|
||||
("prompt", None),
|
||||
])
|
||||
def test_dismiss_and_notify(check_user_prompt_closed_with_exception, dialog_type, retval):
|
||||
check_user_prompt_closed_with_exception(dialog_type, retval)
|
||||
|
||||
|
||||
@pytest.mark.capabilities({"unhandledPromptBehavior": "ignore"})
|
||||
@pytest.mark.parametrize("dialog_type", ["alert", "confirm", "prompt"])
|
||||
def test_ignore(check_user_prompt_not_closed_but_exception, dialog_type):
|
||||
check_user_prompt_not_closed_but_exception(dialog_type)
|
||||
|
||||
|
||||
@pytest.mark.parametrize("dialog_type, retval", [
|
||||
("alert", None),
|
||||
("confirm", False),
|
||||
("prompt", None),
|
||||
])
|
||||
def test_default(check_user_prompt_closed_with_exception, dialog_type, retval):
|
||||
check_user_prompt_closed_with_exception(dialog_type, retval)
|
@ -115,16 +115,6 @@ def assert_files_uploaded(session, element, files):
|
||||
assert get_file_contents(index) == f.read()
|
||||
|
||||
|
||||
def assert_is_active_element(session, element):
|
||||
"""Verify that element reference is the active element."""
|
||||
from_js = session.execute_script("return document.activeElement")
|
||||
|
||||
if element is None:
|
||||
assert from_js is None
|
||||
else:
|
||||
assert_same_element(session, element, from_js)
|
||||
|
||||
|
||||
def assert_same_element(session, a, b):
|
||||
"""Verify that two element references describe the same element."""
|
||||
if isinstance(a, dict):
|
||||
|
Loading…
Reference in New Issue
Block a user