Skip to content

Commit

Permalink
Merge pull request #5084 from rvykydal/webui-fix-clicking-on-current-…
Browse files Browse the repository at this point in the history
…step

Webui fix clicking on current step
  • Loading branch information
rvykydal authored Aug 29, 2023
2 parents 76022cf + bcd5b57 commit 0ef81cf
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 5 deletions.
11 changes: 6 additions & 5 deletions ui/webui/src/components/AnacondaWizard.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down
29 changes: 29 additions & 0 deletions ui/webui/test/check-basic
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 5 additions & 0 deletions ui/webui/test/helpers/installer.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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]

Expand Down

0 comments on commit 0ef81cf

Please sign in to comment.