test_issue_details_workflow.py 3.5 KB

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