test_issue_details_workflow.py 3.7 KB

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