test_organization_sentry_app.py 3.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. from unittest import mock
  2. from sentry.testutils.cases import AcceptanceTestCase
  3. from sentry.testutils.silo import no_silo_test
  4. # from fixtures.page_objects.organization_integration_settings import (
  5. # OrganizationIntegrationSettingsPage,
  6. # )
  7. @no_silo_test(stable=True)
  8. class OrganizationSentryAppAcceptanceTestCase(AcceptanceTestCase):
  9. """
  10. As a user, I can install and uninstall a Sentry App
  11. """
  12. def setUp(self):
  13. super().setUp()
  14. self.user = self.create_user("foo@example.com")
  15. self.org = self.create_organization(name="Tesla", owner=None)
  16. self.team = self.create_team(organization=self.org, name="Tesla Motors")
  17. self.project = self.create_project(organization=self.org, teams=[self.team], name="Model S")
  18. self.create_member(user=self.user, organization=self.org, role="owner", teams=[self.team])
  19. self.sentry_app = self.create_sentry_app(
  20. name="Tesla App", published=True, organization=self.org
  21. )
  22. self.login_as(self.user)
  23. self.org_integration_settings_path = f"/settings/{self.org.slug}/integrations/"
  24. self.provider = mock.Mock()
  25. self.provider.key = "tesla-app"
  26. self.provider.name = "Tesla App"
  27. def load_page(self, url):
  28. self.browser.get(url)
  29. self.browser.wait_until_not('[data-test-id="loading-indicator"]')
  30. # def test_install_sentry_app(self):
  31. # self.load_page(self.org_integration_settings_path)
  32. # org_settings_page = OrganizationIntegrationSettingsPage(browser=self.browser)
  33. # provider_element = org_settings_page.get_provider(self.provider)
  34. # # assert installation rather than upgrade button
  35. # assert provider_element.install_button.label == "Install"
  36. # provider_element.install_button.click()
  37. # install_selecter = '.modal-dialog [aria-label="Accept & Install"]'
  38. # self.browser.wait_until(install_selecter)
  39. # self.browser.click(install_selecter)
  40. # self.browser.wait_until(".ref-success")
  41. # # provider_element might be rerendered
  42. # provider_element = org_settings_page.get_provider(self.provider)
  43. # # assert we see the uninstall option
  44. # assert provider_element.install_button.label == "Uninstall"
  45. # def test_uninstall_sentry_app(self):
  46. # # add the installation
  47. # self.installation = self.create_sentry_app_installation(
  48. # slug=self.sentry_app.slug, organization=self.org, user=self.user
  49. # )
  50. # self.load_page(self.org_integration_settings_path)
  51. # org_settings_page = OrganizationIntegrationSettingsPage(browser=self.browser)
  52. # provider_element = org_settings_page.get_provider(self.provider)
  53. # # assert we see the uninstall option
  54. # assert provider_element.install_button.label == "Uninstall"
  55. # provider_element.install_button.click()
  56. # self.browser.wait_until(org_settings_page.modal_selector)
  57. # self.browser.click('.modal-dialog [aria-label="Confirm"]')
  58. # self.browser.wait_until(".ref-success")
  59. # # provider_element might be rerendered
  60. # provider_element = org_settings_page.get_provider(self.provider)
  61. # # assert we see the install option now
  62. # assert provider_element.install_button.label == "Install"