Skip to content

Commit 466dd66

Browse files
tests(playwright): bump from selenium to playwright
1 parent 4d535e7 commit 466dd66

File tree

2 files changed

+17
-17
lines changed

2 files changed

+17
-17
lines changed

tests/requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ pillow-avif-plugin
44
pixelmatch
55
pytest
66
pytest-asyncio
7+
pytest-playwright
78
pytest-xprocess
8-
seleniumbase
99
trame-server>=3
1010
trame-vuetify
1111
trame>=3.6

tests/test_rca_utils.py

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@
55
from pathlib import Path
66
from unittest.mock import MagicMock
77

8-
from selenium.webdriver import ActionChains
9-
from seleniumbase import SB
8+
from playwright.sync_api import expect
109

1110
import pytest
1211
from PIL import Image
@@ -184,24 +183,25 @@ async def test_groups_close_request_render_together(
184183

185184

186185
@pytest.mark.parametrize("server_path", ["examples/01_vtk/vtk_cone_simple.py"])
187-
def test_rca_view_is_interactive(server):
188-
with SB() as sb:
189-
assert server.port
186+
def test_rca_view_is_interactive(server, page):
187+
url = f"http://127.0.0.1:{server.port}/"
188+
page.goto(url)
190189

191-
url = f"http://127.0.0.1:{server.port}/"
192-
sb.open(url)
190+
element = page.locator("img")
191+
expect(element).to_be_visible()
192+
initial_img_url = element.get_attribute("src")
193193

194-
element = sb.find_element("img")
195-
initial_img_url = element.get_attribute("src")
194+
box = element.bounding_box()
195+
assert box is not None
196196

197-
ActionChains(sb.driver).move_to_element(element).perform()
198-
ActionChains(sb.driver).click_and_hold(element).move_by_offset(
199-
100, 0
200-
).release().perform()
197+
page.mouse.move(box["x"] + box["width"] / 2, box["y"] + box["height"] / 2)
198+
page.mouse.down()
199+
page.mouse.move(box["x"] + box["width"] / 2 + 100, box["y"] + box["height"] / 2)
200+
page.mouse.up()
201+
page.wait_for_timeout(100)
202+
new_img_url = element.get_attribute("src")
201203

202-
# Expect image to have been updated following user action
203-
new_img_url = element.get_attribute("src")
204-
assert initial_img_url != new_img_url
204+
assert initial_img_url != new_img_url
205205

206206

207207
@pytest.mark.parametrize("encoder", [e.value for e in RcaEncoder])

0 commit comments

Comments
 (0)