|
5 | 5 | from pathlib import Path |
6 | 6 | from unittest.mock import MagicMock |
7 | 7 |
|
8 | | -from selenium.webdriver import ActionChains |
9 | | -from seleniumbase import SB |
| 8 | +from playwright.sync_api import expect |
10 | 9 |
|
11 | 10 | import pytest |
12 | 11 | from PIL import Image |
@@ -184,24 +183,25 @@ async def test_groups_close_request_render_together( |
184 | 183 |
|
185 | 184 |
|
186 | 185 | @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) |
190 | 189 |
|
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") |
193 | 193 |
|
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 |
196 | 196 |
|
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") |
201 | 203 |
|
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 |
205 | 205 |
|
206 | 206 |
|
207 | 207 | @pytest.mark.parametrize("encoder", [e.value for e in RcaEncoder]) |
|
0 commit comments