migrate US-012: test_library_landing.py (4 tests)

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 <noreply@anthropic.com>
This commit is contained in:
John Chilton
2026-02-12 14:55:55 -05:00
co-authored by Claude Opus 4.6
parent d705d47293
commit 7078cfbcc1
2 changed files with 7 additions and 11 deletions
+7 -6
View File
@@ -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:
@@ -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...