test_issue_details_workflow.py 3.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  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.utils.samples import load_data
  8. class IssueDetailsWorkflowTest(AcceptanceTestCase, SnubaTestCase):
  9. def setUp(self):
  10. super().setUp()
  11. self.user = self.create_user("foo@example.com")
  12. self.org = self.create_organization(owner=self.user, name="Rowdy Tiger")
  13. self.team = self.create_team(
  14. organization=self.org, name="Mariachi Band", members=[self.user]
  15. )
  16. self.project = self.create_project(organization=self.org, teams=[self.team], name="Bengal")
  17. self.login_as(self.user)
  18. self.page = IssueDetailsPage(self.browser, self.client)
  19. self.dismiss_assistant()
  20. def create_sample_event(self, platform, default=None, sample_name=None):
  21. event_data = load_data(platform, default=default, sample_name=sample_name)
  22. event_data["event_id"] = "d964fdbd649a4cf8bfc35d18082b6b0e"
  23. event = self.store_event(
  24. data=event_data, project_id=self.project.id, assert_no_errors=False
  25. )
  26. event.group.update(
  27. first_seen=datetime(2015, 8, 13, 3, 8, 25, tzinfo=timezone.utc),
  28. last_seen=datetime(2016, 1, 13, 3, 8, 25, tzinfo=timezone.utc),
  29. )
  30. return event
  31. def test_resolve_basic(self):
  32. event = self.create_sample_event(platform="python")
  33. self.page.visit_issue(self.org.slug, event.group.id)
  34. self.page.resolve_issue()
  35. res = self.page.api_issue_get(event.group.id)
  36. assert res.status_code == 200, res
  37. assert res.data["status"] == "resolved"
  38. def test_ignore_basic(self):
  39. event = self.create_sample_event(platform="python")
  40. self.page.visit_issue(self.org.slug, event.group.id)
  41. self.page.ignore_issue()
  42. res = self.page.api_issue_get(event.group.id)
  43. assert res.status_code == 200, res
  44. assert res.data["status"] == "ignored"
  45. def test_bookmark(self):
  46. event = self.create_sample_event(platform="python")
  47. self.page.visit_issue(self.org.slug, event.group.id)
  48. self.page.bookmark_issue()
  49. res = self.page.api_issue_get(event.group.id)
  50. assert res.status_code == 200, res
  51. assert res.data["isBookmarked"]
  52. def test_assign_issue(self):
  53. event = self.create_sample_event(platform="python")
  54. self.page.visit_issue(self.org.slug, event.group.id)
  55. self.page.assign_to(self.user.email)
  56. res = self.page.api_issue_get(event.group.id)
  57. assert res.status_code == 200, res
  58. assert res.data["assignedTo"]
  59. def test_create_comment(self):
  60. event = self.create_sample_event(platform="python")
  61. self.page.visit_issue_activity(self.org.slug, event.group.id)
  62. form = self.page.find_comment_form()
  63. form.find_element(by=By.TAG_NAME, value="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