test_organization_sentry_app_detailed_view.py 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. from sentry.models import SentryAppInstallation
  2. from sentry.testutils import AcceptanceTestCase
  3. from tests.acceptance.page_objects.organization_integration_settings import (
  4. OrganizationSentryAppDetailViewPage,
  5. )
  6. class OrganizationSentryAppDetailedView(AcceptanceTestCase):
  7. def setUp(self):
  8. super().setUp()
  9. self.create_project(organization=self.organization)
  10. self.sentry_app = self.create_sentry_app(
  11. organization=self.organization,
  12. published=True,
  13. verify_install=False,
  14. name="Super Awesome App",
  15. )
  16. self.login_as(self.user)
  17. def load_page(self, slug):
  18. url = f"/settings/{self.organization.slug}/sentry-apps/{slug}/"
  19. self.browser.get(url)
  20. self.browser.wait_until_not('[data-test-id="loading-indicator"]')
  21. def test_add_sentry_app(self):
  22. self.load_page(self.sentry_app.slug)
  23. self.browser.snapshot("integrations - sentry app detail uninstalled")
  24. detail_view_page = OrganizationSentryAppDetailViewPage(browser=self.browser)
  25. detail_view_page.click_install_button()
  26. self.browser.wait_until('[data-test-id="toast-success"]')
  27. assert SentryAppInstallation.objects.filter(
  28. organization=self.organization, sentry_app=self.sentry_app
  29. )
  30. def test_uninstallation(self):
  31. self.installation = self.create_sentry_app_installation(
  32. slug=self.sentry_app.slug, organization=self.organization, user=self.user
  33. )
  34. self.load_page(self.sentry_app.slug)
  35. self.browser.snapshot("integrations - sentry app detail installed")
  36. detail_view_page = OrganizationSentryAppDetailViewPage(browser=self.browser)
  37. detail_view_page.uninstall()
  38. self.browser.wait_until('[data-test-id="toast-success"]')
  39. assert not SentryAppInstallation.objects.filter(
  40. organization=self.organization, sentry_app=self.sentry_app
  41. )