global_selection.py 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. from .base import BasePage
  2. class GlobalSelectionPage(BasePage):
  3. def get_selected_project_slug(self):
  4. return self.browser.element('[data-test-id="page-filter-project-selector"]').text
  5. def get_selected_environment(self):
  6. return self.browser.element('[data-test-id="page-filter-environment-selector"]').text
  7. def get_selected_date(self):
  8. return self.browser.element('[data-test-id="page-filter-timerange-selector"]').text
  9. def go_back_to_issues(self):
  10. self.browser.click('[data-test-id="breadcrumb-link"]')
  11. def open_project_selector(self):
  12. self.browser.click('[data-test-id="page-filter-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 lock_project_filter(self):
  19. self.open_project_selector()
  20. self.browser.wait_until('[aria-label="Lock filter"]')
  21. self.browser.click('[aria-label="Lock filter"]')
  22. def open_environment_selector(self):
  23. self.browser.click('[data-test-id="page-filter-environment-selector"]')
  24. def select_environment(self, environment):
  25. environment_path = f'//*[text()="{environment}"]'
  26. self.open_project_selector()
  27. self.browser.wait_until(xpath=environment_path)
  28. self.browser.click(xpath=environment_path)
  29. def open_date_selector(self):
  30. self.browser.click('[data-test-id="page-filter-timerange-selector"]')
  31. def select_date(self, date):
  32. date_path = f'//*[text()="{date}"]'
  33. self.open_date_selector()
  34. self.browser.wait_until(xpath=date_path)
  35. self.browser.click(xpath=date_path)