test_organization_releases.py 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. from datetime import UTC, datetime
  2. from unittest.mock import patch
  3. import pytest
  4. from django.utils import timezone
  5. from sentry.testutils.cases import AcceptanceTestCase
  6. from sentry.testutils.silo import no_silo_test
  7. pytestmark = pytest.mark.sentry_metrics
  8. @no_silo_test
  9. class OrganizationReleasesTest(AcceptanceTestCase):
  10. release_date = datetime(2020, 5, 18, 15, 13, 58, 132928, tzinfo=UTC)
  11. def setUp(self):
  12. super().setUp()
  13. self.user = self.create_user("foo@example.com")
  14. self.org = self.create_organization(owner=self.user, name="Rowdy Tiger")
  15. self.team = self.create_team(
  16. organization=self.org, name="Mariachi Band", members=[self.user]
  17. )
  18. self.project = self.create_project(organization=self.org, teams=[self.team], name="Bengal")
  19. self.project2 = self.create_project(
  20. organization=self.org, teams=[self.team], name="Bengal 2"
  21. )
  22. self.create_project(organization=self.org, teams=[self.team], name="Bengal 3")
  23. self.login_as(self.user)
  24. self.path = f"/organizations/{self.org.slug}/releases/"
  25. self.project.update(first_event=timezone.now())
  26. @patch("sentry.api.serializers.models.organization.get_organization_volume", return_value=None)
  27. def test_list(self, _):
  28. self.create_release(project=self.project, version="1.0", date_added=self.release_date)
  29. self.browser.get(self.path)
  30. self.browser.wait_until_not(".loading")
  31. # TODO(releases): add health data
  32. @patch("sentry.api.serializers.models.organization.get_organization_volume", return_value=None)
  33. def test_detail(self, _):
  34. release = self.create_release(
  35. project=self.project, version="1.0", date_added=self.release_date
  36. )
  37. self.browser.get(self.path + release.version)
  38. self.browser.wait_until_not(".loading")
  39. self.browser.wait_until_test_id("release-wrapper")
  40. self.browser.wait_until_not('[data-test-id="loading-placeholder"]')
  41. # TODO(releases): add health data
  42. @patch("sentry.api.serializers.models.organization.get_organization_volume", return_value=None)
  43. def test_detail_pick_project(self, _):
  44. release = self.create_release(
  45. project=self.project,
  46. additional_projects=[self.project2],
  47. version="1.0",
  48. date_added=self.release_date,
  49. )
  50. self.browser.get(self.path + release.version)
  51. self.browser.wait_until_not(".loading")
  52. assert "Select a project to continue" in self.browser.element("[role='dialog'] header").text
  53. # This is snapshotting features that are enable through the discover and performance features.
  54. @patch("sentry.api.serializers.models.organization.get_organization_volume", return_value=None)
  55. def test_detail_with_discover_and_performance(self, _):
  56. with self.feature(["organizations:discover-basic", "organizations:performance-view"]):
  57. release = self.create_release(
  58. project=self.project, version="1.0", date_added=self.release_date
  59. )
  60. self.browser.get(self.path + release.version)
  61. self.browser.wait_until_not(".loading")
  62. self.browser.wait_until_test_id("release-wrapper")
  63. self.browser.wait_until_not('[data-test-id="loading-placeholder"]')
  64. # TODO(releases): add health data