global_selection.py 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. from .base import BasePage
  2. class GlobalSelectionPage(BasePage):
  3. def get_selected_project_slug(self):
  4. return self.browser.element('[data-test-id="global-header-project-selector"]').text
  5. def get_selected_environment(self):
  6. return self.browser.element('[data-test-id="global-header-environment-selector"]').text
  7. def get_selected_date(self):
  8. return self.browser.element('[data-test-id="global-header-timerange-selector"]').text
  9. def go_back_to_issues(self):
  10. self.browser.click('[data-test-id="back-to-issues"]')
  11. def open_project_selector(self):
  12. self.browser.click('[data-test-id="global-header-project-selector"]')
  13. def select_project_by_slug(self, slug):
  14. project_item_selector = f'//*[@data-test-id="badge-display-name" and text()="{slug}"]'
  15. self.open_project_selector()
  16. self.browser.wait_until(xpath=project_item_selector)
  17. self.browser.click(xpath=project_item_selector)
  18. def open_environment_selector(self):
  19. self.browser.click('[data-test-id="global-header-environment-selector"]')
  20. def select_environment(self, environment):
  21. environment_path = f'//*[text()="{environment}"]'
  22. self.open_project_selector()
  23. self.browser.wait_until(xpath=environment_path)
  24. self.browser.click(xpath=environment_path)
  25. def open_date_selector(self):
  26. self.browser.click('[data-test-id="global-header-timerange-selector"]')
  27. def select_date(self, date):
  28. date_path = f'//*[text()="{date}"]'
  29. self.open_date_selector()
  30. self.browser.wait_until(xpath=date_path)
  31. self.browser.click(xpath=date_path)