issue_details.py 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. from .base import BasePage
  2. from .global_selection import GlobalSelectionPage
  3. class IssueDetailsPage(BasePage):
  4. def __init__(self, browser, client):
  5. super().__init__(browser)
  6. self.client = client
  7. self.global_selection = GlobalSelectionPage(browser)
  8. def visit_issue(self, org, groupid):
  9. self.browser.get(f"/organizations/{org}/issues/{groupid}/")
  10. self.wait_until_loaded()
  11. def visit_issue_in_environment(self, org, groupid, environment):
  12. self.browser.get(f"/organizations/{org}/issues/{groupid}/?environment={environment}")
  13. self.browser.wait_until(".group-detail")
  14. def visit_tag_values(self, org, groupid, tag):
  15. self.browser.get(f"/organizations/{org}/issues/{groupid}/tags/{tag}/")
  16. self.browser.wait_until('[data-test-id="group-tag-value"]')
  17. def get_environment(self):
  18. return self.browser.find_element_by_css_selector('[data-test-id="env-label"').text.lower()
  19. def go_back_to_issues(self):
  20. self.global_selection.go_back_to_issues()
  21. def api_issue_get(self, groupid):
  22. return self.client.get(f"/api/0/issues/{groupid}/")
  23. def go_to_subtab(self, name):
  24. tabs = self.browser.find_element_by_css_selector(".group-detail .nav-tabs")
  25. tabs.find_element_by_partial_link_text(name).click()
  26. self.browser.wait_until_not('[data-test-id="loading-indicator"]')
  27. def open_issue_errors(self):
  28. self.browser.click(".errors-toggle")
  29. self.browser.wait_until(".entries > .errors ul")
  30. def open_curl(self):
  31. self.browser.find_element_by_xpath("//a//code[contains(text(), 'curl')]").click()
  32. def resolve_issue(self):
  33. self.browser.click('[aria-label="Resolve"]')
  34. # Resolve should become unresolve
  35. self.browser.wait_until('[aria-label="Unresolve"]')
  36. def ignore_issue(self):
  37. self.browser.click('[aria-label="Ignore"]')
  38. # Ignore should become unresolve
  39. self.browser.wait_until('[aria-label="Unignore"]')
  40. def bookmark_issue(self):
  41. self.browser.click('[aria-label="Bookmark"]')
  42. self.browser.wait_until('[aria-label="Remove bookmark"]')
  43. def assign_to(self, user):
  44. assignee = self.browser.find_element_by_css_selector(".assigned-to")
  45. # Open the assignee picker
  46. assignee.find_element_by_css_selector('[role="button"]').click()
  47. assignee.find_element_by_tag_name("input").send_keys(user)
  48. # Click the member/team
  49. options = assignee.find_elements_by_css_selector('[data-test-id="assignee-option"]')
  50. assert len(options) > 0, "No assignees could be found."
  51. options[0].click()
  52. self.browser.wait_until_not('[data-test-id="loading-indicator"]')
  53. def find_comment_form(self):
  54. return self.browser.find_element_by_css_selector('[data-test-id="note-input-form"]')
  55. def has_comment(self, text):
  56. element = self.browser.element('[data-test-id="activity-note-body"]')
  57. return text in element.text
  58. def wait_until_loaded(self):
  59. self.browser.wait_until_not('[data-test-id="loading-indicator"]')
  60. self.browser.wait_until_test_id("event-entries-loading-false")
  61. self.browser.wait_until_test_id("linked-issues")
  62. self.browser.wait_until_test_id("loaded-device-name")
  63. if self.browser.element_exists("#grouping-info"):
  64. self.browser.wait_until_test_id("loaded-grouping-info")
  65. self.browser.wait_until_not('[data-test-id="loading-placeholder"]')
  66. def mark_reviewed(self):
  67. self.browser.click('[aria-label="Mark Reviewed"]')
  68. self.browser.wait_until('.disabled[aria-label="Mark Reviewed"]')