tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

commit fa74376649f99202902e1bac72a7b7d5f53b8a58
parent 19d15373f88a3e4f28fae9d80baaa201e6e21534
Author: Thomas Wisniewski <twisniewski@mozilla.com>
Date:   Thu,  8 Jan 2026 22:02:21 +0000

Bug 2006477 - fix webcompat interventions automated tests; r=ksenia

Differential Revision: https://phabricator.services.mozilla.com/D278141

Diffstat:
Mtesting/webcompat/interventions/tests/test_1848713_cleanrider_com.py | 35+++++++++++++++++++++++++----------
Mtesting/webcompat/interventions/tests/test_1897941_biodiscover_com.py | 4++--
Mtesting/webcompat/interventions/tests/test_2003826_tjoy_jp.py | 12++++++++----
3 files changed, 35 insertions(+), 16 deletions(-)

diff --git a/testing/webcompat/interventions/tests/test_1848713_cleanrider_com.py b/testing/webcompat/interventions/tests/test_1848713_cleanrider_com.py @@ -9,9 +9,11 @@ PRICE_SECTION_CSS = "#block-prix" MIN_THUMB_CSS = "#block-prix .range-min-bullet" -async def can_interact_with_slider(client): +async def can_interact_with_slider(client, platform): await client.navigate(URL, wait="none") + client.hide_elements("#opd_bottomstickyad") + try: client.await_css(COOKIES_CSS, is_displayed=True, timeout=5).click() except NoSuchElementException: @@ -23,11 +25,16 @@ async def can_interact_with_slider(client): if not client.is_displayed(price): client.execute_script("arguments[0].remove()", price) - min_thumb = client.await_css(MIN_THUMB_CSS) - mobile_filter = client.find_css('[\\@click="openMobile = true"]') - if mobile_filter and client.is_displayed(mobile_filter): - client.scroll_into_view(mobile_filter) - mobile_filter.click() + min_thumb = client.await_css(MIN_THUMB_CSS, is_displayed=True) + if platform == "android": + for x in range(5): + client.await_css( + '[\\@click="openMobile = true"]', is_displayed=True + ).click() + await client.stall(0.5) + if client.await_css('[\\@click="openMobile = false"]', is_displayed=True): + break + # wait for the button to slide onscreen client.execute_async_script( """ @@ -42,6 +49,14 @@ async def can_interact_with_slider(client): min_thumb, ) + coords = client.get_element_screen_position(min_thumb) + coords = [coords[0] + 4, coords[1] + 4] + await client.apz_down(coords=coords) + for i in range(25): + await client.stall(0.01) + coords[0] += 5 + await client.apz_move(coords=coords) + # we can detect the broken case as the element will not receive mouse events. client.execute_script( """ @@ -68,11 +83,11 @@ async def can_interact_with_slider(client): @pytest.mark.asyncio @pytest.mark.with_interventions -async def test_enabled(client): - assert await can_interact_with_slider(client) +async def test_enabled(client, platform): + assert await can_interact_with_slider(client, platform) @pytest.mark.asyncio @pytest.mark.without_interventions -async def test_disabled(client): - assert not await can_interact_with_slider(client) +async def test_disabled(client, platform): + assert not await can_interact_with_slider(client, platform) diff --git a/testing/webcompat/interventions/tests/test_1897941_biodiscover_com.py b/testing/webcompat/interventions/tests/test_1897941_biodiscover_com.py @@ -10,7 +10,7 @@ MOBILE_CSS = ".title > .more" @pytest.mark.with_interventions async def test_enabled(client): await client.navigate(URL, wait="none") - assert client.await_css(MOBILE_CSS, is_displayed=True, timeout=30) + assert client.await_css(MOBILE_CSS, is_displayed=True, timeout=60) assert not client.find_css(DESKTOP_CSS, is_displayed=True) @@ -19,5 +19,5 @@ async def test_enabled(client): @pytest.mark.without_interventions async def test_disabled(client): await client.navigate(URL, wait="none") - assert client.await_css(DESKTOP_CSS, is_displayed=True, timeout=30) + assert client.await_css(DESKTOP_CSS, is_displayed=True, timeout=60) assert not client.find_css(MOBILE_CSS, is_displayed=True) diff --git a/testing/webcompat/interventions/tests/test_2003826_tjoy_jp.py b/testing/webcompat/interventions/tests/test_2003826_tjoy_jp.py @@ -5,8 +5,8 @@ import pytest URL = "https://tjoy.jp/shinjuku_wald9#schedule-content" DATES_CSS = ".calendar-item" -CARD_CSS = ".card-header" -RESERVE_CSS = ".schedule-box-body" +CARD_CSS = ".card-header.js-card-click" +RESERVE_CSS = ".schedule-box-body[onclick*=reservation]" ZOOM_WRAPPER_CSS = ".js-zoom-in" MAP_CSS = ".js-map" @@ -21,8 +21,12 @@ async def does_correct_zoom(client): # Note that today's movies can be already closed for sale. dates = client.await_css(DATES_CSS, all=True) dates[1].click() - tomorrows_movie_card = client.await_css(CARD_CSS, is_displayed=True) - tomorrows_movie_card.click() + tomorrows_movie_cards = client.await_css(CARD_CSS, is_displayed=True, all=True) + + # some movies don't always have any available seats, so open the first five. + for elem in tomorrows_movie_cards[:5]: + elem.click() + reserve = client.await_css(RESERVE_CSS, is_displayed=True) # The element is overlapped by another one, so we have to use javascript to click it. client.execute_script("arguments[0].click()", reserve)