From 91cbc7ad1c50837ccae7eaaf6cff49b037d33b52 Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Fri, 14 Jul 2023 17:15:19 +0200 Subject: [PATCH] test: Add hack to avoid losing focus on #containers-filter 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. --- test/check-application | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/test/check-application b/test/check-application index af30c4d0b..537153b2d 100755 --- a/test/check-application +++ b/test/check-application @@ -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", [])