Skip to content

Commit

Permalink
Merge pull request #4902 from KKoukiou/webui-test-next-dfs
Browse files Browse the repository at this point in the history
webui: tests: implement a 'reach' helper method
  • Loading branch information
KKoukiou authored Jul 11, 2023
2 parents a32277d + a8305aa commit e6332a9
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 25 deletions.
10 changes: 3 additions & 7 deletions ui/webui/test/check-basic
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,10 @@ class TestBasic(anacondalib.VirtInstallMachineCase):
)

i.check_prerelease_info()

current_page = i.get_current_page()
# Do not start the installation in non-destructive tests as this performs non revertible changes
while current_page is not i.steps.REVIEW:
# with the pages basically empty of common elements (as those are provided by the top-level installer widget)
# we at least iterate over them to check this works as expected
i.wait_current_page(current_page)
current_page = i.next()
# with the pages basically empty of common elements (as those are provided by the top-level installer widget)
# we at least iterate over them to check this works as expected
i.reach(i.steps.REVIEW)

# Ensure that the 'actual' UI process is running/
self.assertIn("/usr/libexec/webui-desktop", m.execute("ps aux"))
Expand Down
10 changes: 2 additions & 8 deletions ui/webui/test/check-review
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,10 @@ class TestReview(anacondalib.VirtInstallMachineCase):
r = Review(b)

i.open()
i.next()
i.next()
i.next()

# After clicking 'Next' on the storage step, partitioning is done, thus changing the available space on the disk
# Since this is a non-destructive test we need to make sure the we reset partitioning to how it was before the test started
self.addCleanup(s.dbus_reset_partitioning)
i.next()
i.reach(i.steps.REVIEW)

# check language is shown
r.check_language("English (United States)")
Expand Down Expand Up @@ -74,9 +70,7 @@ class TestReview(anacondalib.VirtInstallMachineCase):

i.open()

current_page = i.get_current_page()
while current_page is not i.steps.REVIEW:
current_page = i.next()
i.reach(i.steps.REVIEW)
i.begin_installation(should_fail=True, confirm_erase=False)

if __name__ == '__main__':
Expand Down
12 changes: 2 additions & 10 deletions ui/webui/test/check-storage
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,7 @@ class TestStorage(anacondalib.VirtInstallMachineCase):
i.open()
# Language selection

i.next()
# Storage Devices

i.next()
# Storage Configuration
i.reach(i.steps.STORAGE_CONFIGURATION)

# Check the default mode
s.check_partitioning_selected("erase-all")
Expand Down Expand Up @@ -184,11 +180,7 @@ class TestStorage(anacondalib.VirtInstallMachineCase):
i.open()
# Language selection

i.next()
# Storage Devices

i.next()
# Storage Configuration
i.reach(i.steps.STORAGE_CONFIGURATION)

# Check the default mode
s.check_partitioning_selected("erase-all")
Expand Down
14 changes: 14 additions & 0 deletions ui/webui/test/helpers/installer.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,20 @@ def begin_installation(self, should_fail=False, confirm_erase=True):
else:
self.wait_current_page(self.steps._steps_jump[current_page])

def reach(self, target_page):
path = []
page = target_page
current_page = self.get_current_page()

while current_page != page:
path.append(page)
prev = [k for k, v in self.steps._steps_jump.items() if page in v][0]
page = prev

while self.get_current_page() != target_page:
next_page = path.pop()
self.next(next_page=next_page)

@log_step()
def next(self, should_fail=False, subpage=False, next_page=""):
current_page = self.get_current_page()
Expand Down

0 comments on commit e6332a9

Please sign in to comment.