test_issue_details.py 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  1. from __future__ import absolute_import
  2. import pytz
  3. from mock import patch
  4. from datetime import datetime, timedelta
  5. from django.utils import timezone
  6. from sentry.testutils import AcceptanceTestCase, SnubaTestCase
  7. from sentry.utils.samples import load_data
  8. from tests.acceptance.page_objects.issue_details import IssueDetailsPage
  9. event_time = (datetime.utcnow() - timedelta(days=3)).replace(tzinfo=pytz.utc)
  10. now = datetime.utcnow().replace(tzinfo=pytz.utc)
  11. class IssueDetailsTest(AcceptanceTestCase, SnubaTestCase):
  12. def setUp(self):
  13. super(IssueDetailsTest, self).setUp()
  14. patcher = patch("django.utils.timezone.now", return_value=now)
  15. patcher.start()
  16. self.addCleanup(patcher.stop)
  17. self.user = self.create_user("foo@example.com")
  18. self.org = self.create_organization(owner=self.user, name="Rowdy Tiger")
  19. self.team = self.create_team(organization=self.org, name="Mariachi Band")
  20. self.project = self.create_project(organization=self.org, teams=[self.team], name="Bengal")
  21. self.login_as(self.user)
  22. self.page = IssueDetailsPage(self.browser, self.client)
  23. self.dismiss_assistant()
  24. def create_sample_event(self, platform, default=None, sample_name=None, time=None):
  25. event_data = load_data(platform, default=default, sample_name=sample_name)
  26. event_data["event_id"] = "d964fdbd649a4cf8bfc35d18082b6b0e"
  27. # Only set these properties if we were given a time.
  28. # event processing will mark old time values as processing errors.
  29. if time:
  30. event_data["received"] = time.isoformat()
  31. # We need a fallback datetime for the event
  32. if time is None:
  33. time = now - timedelta(days=2)
  34. time = time.replace(hour=0, minute=0, second=0, microsecond=0)
  35. event_data["timestamp"] = time.isoformat()
  36. event = self.store_event(
  37. data=event_data, project_id=self.project.id, assert_no_errors=False
  38. )
  39. event.group.update(
  40. first_seen=datetime(2015, 8, 13, 3, 8, 25, tzinfo=timezone.utc), last_seen=time
  41. )
  42. return event
  43. def test_python_event(self):
  44. event = self.create_sample_event(platform="python", time=event_time)
  45. self.page.visit_issue(self.org.slug, event.group.id)
  46. # Wait for tag bars to load
  47. self.browser.wait_until_test_id("loaded-device-name")
  48. self.browser.snapshot("issue details python")
  49. def test_python_rawbody_event(self):
  50. event = self.create_sample_event(platform="python-rawbody")
  51. self.page.visit_issue(self.org.slug, event.group.id)
  52. self.browser.move_to('[data-test-id="rich-http-content-body-section-pre"]')
  53. self.browser.snapshot("issue details python raw body")
  54. def test_python_formdata_event(self):
  55. event = self.create_sample_event(platform="python-formdata")
  56. self.page.visit_issue(self.org.slug, event.group.id)
  57. self.browser.snapshot("issue details python formdata")
  58. def test_pii_tooltips(self):
  59. event = self.create_sample_event(platform="pii-tooltips")
  60. self.page.visit_issue(self.org.slug, event.group.id)
  61. self.browser.snapshot("issue details pii tooltips")
  62. def test_cocoa_event(self):
  63. event = self.create_sample_event(platform="cocoa")
  64. self.page.visit_issue(self.org.slug, event.group.id)
  65. self.browser.snapshot("issue details cocoa")
  66. def test_unity_event(self):
  67. event = self.create_sample_event(default="unity", platform="csharp")
  68. self.page.visit_issue(self.org.slug, event.group.id)
  69. self.browser.snapshot("issue details unity")
  70. def test_android_event(self):
  71. event = self.create_sample_event(platform="android")
  72. self.page.visit_issue(self.org.slug, event.group.id)
  73. self.browser.snapshot("issue details android")
  74. def test_android_ndk_event(self):
  75. event = self.create_sample_event(default="android-ndk", platform="android-ndk")
  76. self.page.visit_issue(self.org.slug, event.group.id)
  77. self.browser.snapshot("issue details android-ndk")
  78. def test_aspnetcore_event(self):
  79. event = self.create_sample_event(default="aspnetcore", platform="csharp")
  80. self.page.visit_issue(self.org.slug, event.group.id)
  81. self.browser.snapshot("issue details aspnetcore")
  82. def test_javascript_specific_event(self):
  83. event = self.create_sample_event(platform="javascript")
  84. self.page.visit_issue(self.org.slug, event.group.id)
  85. self.browser.snapshot("issue details javascript - event details")
  86. self.browser.find_element_by_xpath("//button//span[contains(text(), 'curl')]").click()
  87. self.browser.snapshot("issue details javascript - event details - curl command")
  88. def test_rust_event(self):
  89. # TODO: This should become its own "rust" platform type
  90. event = self.create_sample_event(platform="native", sample_name="Rust")
  91. self.page.visit_issue(self.org.slug, event.group.id)
  92. self.browser.snapshot("issue details rust")
  93. def test_cordova_event(self):
  94. event = self.create_sample_event(platform="cordova")
  95. self.page.visit_issue(self.org.slug, event.group.id)
  96. self.browser.snapshot("issue details cordova")
  97. def test_stripped_event(self):
  98. event = self.create_sample_event(platform="pii")
  99. self.page.visit_issue(self.org.slug, event.group.id)
  100. self.browser.snapshot("issue details pii stripped")
  101. def test_empty_exception(self):
  102. event = self.create_sample_event(platform="empty-exception")
  103. self.page.visit_issue(self.org.slug, event.group.id)
  104. self.browser.snapshot("issue details empty exception")
  105. def test_empty_stacktrace(self):
  106. event = self.create_sample_event(platform="empty-stacktrace")
  107. self.page.visit_issue(self.org.slug, event.group.id)
  108. self.browser.snapshot("issue details empty stacktrace")
  109. def test_invalid_interfaces(self):
  110. event = self.create_sample_event(platform="invalid-interfaces")
  111. self.page.visit_issue(self.org.slug, event.group.id)
  112. self.browser.click('[data-test-id="event-error-toggle"]')
  113. self.browser.wait_until_test_id("event-error-details")
  114. self.browser.snapshot("issue details invalid interfaces")
  115. def test_activity_page(self):
  116. event = self.create_sample_event(platform="python")
  117. self.page.visit_issue(self.org.slug, event.group.id)
  118. self.page.go_to_subtab("Activity")
  119. self.browser.wait_until_test_id("activity-item")
  120. self.browser.blur()
  121. self.browser.snapshot("issue activity python")
  122. def test_resolved(self):
  123. event = self.create_sample_event(platform="python")
  124. self.page.visit_issue(self.org.slug, event.group.id)
  125. self.page.resolve_issue()
  126. self.browser.snapshot("issue details resolved")
  127. def test_ignored(self):
  128. event = self.create_sample_event(platform="python")
  129. self.page.visit_issue(self.org.slug, event.group.id)
  130. self.page.ignore_issue()
  131. self.browser.snapshot("issue details ignored")