Skip to content

Commit

Permalink
Bug 1864302 [wpt PR 43096] - infra: address flake8 findings in webdri…
Browse files Browse the repository at this point in the history
…ver/, a=testonly

Automatic update from web-platform-tests
infra: address flake8 findings in webdriver/

Rename duplicate test to test_params_pointer_action_move_coordinate_missing

Bug: web-platform-tests/rfcs#171
Cmdline: flake8 --append-config=tools/flake8.ini webdriver/tests/bidi
--

wpt-commits: 605a1999160c97f971fce384dac5cddd4ca0b2d1
wpt-pr: 43096
  • Loading branch information
moz-wptsync-bot committed Nov 22, 2023
1 parent 1e90a3c commit ddae255
Show file tree
Hide file tree
Showing 63 changed files with 637 additions and 484 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

from . import (
get_element_coordinates,
get_page_y_offset,
get_physical_element_dimensions,
get_reference_screenshot,
)
Expand Down Expand Up @@ -176,7 +175,7 @@ async def test_clip_viewport_scroll_to(

element = await bidi_session.script.call_function(
await_promise=False,
function_declaration=f"""() => {{
function_declaration="""() => {{
const element = document.querySelector('div');
const rect = element.getBoundingClientRect();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ async def on_event(_, data):

remove_listener = bidi_session.add_event_listener(CONTEXT_DESTROYED_EVENT, on_event)

url = inline(f"<div>test</div>", domain=domain)
url = inline("<div>test</div>", domain=domain)
await bidi_session.browsing_context.navigate(
url=url, context=new_tab["context"], wait="complete"
)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import pytest

from .. import assert_browsing_context
from webdriver.bidi.modules.script import ContextTarget

pytestmark = pytest.mark.asyncio

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from webdriver.bidi.modules.script import ContextTarget
from webdriver.error import TimeoutException

from ... import any_int, any_string, recursive_compare, int_interval
from ... import any_int, recursive_compare, int_interval
from .. import assert_navigation_info

pytestmark = pytest.mark.asyncio
Expand Down Expand Up @@ -90,7 +90,7 @@ async def test_navigation_id(

on_frame_navigated = wait_for_event(FRAGMENT_NAVIGATED_EVENT)

target_url = url(EMPTY_PAGE + '#foo');
target_url = url(EMPTY_PAGE + '#foo')
result = await bidi_session.browsing_context.navigate(
context=new_tab["context"], url=target_url, wait="complete")

Expand All @@ -113,7 +113,7 @@ async def test_url_with_base_tag(bidi_session, subscribe_events, inline, new_tab

on_frame_navigated = wait_for_event(FRAGMENT_NAVIGATED_EVENT)

target_url = url + '#foo';
target_url = url + '#foo'
await bidi_session.browsing_context.navigate(context=new_tab["context"], url=target_url, wait="complete")

recursive_compare(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
pytestmark = pytest.mark.asyncio


def dataURL(doc, mime_type="text/html", charset="utf-8", isBase64=False):
def dataURL(doc, mime_type="text/html", charset="utf-8", is_base64=False):
encoding = ""
if charset:
encoding = f"charset={charset}"
elif isBase64:
elif is_base64:
encoding = "base64"

return f"data:{mime_type};{encoding},{quote(doc)}"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

import pytest
from tests.support.sync import AsyncPoll

Expand Down Expand Up @@ -376,14 +375,14 @@ async def on_event(method, data):
http_equiv_url = url(PAGE_REDIRECT_HTTP_EQUIV)
redirected_url = url(PAGE_REDIRECTED_HTML)

result = await bidi_session.browsing_context.navigate(
await bidi_session.browsing_context.navigate(
context=top_context["context"],
url=http_equiv_url,
wait="complete",
)

# Wait until we receive two events, one for the initial navigation and one for
# the http-equiv "redirect".
# Wait until we receive two events, one for the initial navigation and one
# for the http-equiv "redirect".
wait = AsyncPoll(bidi_session, timeout=2)
await wait.until(lambda _: len(events) >= 2)

Expand All @@ -403,6 +402,8 @@ async def on_event(method, data):
},
)

remove_listener()


async def test_redirect_navigation(
bidi_session, subscribe_events, top_context, url
Expand All @@ -424,7 +425,7 @@ async def on_event(method, data):
f"/webdriver/tests/support/http_handlers/redirect.py?location={html_url}"
)

result = await bidi_session.browsing_context.navigate(
await bidi_session.browsing_context.navigate(
context=top_context["context"],
url=redirect_url,
wait="complete",
Expand All @@ -439,6 +440,8 @@ async def on_event(method, data):
},
)

remove_listener()


async def test_navigate_history_pushstate(
bidi_session, inline, new_tab, subscribe_events, wait_for_event, wait_for_future_safe
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,8 +173,8 @@ async def test_margin_minimum_page_size(

# Check that margins don't affect page dimensions and equal defaults.
await assert_pdf_dimensions(value, {
"width": expected_width,
"height": expected_height,
"width": expected_width,
"height": expected_height,
})


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,16 @@ async def test_set_viewport_reset(bidi_session, new_tab):
assert await get_viewport_dimensions(bidi_session, new_tab) != test_viewport

await bidi_session.browsing_context.set_viewport(
context=new_tab["context"],
viewport=test_viewport)
context=new_tab["context"],
viewport=test_viewport
)

assert await get_viewport_dimensions(bidi_session, new_tab) == test_viewport

await bidi_session.browsing_context.set_viewport(
context=new_tab["context"],
viewport=None)
context=new_tab["context"],
viewport=None
)
assert await get_viewport_dimensions(bidi_session, new_tab) == original_viewport


Expand All @@ -64,8 +66,9 @@ async def test_set_viewport_affects_specific_context(bidi_session, top_context,
assert await get_viewport_dimensions(bidi_session, new_tab) != test_viewport

await bidi_session.browsing_context.set_viewport(
context=new_tab["context"],
viewport=test_viewport)
context=new_tab["context"],
viewport=test_viewport
)

assert await get_viewport_dimensions(bidi_session, new_tab) == test_viewport
assert await get_viewport_dimensions(bidi_session, top_context) == original_viewport
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ async def on_event(method, data):
# Open a prompt in the different context.
await bidi_session.browsing_context.navigate(
context=another_new_context["context"],
url=inline(f"<script>window.alert('second tab')</script>"),
url=inline("<script>window.alert('second tab')</script>"),
)

await wait_for_future_safe(on_prompt_opened)
Expand All @@ -208,7 +208,7 @@ async def on_event(method, data):
# Open a prompt in the subscribed context.
await bidi_session.browsing_context.navigate(
context=new_context["context"],
url=inline(f"<script>window.alert('first tab')</script>"),
url=inline("<script>window.alert('first tab')</script>"),
)

await wait_for_future_safe(on_prompt_opened)
Expand Down
Loading

0 comments on commit ddae255

Please sign in to comment.