From 7078cfbcc13bbae7c53c1082251abf10f9092ca9 Mon Sep 17 00:00:00 2001 From: John Chilton Date: Thu, 12 Feb 2026 11:57:38 -0500 Subject: [PATCH] migrate US-012: test_library_landing.py (4 tests) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Remove @selenium_only from 4 library landing tests. Fix PlaywrightElement.send_keys to use focus()+setSelectionRange(end) instead of click()+type() — click() positions cursor at center of element, inserting text mid-content instead of appending. Co-Authored-By: Claude Opus 4.6 --- lib/galaxy/selenium/playwright_element.py | 13 +++++++------ lib/galaxy_test/selenium/test_library_landing.py | 5 ----- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/lib/galaxy/selenium/playwright_element.py b/lib/galaxy/selenium/playwright_element.py index 90958c78962..f825a29d178 100644 --- a/lib/galaxy/selenium/playwright_element.py +++ b/lib/galaxy/selenium/playwright_element.py @@ -69,14 +69,15 @@ class PlaywrightElement: """ Send keys to the element (type text). - Playwright requires elements to be focused before typing, so we click first. - - Args: - *value: Text strings to type (will be concatenated) + Uses focus() + cursor-to-end to match Selenium's send_keys behavior + of appending text. Playwright's click() positions cursor at click + point (center of element), which would insert text mid-content. """ text = "".join(str(v) for v in value) - # Playwright requires focus before typing - self._element.click() + self._element.focus() + self._element.evaluate( + "el => { if (el.setSelectionRange) el.setSelectionRange(el.value.length, el.value.length) }" + ) self._element.type(text) def clear(self) -> None: diff --git a/lib/galaxy_test/selenium/test_library_landing.py b/lib/galaxy_test/selenium/test_library_landing.py index 8161cedcc95..df9acaa4ddd 100644 --- a/lib/galaxy_test/selenium/test_library_landing.py +++ b/lib/galaxy_test/selenium/test_library_landing.py @@ -2,7 +2,6 @@ from selenium.webdriver.common.by import By from .framework import ( retry_assertion_during_transitions, - selenium_only, selenium_test, SeleniumTestCase, ) @@ -16,7 +15,6 @@ class TestLibraryLanding(SeleniumTestCase): self.admin_login() self.libraries_open() - @selenium_only("Not yet migrated to support Playwright backend") @selenium_test def test_create_new_close(self): num_displayed_libraries = self._num_displayed_libraries() @@ -27,7 +25,6 @@ class TestLibraryLanding(SeleniumTestCase): self.wait_for_overlays_cleared() assert self._num_displayed_libraries() == num_displayed_libraries - @selenium_only("Not yet migrated to support Playwright backend") @selenium_test def test_create_new(self): name = self._get_random_name(prefix="testcreatenew") @@ -38,7 +35,6 @@ class TestLibraryLanding(SeleniumTestCase): self._search_for_only_with_name(name) - @selenium_only("Not yet migrated to support Playwright backend") @selenium_test def test_rename(self): name = self._get_random_name(prefix="testprerename") @@ -58,7 +54,6 @@ class TestLibraryLanding(SeleniumTestCase): self._search_for_only_with_name(new_name) - @selenium_only("Not yet migrated to support Playwright backend") @selenium_test def test_sorting(self): # Throw in another library to ensure filtering is working...