Skip to content

Commit

Permalink
test: verify autocomplete input value changed before uploading
Browse files Browse the repository at this point in the history
This does not seem to fix our top flake but it is likely what we want to
do verify that the input actually got updated with the expected value
before uploading.
  • Loading branch information
jelly committed Oct 3, 2024
1 parent 7957a12 commit 2870b8f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
4 changes: 3 additions & 1 deletion test/common/testlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -736,11 +736,13 @@ def set_input_text(
if value_check:
self.wait_val(selector, val)

def set_file_autocomplete_val(self, group_identifier: str, location: str) -> None:
def set_file_autocomplete_val(self, group_identifier: str, location: str, verify: bool = False) -> None:
self.set_input_text(f"{group_identifier} .pf-v5-c-select__toggle-typeahead input", location)
# click away the selection list, to force a state update
self.click(f"{group_identifier} .pf-v5-c-select__toggle-typeahead")
self.wait_not_present(f"{group_identifier} .pf-v5-c-select__menu")
if verify:
self.wait_val(f"{group_identifier} .pf-v5-c-select__toggle-typeahead input", location)

@contextlib.contextmanager
def wait_timeout(self, timeout: int) -> Iterator[None]:
Expand Down
8 changes: 4 additions & 4 deletions test/verify/check-pages
Original file line number Diff line number Diff line change
Expand Up @@ -929,23 +929,23 @@ OnCalendar=daily
# Early ENOSPC error (before we would block on 'ack')
m.execute("mkdir -p /mnt/upload; mount -t tmpfs -o size=1M none /mnt/upload;")
self.addCleanup(m.execute, "umount /mnt/upload; rmdir /mnt/upload;")
b.set_file_autocomplete_val("#demo-upload", "/mnt/upload/")
b.set_file_autocomplete_val("#demo-upload", "/mnt/upload/", verify=True)
b.upload_files("#demo-upload input[type='file']", [big_file])
b.wait_visible("#upload-file-btn:not(:disabled)")
b.wait_in_text(".pf-v5-c-alert", "No space left on device")
self.assertEqual(m.execute('ls -A /mnt/upload'), '') # nothing left behind

# Later ENOSPC error (after we've blocked)
m.execute("umount /mnt/upload; mount -t tmpfs -o size=10M none /mnt/upload;")
b.set_file_autocomplete_val("#demo-upload", "/mnt/upload/")
b.set_file_autocomplete_val("#demo-upload", "/mnt/upload/", verify=True)
b.upload_files("#demo-upload input[type='file']", [big_file])
b.wait_visible("#upload-file-btn:not(:disabled)")
b.wait_in_text(".pf-v5-c-alert", "No space left on device")
self.assertEqual(m.execute('ls -A /mnt/upload'), '')

# Upload permission error
b.drop_superuser()
b.set_file_autocomplete_val("#demo-upload", "/root/")
b.set_file_autocomplete_val("#demo-upload", "/root/", verify=True)
b.upload_files("#demo-upload input[type='file']", [test_upload_file])
b.wait_in_text(".pf-v5-c-alert", "Not permitted to perform this action")

Expand All @@ -962,7 +962,7 @@ OnCalendar=daily

self.login_and_go("/playground/react-patterns") # , debugging="upload")
b.wait_visible("#demo-upload")
b.set_file_autocomplete_val("#demo-upload", dest_dir)
b.set_file_autocomplete_val("#demo-upload", dest_dir, verify=True)
b.upload_files("#demo-upload input[type='file']", files)

with b.wait_timeout(30):
Expand Down

0 comments on commit 2870b8f

Please sign in to comment.