Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix race condition in PF4 progressbar #1448

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion airgun/widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -2233,6 +2233,14 @@ def read(self):
class PF4ProgressBar(PF4Progress):
locator = './/div[contains(@class, "pf-c-wizard__main-body")]'

@property
def is_completed(self):
"""Boolean value whether progress bar is finished or not"""
try:
return self.current_progress == '100'
except NoSuchElementException:
return False

def wait_for_result(self, timeout=600, delay=1):
"""Waits for progress bar to finish. By default checks whether progress
bar is completed every second for 10 minutes.
Expand All @@ -2241,7 +2249,7 @@ def wait_for_result(self, timeout=600, delay=1):
"""
wait_for(lambda: self.is_displayed, timeout=30, delay=delay, logger=self.logger)
wait_for(
lambda: not self.is_displayed or self.current_progress == '100',
lambda: not self.is_displayed or self.is_completed,
timeout=timeout,
delay=delay,
logger=self.logger,
Expand Down