diff --git a/test/check-basic b/test/check-basic index 3b2f502116..fe6116be54 100755 --- a/test/check-basic +++ b/test/check-basic @@ -78,7 +78,8 @@ class TestBasic(anacondalib.VirtInstallMachineCase): ] for step in steps: - i.click_step_on_sidebar(step) + if step not in i.hidden_steps: + i.click_step_on_sidebar(step) i.reach(i.steps.REVIEW) @@ -88,16 +89,16 @@ class TestBasic(anacondalib.VirtInstallMachineCase): i = Installer(b, m) r = Review(b) - pretend_live_iso(self) + pretend_live_iso(self, i) - # For live media the first screen is the installation-method - i.open(step="installation-method") + i.open() + i.reach(i.steps.INSTALLATION_METHOD) # Back button should be disabled on the first screen b.wait_visible(f"#installation-back-btn:not([aria-disabled={True}]") # For live media in the review screen language details should still be displayed - i.reach(i.steps.REVIEW, hidden_steps=[i.steps.ACCOUNTS]) + i.reach(i.steps.REVIEW) r.check_language("English (United States)") def testAboutModal(self): @@ -205,7 +206,7 @@ class TestBasic(anacondalib.VirtInstallMachineCase): s.udevadm_settle() i.open() - i.next() + i.reach(i.steps.INSTALLATION_METHOD) # FIXME: Remove PF5 specific selector: https://github.com/patternfly/patternfly-react/issues/9512 b.wait_not_present("#critical-error-bz-report-modal.pf-v5-c-modal-box") diff --git a/test/check-storage b/test/check-storage index ee68a58ca5..d1f0463dd9 100755 --- a/test/check-storage +++ b/test/check-storage @@ -41,7 +41,7 @@ class TestStorage(anacondalib.VirtInstallMachineCase, StorageHelpers): s = Storage(b, self.machine) i.open() - i.next() + i.reach(i.steps.INSTALLATION_METHOD) # Check the auto-selected disk's details s.check_single_disk_destination("vda", "16.1 GB") @@ -86,10 +86,10 @@ class TestStorage(anacondalib.VirtInstallMachineCase, StorageHelpers): self.addCleanup(m.execute, "killall blivet-gui") - pretend_live_iso(self) + pretend_live_iso(self, i) - # For live media the first screen is the installation-method - i.open(step="installation-method") + i.open() + i.reach(i.steps.INSTALLATION_METHOD) disk="vda" @@ -221,7 +221,6 @@ class TestStorage(anacondalib.VirtInstallMachineCase, StorageHelpers): p = Password(b, s.encryption_id_prefix) i.open() - # Language selection i.reach(i.steps.INSTALLATION_METHOD) @@ -334,7 +333,7 @@ class TestStorageExtraDisks(anacondalib.VirtInstallMachineCase, StorageHelpers): dev = dev.split("/")[-1] i.open() - i.next() + i.reach(i.steps.INSTALLATION_METHOD) s.wait_no_disks_detected_not_present() @@ -384,7 +383,7 @@ class TestStorageMountPoints(anacondalib.VirtInstallMachineCase, StorageHelpers) s.udevadm_settle() i.open() - i.next() + i.reach(i.steps.INSTALLATION_METHOD) s.rescan_disks() s.select_mountpoint([(dev, True)]) @@ -470,7 +469,7 @@ class TestStorageMountPoints(anacondalib.VirtInstallMachineCase, StorageHelpers) s.udevadm_settle() i.open() - i.next() + i.reach(i.steps.INSTALLATION_METHOD) s.rescan_disks() s.select_mountpoint([(dev, True)]) @@ -510,7 +509,7 @@ class TestStorageMountPoints(anacondalib.VirtInstallMachineCase, StorageHelpers) # Select first only vdb disk and verify that the partitioning request is correct i.open() - i.next() + i.reach(i.steps.INSTALLATION_METHOD) s.rescan_disks() @@ -589,7 +588,7 @@ class TestStorageMountPoints(anacondalib.VirtInstallMachineCase, StorageHelpers) s.udevadm_settle() i.open() - i.next() + i.reach(i.steps.INSTALLATION_METHOD) s.rescan_disks() s.select_mountpoint([(dev1, True)]) @@ -654,7 +653,7 @@ class TestStorageMountPoints(anacondalib.VirtInstallMachineCase, StorageHelpers) s.udevadm_settle() i.open() - i.next() + i.reach(i.steps.INSTALLATION_METHOD) s.rescan_disks() # select only vda and check that we don't try to unlock the LUKS partition on vdb @@ -703,7 +702,7 @@ class TestStorageMountPoints(anacondalib.VirtInstallMachineCase, StorageHelpers) s.udevadm_settle() i.open() - i.next() + i.reach(i.steps.INSTALLATION_METHOD) s.rescan_disks() # select only vda and check that we don't try to unlock the LUKS partition on vdb @@ -759,7 +758,7 @@ class TestStorageMountPoints(anacondalib.VirtInstallMachineCase, StorageHelpers) s.udevadm_settle() i.open() - i.next() + i.reach(i.steps.INSTALLATION_METHOD) s.rescan_disks() s.select_mountpoint([(dev, True)]) @@ -887,7 +886,7 @@ class TestStorageMountPoints(anacondalib.VirtInstallMachineCase, StorageHelpers) s.udevadm_settle() i.open() - i.next() + i.reach(i.steps.INSTALLATION_METHOD) s.rescan_disks() s.wait_scenario_available("mount-point-mapping", False) @@ -919,7 +918,7 @@ class TestStorageMountPoints(anacondalib.VirtInstallMachineCase, StorageHelpers) s.udevadm_settle() i.open() - i.next() + i.reach(i.steps.INSTALLATION_METHOD) s.rescan_disks() s.select_mountpoint([(dev, True)]) @@ -991,7 +990,7 @@ class TestStorageMountPoints(anacondalib.VirtInstallMachineCase, StorageHelpers) s.udevadm_settle() i.open() - i.next() + i.reach(i.steps.INSTALLATION_METHOD) s.rescan_disks() s.select_mountpoint([(dev, True)]) @@ -1018,7 +1017,7 @@ class TestStorageMountPointsEFI(anacondalib.VirtInstallMachineCase): s.udevadm_settle() i.open() - i.next() + i.reach(i.steps.INSTALLATION_METHOD) s.rescan_disks() s.select_mountpoint([(dev, True)]) diff --git a/test/helpers/installer.py b/test/helpers/installer.py index 9d7924416c..ec41aef30d 100644 --- a/test/helpers/installer.py +++ b/test/helpers/installer.py @@ -48,10 +48,11 @@ class InstallerSteps(UserDict): _steps_callbacks[ACCOUNTS] = create_user class Installer(): - def __init__(self, browser, machine): + def __init__(self, browser, machine, hidden_steps=None): self.browser = browser self.machine = machine self.steps = InstallerSteps() + self.hidden_steps = hidden_steps or [] @log_step(snapshot_before=True) def begin_installation(self, should_fail=False, confirm_erase=True): @@ -69,8 +70,10 @@ def begin_installation(self, should_fail=False, confirm_erase=True): else: self.wait_current_page(self.steps._steps_jump[current_page][0]) - def reach(self, target_page, hidden_steps=None): - hidden_steps = hidden_steps or [] + def _previous_pages(self, page): + return [k for k, v in self.steps._steps_jump.items() if page in v] + + def reach(self, target_page): path = [] prev_pages = [target_page] current_page = self.get_current_page() @@ -78,11 +81,11 @@ def reach(self, target_page, hidden_steps=None): while current_page not in prev_pages: page = prev_pages[0] path.append(page) - prev_pages = [k for k, v in self.steps._steps_jump.items() if page in v] + prev_pages = self._previous_pages(page) while self.get_current_page() != target_page: next_page = path.pop() - if next_page not in hidden_steps: + if next_page not in self.hidden_steps: self.next(next_page=next_page) if next_page in self.steps._steps_callbacks: self.steps._steps_callbacks[next_page](self.browser, self.machine) @@ -93,6 +96,8 @@ def next(self, should_fail=False, next_page=""): # If not explicitly specified, get the first item for next page from the steps dict if not next_page: next_page = self.steps._steps_jump[current_page][0] + while next_page in self.hidden_steps: + next_page = self.steps._steps_jump[next_page][0] # Wait for a disk to be pre-selected before clicking 'Next'. # FIXME: Find a better way. @@ -124,12 +129,17 @@ def back(self, should_fail=False, previous_page=""): self.wait_current_page(current_page) else: if not previous_page: - previous_page = [k for k, v in self.steps._steps_jump.items() if current_page in v][0] + previous_page = self._previous_pages(current_page)[0] + while previous_page in self.hidden_steps: + previous_page = self._previous_pages(previous_page)[0] self.wait_current_page(previous_page) @log_step() - def open(self, step="installation-language"): + def open(self, step=None): + step = step or self.steps.WELCOME + while step in self.hidden_steps: + step = self.steps._steps_jump[step][0] self.browser.open(f"/cockpit/@localhost/anaconda-webui/index.html#/{step}") self.wait_current_page(step) # Ensure that the logo is visible before proceeding as pixel tests get racy otherwise diff --git a/test/helpers/utils.py b/test/helpers/utils.py index b62e85a200..2e6652d92d 100644 --- a/test/helpers/utils.py +++ b/test/helpers/utils.py @@ -26,7 +26,8 @@ def add_public_key(machine): machine.execute(f"chmod 700 {sysroot_ssh}") machine.write(authorized_keys, public_key, perm="0600") -def pretend_live_iso(test): +def pretend_live_iso(test, installer): + installer.hidden_steps.extend([installer.steps.ACCOUNTS, installer.steps.WELCOME]) test.restore_file('/run/anaconda/anaconda.conf') test.machine.execute("sed -i 's/type = BOOT_ISO/type = LIVE_OS/g' /run/anaconda/anaconda.conf")