test_issue_details_workflow.py 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. from datetime import datetime
  2. from django.utils import timezone
  3. from selenium.webdriver.common.by import By
  4. from fixtures.page_objects.issue_details import IssueDetailsPage
  5. from sentry.models.groupinbox import GroupInboxReason, add_group_to_inbox
  6. from sentry.testutils import AcceptanceTestCase, SnubaTestCase
  7. from sentry.testutils.silo import region_silo_test
  8. from sentry.utils.samples import load_data
  9. @region_silo_test
  10. class IssueDetailsWorkflowTest(AcceptanceTestCase, SnubaTestCase):
  11. def setUp(self):
  12. super().setUp()
  13. self.user = self.create_user("foo@example.com")
  14. self.org = self.create_organization(owner=self.user, name="Rowdy Tiger")
  15. self.team = self.create_team(
  16. organization=self.org, name="Mariachi Band", members=[self.user]
  17. )
  18. self.project = self.create_project(organization=self.org, teams=[self.team], name="Bengal")
  19. self.login_as(self.user)
  20. self.page = IssueDetailsPage(self.browser, self.client)
  21. self.dismiss_assistant()
  22. def create_sample_event(self, platform, default=None, sample_name=None):
  23. event_data = load_data(platform, default=default, sample_name=sample_name)
  24. event_data["event_id"] = "d964fdbd649a4cf8bfc35d18082b6b0e"
  25. event = self.store_event(
  26. data=event_data, project_id=self.project.id, assert_no_errors=False
  27. )
  28. event.group.update(
  29. first_seen=datetime(2015, 8, 13, 3, 8, 25, tzinfo=timezone.utc),
  30. last_seen=datetime(2016, 1, 13, 3, 8, 25, tzinfo=timezone.utc),
  31. )
  32. return event
  33. def test_resolve_basic(self):
  34. event = self.create_sample_event(platform="python")
  35. self.page.visit_issue(self.org.slug, event.group.id)
  36. self.page.resolve_issue()
  37. self.wait_for_loading()
  38. res = self.page.api_issue_get(event.group.id)
  39. assert res.status_code == 200, res
  40. assert res.data["status"] == "resolved"
  41. def test_ignore_basic(self):
  42. event = self.create_sample_event(platform="python")
  43. self.page.visit_issue(self.org.slug, event.group.id)
  44. self.page.ignore_issue()
  45. self.wait_for_loading()
  46. res = self.page.api_issue_get(event.group.id)
  47. assert res.status_code == 200, res
  48. assert res.data["status"] == "ignored"
  49. def test_bookmark(self):
  50. event = self.create_sample_event(platform="python")
  51. self.page.visit_issue(self.org.slug, event.group.id)
  52. self.page.bookmark_issue()
  53. self.wait_for_loading()
  54. res = self.page.api_issue_get(event.group.id)
  55. assert res.status_code == 200, res
  56. assert res.data["isBookmarked"]
  57. def test_assign_issue(self):
  58. event = self.create_sample_event(platform="python")
  59. self.page.visit_issue(self.org.slug, event.group.id)
  60. self.page.assign_to(self.user.email)
  61. res = self.page.api_issue_get(event.group.id)
  62. assert res.status_code == 200, res
  63. assert res.data["assignedTo"]
  64. def test_create_comment(self):
  65. event = self.create_sample_event(platform="python")
  66. self.page.visit_issue_activity(self.org.slug, event.group.id)
  67. form = self.page.find_comment_form()
  68. form.find_element(by=By.TAG_NAME, value="textarea").send_keys("this looks bad")
  69. form.submit()
  70. assert self.page.has_comment("this looks bad")
  71. def test_mark_reviewed(self):
  72. event = self.create_sample_event(platform="python")
  73. add_group_to_inbox(event.group, GroupInboxReason.NEW)
  74. self.page.visit_issue(self.org.slug, event.group.id)
  75. self.page.mark_reviewed()
  76. res = self.page.api_issue_get(event.group.id)
  77. assert res.status_code == 200, res
  78. assert "inbox" not in res.data