Skip to content

Commit

Permalink
[WebDriver BiDi] Fix test for window.prompt opened (#46441)
Browse files Browse the repository at this point in the history
* [WebDriver BiDi] Fix test for window.prompt opened

* fix other test as well

* Update webdriver/tests/bidi/browsing_context/user_prompt_opened/user_prompt_opened.py

Co-authored-by: Maksim Sadym <69349599+sadym-chromium@users.noreply.github.com>

---------

Co-authored-by: Maksim Sadym <69349599+sadym-chromium@users.noreply.github.com>
  • Loading branch information
Lightning00Blade and sadym-chromium committed May 24, 2024
1 parent fd90ede commit a48548e
Showing 1 changed file with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,14 @@ async def test_prompt_type(
"context": new_tab["context"],
"type": prompt_type,
"message": text,
**({
"defaultValue": ""
} if prompt_type == 'prompt' else {})
}


@pytest.mark.parametrize(
"default", [None, "", "default"], ids=["null", "empty string", "non empty string"]
"default", [None, "", "default"], ids=["undefined", "empty string", "non empty string"]
)
async def test_prompt_default_value(
bidi_session, inline, new_tab, subscribe_events, wait_for_event, wait_for_future_safe, default
Expand All @@ -68,7 +71,7 @@ async def test_prompt_default_value(
text = "test"

if default is None:
script = f"<script>window.prompt('{text}', null)</script>"
script = f"<script>window.prompt('{text}')</script>"
else:
script = f"<script>window.prompt('{text}', '{default}')</script>"

Expand All @@ -85,7 +88,9 @@ async def test_prompt_default_value(
"message": text,
}

if default is not None:
if default is None:
expected_event["defaultValue"] = ""
else:
expected_event["defaultValue"] = default

assert event == expected_event
Expand Down

0 comments on commit a48548e

Please sign in to comment.