test_project_detail.py 3.3 KB

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