test_project_detail.py 3.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. from django.utils import timezone
  2. from sentry.incidents.models import IncidentStatus
  3. from sentry.testutils import AcceptanceTestCase
  4. FEATURE_NAME = ["organizations:incidents"]
  5. class ProjectDetailTest(AcceptanceTestCase):
  6. def setUp(self):
  7. super().setUp()
  8. self.user = self.create_user("foo@example.com")
  9. self.org = self.create_organization(name="Rowdy Tiger", owner=None)
  10. self.team1 = self.create_team(organization=self.org, name="Mariachi Band 1")
  11. self.team2 = self.create_team(organization=self.org, name="Mariachi Band 2")
  12. self.team3 = self.create_team(organization=self.org, name="Mariachi Band 3")
  13. self.team4 = self.create_team(organization=self.org, name="Mariachi Band 4")
  14. self.team5 = self.create_team(organization=self.org, name="Mariachi Band 5")
  15. self.team6 = self.create_team(organization=self.org, name="Mariachi Band 6")
  16. self.project = self.create_project(
  17. organization=self.org,
  18. teams=[self.team1, self.team2, self.team3, self.team4, self.team5, self.team6],
  19. name="Bengal",
  20. )
  21. self.create_member(user=self.user, organization=self.org, role="owner", teams=[self.team1])
  22. alert_rule = self.create_alert_rule(organization=self.org, projects=[self.project])
  23. self.create_incident(
  24. organization=self.org,
  25. title="Incident #1",
  26. date_started=timezone.now(),
  27. date_detected=timezone.now(),
  28. projects=[self.project],
  29. alert_rule=alert_rule,
  30. status=IncidentStatus.WARNING.value,
  31. )
  32. self.create_incident(
  33. organization=self.org,
  34. title="Incident #2",
  35. date_started=timezone.now(),
  36. date_detected=timezone.now(),
  37. projects=[self.project],
  38. alert_rule=alert_rule,
  39. status=IncidentStatus.CRITICAL.value,
  40. )
  41. self.create_incident(
  42. organization=self.org,
  43. title="Incident #3",
  44. date_started=timezone.now(),
  45. date_detected=timezone.now(),
  46. date_closed=timezone.now(),
  47. projects=[self.project],
  48. alert_rule=alert_rule,
  49. status=IncidentStatus.CLOSED.value,
  50. )
  51. self.create_release(project=self.project, version="1.0.0")
  52. self.create_release(project=self.project, version="1.1.0")
  53. self.create_release(project=self.project, version="1.2.3")
  54. self.create_release(project=self.project, version="2.0.5")
  55. self.create_release(project=self.project, version="2.3.3")
  56. self.create_release(project=self.project, version="3.3.3")
  57. self.login_as(self.user)
  58. self.path = f"/organizations/{self.org.slug}/projects/{self.project.slug}/"
  59. def test_simple(self):
  60. with self.feature(FEATURE_NAME):
  61. self.browser.get(self.path)
  62. self.browser.wait_until_not('[data-test-id="loading-indicator"]')
  63. self.browser.wait_until_not('[data-test-id="loading-placeholder"]')
  64. self.browser.snapshot("project detail")
  65. def test_no_feature(self):
  66. self.browser.get(self.path)
  67. self.browser.wait_until_not('[data-test-id="loading-indicator"]')
  68. self.browser.snapshot("project detail no feature")