test_organization_sentry_app.py 3.2 KB

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