Skip to content

Commit

Permalink
test: Add hack to avoid losing focus on #containers-filter
Browse files Browse the repository at this point in the history
For some reason, .focus() sometimes does not take effect, and the
element immediately loses the focus again. This causes set_input_text()
to select the whole page text instead of the input element, and failing
to set the intended value.
  • Loading branch information
martinpitt committed Jul 14, 2023
1 parent eb85e50 commit e543081
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions test/check-application
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,12 @@ class TestApplication(testlib.MachineCase):
b.click(".pf-v5-c-modal-box button:contains('Force delete')")
self.waitPodRow("pod-1", False)

# HACK: there is some race here which steals the focus from the filter input and selects the page text instead
for _ in range(3):
b.focus('#containers-filter')
time.sleep(1)
if b.eval_js('document.activeElement == document.querySelector("#containers-filter")'):
break
b.set_input_text('#containers-filter', '')
self.machine.execute("podman pod create --infra=false --name pod-2")
self.waitPodContainer("pod-2", [])
Expand Down

0 comments on commit e543081

Please sign in to comment.