test_issue_details_workflow.py 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  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. res = self.page.api_issue_get(event.group.id)
  38. assert res.status_code == 200, res
  39. assert res.data["status"] == "resolved"
  40. def test_ignore_basic(self):
  41. event = self.create_sample_event(platform="python")
  42. self.page.visit_issue(self.org.slug, event.group.id)
  43. self.page.ignore_issue()
  44. res = self.page.api_issue_get(event.group.id)
  45. assert res.status_code == 200, res
  46. assert res.data["status"] == "ignored"
  47. def test_bookmark(self):
  48. event = self.create_sample_event(platform="python")
  49. self.page.visit_issue(self.org.slug, event.group.id)
  50. self.page.bookmark_issue()
  51. res = self.page.api_issue_get(event.group.id)
  52. assert res.status_code == 200, res
  53. assert res.data["isBookmarked"]
  54. def test_assign_issue(self):
  55. event = self.create_sample_event(platform="python")
  56. self.page.visit_issue(self.org.slug, event.group.id)
  57. self.page.assign_to(self.user.email)
  58. res = self.page.api_issue_get(event.group.id)
  59. assert res.status_code == 200, res
  60. assert res.data["assignedTo"]
  61. def test_create_comment(self):
  62. event = self.create_sample_event(platform="python")
  63. self.page.visit_issue_activity(self.org.slug, event.group.id)
  64. form = self.page.find_comment_form()
  65. form.find_element(by=By.TAG_NAME, value="textarea").send_keys("this looks bad")
  66. form.submit()
  67. assert self.page.has_comment("this looks bad")
  68. def test_mark_reviewed(self):
  69. event = self.create_sample_event(platform="python")
  70. add_group_to_inbox(event.group, GroupInboxReason.NEW)
  71. self.page.visit_issue(self.org.slug, event.group.id)
  72. self.page.mark_reviewed()
  73. res = self.page.api_issue_get(event.group.id)
  74. assert res.status_code == 200, res
  75. assert "inbox" not in res.data