test_project_detail.py 3.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. from django.utils import timezone
  2. from sentry.incidents.models import IncidentStatus
  3. from sentry.testutils.cases import AcceptanceTestCase
  4. from sentry.testutils.silo import no_silo_test
  5. FEATURE_NAME = ["organizations:incidents"]
  6. @no_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. def test_no_feature(self):
  67. self.browser.get(self.path)
  68. self.browser.wait_until_not('[data-test-id="loading-indicator"]')