Skip to content

Commit

Permalink
test: Wait for image search to be over in CreateContainer tests
Browse files Browse the repository at this point in the history
The test was typing into the image name input and then immmediately
proceeded to select an image from the dropdown. The selected image
would already be in the dropdown from the start and thus it would be
selected without waiting for the search to reveal it.

The actual search would only start 300ms later and would at that point
reset the image selection. If the test wasn't already done with the
dialog at that point, the "Create button" would then be disabled.

Let's just wait for the searching to be done before continuing, by
observing the Alpine image disappear from the list.
  • Loading branch information
mvollmer committed Oct 18, 2024
1 parent 51690a7 commit 4e99a71
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions test/check-application
Original file line number Diff line number Diff line change
Expand Up @@ -2795,12 +2795,19 @@ class TestApplication(testlib.MachineCase):
self.assertIn(podname, b.text("#pf-modal-part-1"))

b.set_input_text("#run-image-dialog-name", container_name)
# Open image dropdown, it should list both Alpine and Busybox from the local repository
b.click("#create-image-image")
b.wait_visible(f'button.pf-v5-c-select__menu-item:contains("{IMG_ALPINE_LATEST}")')
b.wait_visible(f'button.pf-v5-c-select__menu-item:contains("{IMG_BUSYBOX_LATEST}")')
# Filter it down to just Busybox
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; different images have different registries, so don't assume their name, just
b.wait_visible(f'button.pf-v5-c-select__menu-item:contains("{IMG_BUSYBOX_LATEST}")')
b.wait_not_present(f'button.pf-v5-c-select__menu-item:contains("{IMG_ALPINE_LATEST}")')
# Switch to another view; different images have different registries, so don't assume their name, just
# that at least one more exists
b.click('.image-search-footer .pf-v5-c-toggle-group__item:nth-of-type(3) button')
b.wait_in_text(".pf-v5-c-select__menu-list", "No images found")
# Back to local and let's select Busybox and create the container
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 4e99a71

Please sign in to comment.