diff --git a/ui/webui/src/components/AnacondaWizard.jsx b/ui/webui/src/components/AnacondaWizard.jsx index 746b4b21de6..70c5e21bbd4 100644 --- a/ui/webui/src/components/AnacondaWizard.jsx +++ b/ui/webui/src/components/AnacondaWizard.jsx @@ -206,11 +206,12 @@ export const AnacondaWizard = ({ dispatch, isBootIso, osRelease, storageData, lo }; const steps = createSteps(stepsOrder); - const goToStep = (newStep) => { - // first reset validation state to default - setIsFormValid(false); - - cockpit.location.go([newStep.id]); + const goToStep = (newStep, prevStep) => { + if (prevStep.prevId !== newStep.id) { + // first reset validation state to default + setIsFormValid(false); + cockpit.location.go([newStep.id]); + } }; return ( diff --git a/ui/webui/test/check-basic b/ui/webui/test/check-basic index c656d81fb1b..3b0624017ab 100755 --- a/ui/webui/test/check-basic +++ b/ui/webui/test/check-basic @@ -48,6 +48,35 @@ class TestBasic(anacondalib.VirtInstallMachineCase): # Ensure that the 'actual' UI process is running/ self.assertIn("/usr/libexec/webui-desktop", m.execute("ps aux")) + def testSidebarNavigation(self): + b = self.browser + m = self.machine + i = Installer(b, m) + + i.open() + + i.check_prerelease_info() + + # Test that clicking on current step does not break navigation + i.click_step_on_sidebar() + + i.reach(i.steps.REVIEW) + + # Test going back + steps = [ + i.steps.DISK_CONFIGURATION, + i.steps.DISK_ENCRYPTION, + i.steps.DISK_CONFIGURATION, + i.steps.INSTALLATION_METHOD, + i.steps.WELCOME, + i.steps.WELCOME, + ] + + for step in steps: + i.click_step_on_sidebar(step) + + i.reach(i.steps.REVIEW) + def testLanguageScreenHiddenLive(self): b = self.browser m = self.machine diff --git a/ui/webui/test/helpers/installer.py b/ui/webui/test/helpers/installer.py index ec42c47f856..19784456e02 100644 --- a/ui/webui/test/helpers/installer.py +++ b/ui/webui/test/helpers/installer.py @@ -23,6 +23,7 @@ class InstallerSteps(UserDict): WELCOME = "installation-language" INSTALLATION_METHOD = "installation-method" CUSTOM_MOUNT_POINT = "mount-point-mapping" + DISK_CONFIGURATION = "disk-configuration" DISK_ENCRYPTION = "disk-encryption" REVIEW = "installation-review" PROGRESS = "installation-progress" @@ -120,6 +121,10 @@ def open(self, step="installation-language"): self.browser.open(f"/cockpit/@localhost/anaconda-webui/index.html#/{step}") self.wait_current_page(step) + def click_step_on_sidebar(self, step=None): + step = step or self.get_current_page() + self.browser.click(f"#{step}") + def get_current_page(self): return self.browser.eval_js('window.location.hash;').replace('#/', '') or self.steps[0]