Skip to content

Commit

Permalink
test: Fix race in testCreateContainerInPodUser()
Browse files Browse the repository at this point in the history
That dialog switches between the "All" and "Local" filter of images.
The busybox image is shown in both views; however, it gets re-rendered
on switch, so clicking on it is a race condition -- without waiting the
click often goes to the *old* "All" result.

We can't directly wait on that transition. So switch to the "docker.io"
filter first, wait for the "No images found", and then switch to
"Local", so that our `wait_visible()` can take over.
  • Loading branch information
martinpitt committed Aug 21, 2024
1 parent 769bcb1 commit 44bb0d3
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions test/check-application
Original file line number Diff line number Diff line change
Expand Up @@ -2731,6 +2731,10 @@ class TestApplication(testlib.MachineCase):

b.set_input_text("#run-image-dialog-name", container_name)
b.set_input_text("#create-image-image-select-typeahead", IMG_BUSYBOX_LATEST)
# we want to switch to "Local", but to make waiting for IMG_BUSYBOX race-free, we first need to
# switch to another view
b.click('button.pf-v5-c-toggle-group__button:contains("docker.io")')
b.wait_in_text(".pf-v5-c-select__menu-list", "No images found")
b.click('button.pf-v5-c-toggle-group__button:contains("Local")')
b.click(f'button.pf-v5-c-select__menu-item:contains("{IMG_BUSYBOX_LATEST}")')
b.click('.pf-v5-c-modal-box__footer #create-image-create-run-btn')
Expand Down

0 comments on commit 44bb0d3

Please sign in to comment.