зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1907935
- [remote] Make "unhandledPromptBehavior" capability not WebDriver classic only. r=webdriver-reviewers,jdescottes
Differential Revision: https://phabricator.services.mozilla.com/D216586
This commit is contained in:
Родитель
e4ca95ab89
Коммит
f362564607
|
@ -47,7 +47,6 @@ export const WEBDRIVER_CLASSIC_CAPABILITIES = [
|
|||
"pageLoadStrategy",
|
||||
"strictFileInteractability",
|
||||
"timeouts",
|
||||
"unhandledPromptBehavior",
|
||||
"webSocketUrl",
|
||||
|
||||
// Gecko specific capabilities
|
||||
|
|
|
@ -72,7 +72,7 @@ add_task(function test_WebDriverSession_ctor() {
|
|||
// BiDi session
|
||||
session = createSession({ capabilities, isBidi: true });
|
||||
equal(session.acceptInsecureCerts, true);
|
||||
equal(session.userPromptHandler.toJSON(), "dismiss and notify");
|
||||
equal(session.userPromptHandler.toJSON(), "ignore");
|
||||
|
||||
equal(session.pageLoadStrategy, undefined);
|
||||
equal(session.strictFileInteractability, undefined);
|
||||
|
|
|
@ -114,7 +114,7 @@ add_task(async function test_createSession() {
|
|||
wdBiDi => {
|
||||
is(wdBiDi.session.bidi, true);
|
||||
is(wdBiDi.session.acceptInsecureCerts, true);
|
||||
is(wdBiDi.session.userPromptHandler.toJSON(), "dismiss and notify");
|
||||
is(wdBiDi.session.userPromptHandler.toJSON(), "ignore");
|
||||
|
||||
is(wdBiDi.session.pageLoadStrategy, undefined);
|
||||
is(wdBiDi.session.strictFileInteractability, undefined);
|
||||
|
|
|
@ -49,6 +49,47 @@ async def test_proxy(
|
|||
assert response == {"type": "string", "value": page_content}
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"value",
|
||||
[
|
||||
None,
|
||||
"accept",
|
||||
"accept and notify",
|
||||
"dismiss",
|
||||
"dismiss and notify",
|
||||
"ignore",
|
||||
],
|
||||
)
|
||||
async def test_unhandledPromptBehavior_string(new_session, match_capabilities, value):
|
||||
capabilities = match_capabilities("alwaysMatch", "unhandledPromptBehavior", value)
|
||||
|
||||
bidi_session = await new_session(capabilities=capabilities)
|
||||
|
||||
if value is None:
|
||||
assert (
|
||||
bidi_session.capabilities.get("unhandledPromptBehavior")
|
||||
== "dismiss and notify"
|
||||
)
|
||||
else:
|
||||
assert bidi_session.capabilities.get("unhandledPromptBehavior") == value
|
||||
|
||||
|
||||
@pytest.mark.parametrize("handler", ["accept", "dismiss", "ignore"])
|
||||
@pytest.mark.parametrize("prompt_type", ["alert", "beforeUnload", "confirm", "prompt"])
|
||||
async def test_unhandledPromptBehavior_object(
|
||||
new_session, match_capabilities, handler, prompt_type
|
||||
):
|
||||
capabilities = match_capabilities(
|
||||
"alwaysMatch", "unhandledPromptBehavior", {prompt_type: handler}
|
||||
)
|
||||
|
||||
bidi_session = await new_session(capabilities=capabilities)
|
||||
|
||||
assert bidi_session.capabilities.get("unhandledPromptBehavior") == {
|
||||
prompt_type: handler
|
||||
}
|
||||
|
||||
|
||||
@pytest.mark.parametrize("match_type", ["alwaysMatch", "firstMatch"])
|
||||
async def test_websocket_url(new_session, match_capabilities, match_type):
|
||||
capabilities = match_capabilities(match_type, "webSocketUrl", True)
|
||||
|
|
Загрузка…
Ссылка в новой задаче