issue_list.py 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. from .base import BasePage
  2. from .global_selection import GlobalSelectionPage
  3. from .issue_details import IssueDetailsPage
  4. class IssueListPage(BasePage):
  5. def __init__(self, browser, client):
  6. super().__init__(browser)
  7. self.client = client
  8. self.global_selection = GlobalSelectionPage(browser)
  9. def visit_issue_list(self, org, query=""):
  10. self.browser.get(f"/organizations/{org}/issues/{query}")
  11. self.wait_until_loaded()
  12. def wait_for_stream(self):
  13. self.browser.wait_until('[data-test-id="event-issue-header"]', timeout=20)
  14. def select_issue(self, position):
  15. self.browser.click(f'[data-test-id="group"]:nth-child({position})')
  16. def navigate_to_issue(self, position):
  17. self.browser.click(f'[data-test-id="group"]:nth-child({position}) a')
  18. self.browser.wait_until(".group-detail")
  19. self.issue_details = IssueDetailsPage(self.browser, self.client)
  20. def resolve_issues(self):
  21. self.browser.click('[aria-label="Resolve"]')
  22. def wait_for_issue_removal(self):
  23. self.browser.click_when_visible('[data-test-id="toast-success"]')
  24. self.browser.wait_until_not('[data-test-id="toast-success"]')
  25. def wait_for_issue(self):
  26. self.browser.wait_until('[data-test-id="group"]')
  27. def find_resolved_issues(self):
  28. return self.browser.elements('[data-test-id="resolved-issue"]')
  29. def archive_issues(self):
  30. self.browser.click('[aria-label="Archive"]')
  31. def delete_issues(self):
  32. self.browser.click('[aria-label="More issue actions"]')
  33. self.browser.wait_until('[data-test-id="delete"]')
  34. self.browser.click('[data-test-id="delete"]')
  35. self.browser.click('[data-test-id="confirm-button"]')
  36. def merge_issues(self):
  37. # Merge button gets put into an overflow menu for small viewports
  38. if self.browser.element_exists('[aria-label="Merge Selected Issues"]'):
  39. self.browser.click('[aria-label="Merge Selected Issues"]')
  40. self.browser.click('[data-test-id="confirm-button"]')
  41. else:
  42. self.browser.click('[aria-label="More issue actions"]')
  43. self.browser.wait_until('[data-test-id="merge"]')
  44. self.browser.click('[data-test-id="merge"]')
  45. self.browser.click('[data-test-id="confirm-button"]')
  46. def mark_reviewed_issues(self):
  47. # Marked reviewed button gets put into an overflow menu for small viewports
  48. if self.browser.element_exists('[aria-label="Mark Reviewed"]'):
  49. self.browser.click('[aria-label="Mark Reviewed"]')
  50. else:
  51. self.browser.click('[aria-label="More issue actions"]')
  52. self.browser.wait_until('[data-test-id="mark-reviewed"]')
  53. self.browser.click('[data-test-id="mark-reviewed"]')