test_organization_sentry_app_detailed_view.py 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. from fixtures.page_objects.organization_integration_settings import (
  2. OrganizationSentryAppDetailViewPage,
  3. )
  4. from sentry.models import SentryAppInstallation
  5. from sentry.testutils import AcceptanceTestCase
  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,
  33. organization=self.organization,
  34. user=self.user,
  35. prevent_token_exchange=True,
  36. )
  37. self.load_page(self.sentry_app.slug)
  38. self.browser.snapshot("integrations - sentry app detail installed")
  39. detail_view_page = OrganizationSentryAppDetailViewPage(browser=self.browser)
  40. detail_view_page.uninstall()
  41. self.browser.wait_until('[data-test-id="toast-success"]')
  42. assert not SentryAppInstallation.objects.filter(
  43. organization=self.organization, sentry_app=self.sentry_app
  44. )