Skip to content

Commit

Permalink
Add wait_for statements in various places to increase consistency
Browse files Browse the repository at this point in the history
  • Loading branch information
sambible committed Oct 17, 2024
1 parent 7917b42 commit 2fedb62
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
9 changes: 8 additions & 1 deletion airgun/entities/contentview_new.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from asyncio import wait_for
import time

from navmazing import NavigateToSibling
Expand Down Expand Up @@ -52,6 +53,8 @@ def publish(self, entity_name, values=None, promote=False, lce=None):
view.lce_selector.fill({lce: True})
view.next_button.click()
view.finish_button.click()
wait_for(lambda: view.progressbar.is_displayed, timeout=10)
view.progressbar.wait_for_result()
view = self.navigate_to(self, 'Edit', entity_name=entity_name)
self.browser.plugin.ensure_page_safe(timeout='5s')
view.wait_displayed()
Expand All @@ -62,6 +65,7 @@ def add_content(self, entity_name, content_name):
view = self.navigate_to(self, 'Edit', entity_name=entity_name)
self.browser.plugin.ensure_page_safe(timeout='5s')
view.wait_displayed()
wait_for(lambda: view.repositories.resources.is_displayed, timeout=10)
view.repositories.resources.add(content_name)
return view.repositories.resources.read()

Expand All @@ -78,6 +82,9 @@ def add_cv(self, ccv_name, cv_name, always_update=False, version=None):
view.version_select.item_select(version)
view.submit_button.click()
view = self.navigate_to(self, 'Edit', entity_name=ccv_name)
self.browser.plugin.ensure_page_safe(timeout='5s')
view.wait_displayed()
wait_for(lambda: view.content_views.resources.is_displayed, timeout=10)
return view.content_views.resources.read()

def read_cv(self, entity_name, version_name):
Expand All @@ -99,7 +106,7 @@ def read_version_table(self, entity_name, version, tab_name, search_param=None):
self.browser.plugin.ensure_page_safe(timeout='5s')
view.wait_displayed()
# This allows dynamic access to the proper table
getattr(view, tab_name).table.wait_displayed()
wait_for(lambda: getattr(view, tab_name).table.wait_displayed(), timeout=10)
if search_param:
getattr(view, tab_name).searchbox.search(search_param)
return getattr(view, tab_name).table.read()
Expand Down
4 changes: 4 additions & 0 deletions airgun/views/contentview_new.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ class ContentViewAddResourcesView(NewAddRemoveResourcesView):
},
)

@property
def is_displayed(self):
return self.table.is_displayed


class AddContentViewModal(BaseLoggedInView):
title = Text('.//div[@data-ouia-component-id="add-content-views"]')
Expand Down

0 comments on commit 2fedb62

Please sign in to comment.