Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: verify autocomplete input value changed before uploading #21073

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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