From 1d60ad30a0b0c929a4404f6aa083fe2338d35311 Mon Sep 17 00:00:00 2001 From: Cockpit Project Date: Mon, 4 Nov 2024 18:35:46 +0000 Subject: [PATCH 1/5] Makefile: Update Cockpit lib to 3b1a41701581de0ed6826191b6d72e83 Closes #1894 --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index f29ced38c..5f855577e 100644 --- a/Makefile +++ b/Makefile @@ -41,7 +41,7 @@ COCKPIT_REPO_FILES = \ $(NULL) COCKPIT_REPO_URL = https://github.com/cockpit-project/cockpit.git -COCKPIT_REPO_COMMIT = 6d478ad51585d9d7f8c4567c155bd641635f284f # 327 + 33 commits +COCKPIT_REPO_COMMIT = 3b1a41701581de0ed6826191b6d72e835a7f5706 # 327 + 64 commits $(COCKPIT_REPO_FILES): $(COCKPIT_REPO_STAMP) COCKPIT_REPO_TREE = '$(strip $(COCKPIT_REPO_COMMIT))^{tree}' From 9d32ec41b60d7a5246645d0f106a13ce4912828e Mon Sep 17 00:00:00 2001 From: Jelle van der Waa Date: Wed, 6 Nov 2024 17:40:32 +0100 Subject: [PATCH 2/5] test: don't set the file input component to " " This does not make a lot of sense as it will show no such file or directory. Only set it when we have a valid location to set. --- test/check-machines-create | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test/check-machines-create b/test/check-machines-create index cea67ce90..ce76040fb 100755 --- a/test/check-machines-create +++ b/test/check-machines-create @@ -1377,10 +1377,10 @@ vnc_password= "{vnc_passwd}" else: b.wait_not_present("#source-type") - if self.sourceType == 'file' or self.sourceType == 'cloud': - b.set_file_autocomplete_val("#source-file-group", self.location or " ") - elif self.sourceType == 'disk_image': - b.set_file_autocomplete_val("#source-disk-group", self.location or " ") + if (self.sourceType == 'file' or self.sourceType == 'cloud') and self.location: + b.set_file_autocomplete_val("#source-file-group", self.location) + elif self.sourceType == 'disk_image' and self.location: + b.set_file_autocomplete_val("#source-disk-group", self.location) elif self.sourceType == 'pxe': if self.location: b.select_from_dropdown("#network-select", self.location) From 4460b59d2cef8b0656da778f70f765e588d7cd65 Mon Sep 17 00:00:00 2001 From: Jelle van der Waa Date: Wed, 6 Nov 2024 18:15:53 +0100 Subject: [PATCH 3/5] test: adjust tests for new FileAutoComplete The FileAutoComplete component now uses a non-deprecated Select which has a different internal DOM state. The create text was also adjusted to no longer quote the path. --- test/check-machines-disks | 6 +++--- test/check-machines-filesystems | 18 +++++++----------- test/check-machines-snapshots | 6 ++++-- 3 files changed, 14 insertions(+), 16 deletions(-) diff --git a/test/check-machines-disks b/test/check-machines-disks index 3e0fb5e9a..1ed5286f9 100755 --- a/test/check-machines-disks +++ b/test/check-machines-disks @@ -1260,10 +1260,10 @@ class TestMachinesDisks(machineslib.VirtualMachinesCase): self, mode='custom-path' ).openDialog() - b.click(f"{prefix}-file .pf-v5-c-select__toggle-button") - b.wait_visible(f"{prefix}-file-autocomplete") + b.click(f"{prefix}-file-autocomplete .pf-v5-c-menu-toggle__button") + b.wait_visible(".pf-v5-c-menu__content") b.key("ArrowDown") - b.focus(f"{prefix}-file-autocomplete li:first-child") + b.focus(".pf-v5-c-menu__content li:first-child") for _retry in range(0, 10): b.key("ArrowDown") time.sleep(0.5) diff --git a/test/check-machines-filesystems b/test/check-machines-filesystems index d644da5b5..996fd2b09 100755 --- a/test/check-machines-filesystems +++ b/test/check-machines-filesystems @@ -59,16 +59,7 @@ class TestMachinesFilesystems(machineslib.VirtualMachinesCase): b.wait_not_present("#vm-subVmTest1-filesystems-modal-mountTag-helper") b.set_input_text("#vm-subVmTest1-filesystems-modal-mountTag", "") - b.set_input_text("#vm-subVmTest1-filesystems-modal-source-group input", "/tmp") - # In some hosts with the high latency, the path of the expand list needs some time to load, - # the check will fail if it is too quick. - # Thus, add a check that the folder input appears in the expand list(#vm-{name}-filesystems-modal-source) - # to ensure that the loading is finished #vm-{name}-filesystems-modal-source only contains the expand list, - # without the input line. - b.wait_in_text("#vm-subVmTest1-filesystems-modal-source", "/tmp") - b.click("#vm-subVmTest1-filesystems-modal-source button:nth-child(1)") - # Check the expand list disappears - b.wait_not_present("#vm-subVmTest1-filesystems-modal-source") + b.set_file_autocomplete_val("#vm-subVmTest1-filesystems-modal-source-group", "/tmp/") b.click("#vm-subVmTest1-filesystems-modal-add") b.wait_not_present("#vm-subVmTest1-filesystems-modal-source-helper") b.wait_visible("#vm-subVmTest1-filesystems-modal-mountTag-helper") @@ -128,8 +119,13 @@ class TestMachinesFilesystems(machineslib.VirtualMachinesCase): # Try to add a new shared filesystem with non existing source directory b.click("#vm-subVmTest1-filesystems-add") b.set_input_text("#vm-subVmTest1-filesystems-modal-source-group input", "dir3") - b.wait_in_text("#vm-subVmTest1-filesystems-modal-source", "No such file or directory") + b.wait_in_text("#vm-subVmTest1-filesystems-modal-source-group ul", "No such file or directory") + b.click("#vm-subVmTest1-filesystems-modal-source button[aria-label='Clear input value']") + b.click("#vm-subVmTest1-filesystems-modal-source button[aria-label='Typeahead menu toggle']") + b.blur("#vm-subVmTest1-filesystems-modal-source-group input") + b.wait_not_present("#vm-subVmTest1-filesystems-modal-source .pf-v5-c-menu") b.click("#vm-subVmTest1-filesystems-modal-cancel") + b.wait_not_present(".pf-v5-c-modal-box__body ") # Start VM and ensure that adding filesystem is disabled b.click("#vm-subVmTest1-system-run") diff --git a/test/check-machines-snapshots b/test/check-machines-snapshots index c04d5125e..10c3f3ac9 100755 --- a/test/check-machines-snapshots +++ b/test/check-machines-snapshots @@ -158,6 +158,8 @@ class TestMachinesSnapshots(machineslib.VirtualMachinesCase): b.set_input_text("#snapshot-create-dialog-description", self.description) if self.memory_path is not None: b.set_input_text("#snapshot-create-dialog-memory-location input", self.memory_path) + # Setting the input pops up the dropdown, clicking it away should show an validation error + b.click("#snapshot-create-dialog-memory-location button[aria-label='Typeahead menu toggle']") def assert_pixels(self): if self.name == 'test_snap_1': @@ -526,7 +528,7 @@ virsh snapshot-create-as --domain subVmTest1 --name snapshotA --description 'Des # Check creation of new directories b.set_input_text("#snapshot-create-dialog-memory-location input", snapshot_dir + "/new") - b.wait_text("#snapshot-create-dialog-memory-location li button", f'Create "{snapshot_dir}/new"') + b.wait_text("#snapshot-create-dialog-memory-location li button", f"Create {snapshot_dir}/new") b.click("#snapshot-create-dialog-memory-location li button") # Check available space detection @@ -560,7 +562,7 @@ virsh snapshot-create-as --domain subVmTest1 --name snapshotA --description 'Des snapshot_dir2 = "/var/lib/libvirt2" if connection == "system" else "/home/admin/.local/share/libvirt/2" b.set_input_text("#snapshot-create-dialog-memory-location input", snapshot_dir2) - b.wait_text("#snapshot-create-dialog-memory-location li button", f'Create "{snapshot_dir2}"') + b.wait_text("#snapshot-create-dialog-memory-location li button", f"Create {snapshot_dir2}") b.click("#snapshot-create-dialog-memory-location li:first-child button") # Wait a couple of seconds to guarantee a different From c3bf2d7a5fb4af303a0913fc6ccb23348c13aa96 Mon Sep 17 00:00:00 2001 From: Jelle van der Waa Date: Wed, 6 Nov 2024 18:48:22 +0100 Subject: [PATCH 4/5] test: update pixel tests for new FileAutoComplete component --- test/reference | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/reference b/test/reference index d610bd77d..b4aec73f6 160000 --- a/test/reference +++ b/test/reference @@ -1 +1 @@ -Subproject commit d610bd77d2a9b589812e924494df7b6d0f7dcf9d +Subproject commit b4aec73f6b1df6f9f7449f6308be53c4aff21ac4 From 98e64711b97cdd6ac6ccd1a64157c3b896247cc4 Mon Sep 17 00:00:00 2001 From: Jelle van der Waa Date: Thu, 7 Nov 2024 19:15:55 +0100 Subject: [PATCH 5/5] test: validate the actual helpertext text Instead of asserting it exists, validate that the correct text is shown. --- test/check-machines-filesystems | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/check-machines-filesystems b/test/check-machines-filesystems index 996fd2b09..44e75e6f6 100755 --- a/test/check-machines-filesystems +++ b/test/check-machines-filesystems @@ -55,14 +55,14 @@ class TestMachinesFilesystems(machineslib.VirtualMachinesCase): b.set_input_text("#vm-subVmTest1-filesystems-modal-mountTag", "test") b.click("#vm-subVmTest1-filesystems-modal-add") - b.wait_visible("#vm-subVmTest1-filesystems-modal-source-helper") + b.wait_text("#vm-subVmTest1-filesystems-modal-source-helper", "Source must not be empty") b.wait_not_present("#vm-subVmTest1-filesystems-modal-mountTag-helper") b.set_input_text("#vm-subVmTest1-filesystems-modal-mountTag", "") b.set_file_autocomplete_val("#vm-subVmTest1-filesystems-modal-source-group", "/tmp/") b.click("#vm-subVmTest1-filesystems-modal-add") b.wait_not_present("#vm-subVmTest1-filesystems-modal-source-helper") - b.wait_visible("#vm-subVmTest1-filesystems-modal-mountTag-helper") + b.wait_text("#vm-subVmTest1-filesystems-modal-mountTag-helper", "Mount tag must not be empty") b.click("#vm-subVmTest1-filesystems-modal-cancel")