commit f88f24a6dd881a28db114ec379b45f2b09fd47d1
parent 39d2d6915f3ac86de2b1d2729716bb5354fd92ff
Author: Thomas Wisniewski <twisniewski@mozilla.com>
Date: Thu, 16 Oct 2025 20:46:44 +0000
Bug 1994456 - add some webcompat interventions automated tests; r=ksenia
Differential Revision: https://phabricator.services.mozilla.com/D268947
Diffstat:
4 files changed, 83 insertions(+), 0 deletions(-)
diff --git a/testing/webcompat/client.py b/testing/webcompat/client.py
@@ -1531,6 +1531,38 @@ class Client:
pass
return self.execute_script("return window.fastclicked")
+ async def test_aceomni_pan_and_zoom_works(self, url):
+ await self.navigate(url, wait="none")
+ img = self.await_css("#imageZoom", is_displayed=True)
+ await self.stall(1)
+
+ def get_zoom_x():
+ return self.execute_script(
+ "return arguments[0].style.cssText.match(/--zoom-x:\\s?(\\d+(\\.\\d+)?)%/)?.[1]",
+ img,
+ )
+
+ if get_zoom_x() is not None:
+ return False
+
+ await self.stall(0.5)
+ coords = self.get_element_screen_position(img)
+ coords = [coords[0] + 50, coords[1] + 100]
+ await self.apz_move(coords=coords)
+ await self.stall(0.5)
+ old_x = float(get_zoom_x())
+
+ for i in range(20):
+ coords = [coords[0] + 10, coords[1]]
+ await self.apz_move(coords=coords)
+ await self.stall(0.01)
+ x = float(get_zoom_x())
+ if x < old_x:
+ return False
+ old_x = x
+
+ return True
+
def is_displayed(self, element):
if element is None:
return False
diff --git a/testing/webcompat/interventions/tests/test_1993452_www_lee_in.py b/testing/webcompat/interventions/tests/test_1993452_www_lee_in.py
@@ -0,0 +1,17 @@
+import pytest
+
+URL = "https://www.lee.in/men/tshirt/slim-black-8905409383803"
+
+
+@pytest.mark.skip_platforms("android")
+@pytest.mark.asyncio
+@pytest.mark.with_interventions
+async def test_enabled(client):
+ assert await client.test_aceomni_pan_and_zoom_works(URL)
+
+
+@pytest.mark.skip_platforms("android")
+@pytest.mark.asyncio
+@pytest.mark.without_interventions
+async def test_disabled(client):
+ assert not await client.test_aceomni_pan_and_zoom_works(URL)
diff --git a/testing/webcompat/interventions/tests/test_1993453_www_dockers_in.py b/testing/webcompat/interventions/tests/test_1993453_www_dockers_in.py
@@ -0,0 +1,17 @@
+import pytest
+
+URL = "https://www.dockers.in/men/shirt/relaxed-green-8905409633083"
+
+
+@pytest.mark.skip_platforms("android")
+@pytest.mark.asyncio
+@pytest.mark.with_interventions
+async def test_enabled(client):
+ assert await client.test_aceomni_pan_and_zoom_works(URL)
+
+
+@pytest.mark.skip_platforms("android")
+@pytest.mark.asyncio
+@pytest.mark.without_interventions
+async def test_disabled(client):
+ assert not await client.test_aceomni_pan_and_zoom_works(URL)
diff --git a/testing/webcompat/interventions/tests/test_1993454_www_wrangler_in.py b/testing/webcompat/interventions/tests/test_1993454_www_wrangler_in.py
@@ -0,0 +1,17 @@
+import pytest
+
+URL = "https://www.wrangler.in/women/shirts/-blue-8905409405437"
+
+
+@pytest.mark.skip_platforms("android")
+@pytest.mark.asyncio
+@pytest.mark.with_interventions
+async def test_enabled(client):
+ assert await client.test_aceomni_pan_and_zoom_works(URL)
+
+
+@pytest.mark.skip_platforms("android")
+@pytest.mark.asyncio
+@pytest.mark.without_interventions
+async def test_disabled(client):
+ assert not await client.test_aceomni_pan_and_zoom_works(URL)