test_organization_plugin_detail_view.py 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. from exam import fixture
  2. from fixtures.page_objects.organization_integration_settings import (
  3. OrganizationAbstractDetailViewPage,
  4. )
  5. from sentry.testutils import AcceptanceTestCase
  6. from sentry_plugins.opsgenie.plugin import OpsGeniePlugin
  7. class OrganizationPluginDetailedView(AcceptanceTestCase):
  8. @fixture
  9. def plugin(self):
  10. return OpsGeniePlugin()
  11. def setUp(self):
  12. super().setUp()
  13. # need at least two projects
  14. self.project = self.create_project(organization=self.organization, name="Back end")
  15. self.create_project(organization=self.organization, name="Front End")
  16. self.login_as(self.user)
  17. def load_page(self, slug, configuration_tab=False):
  18. url = f"/settings/{self.organization.slug}/plugins/{slug}/"
  19. if configuration_tab:
  20. url += "?tab=configurations"
  21. self.browser.get(url)
  22. self.browser.wait_until_not('[data-test-id="loading-indicator"]')
  23. def test_opsgenie_add_to_project(self):
  24. self.load_page("opsgenie")
  25. self.browser.snapshot("integrations - plugin detail overview")
  26. detail_view_page = OrganizationAbstractDetailViewPage(browser=self.browser)
  27. detail_view_page.click_install_button()
  28. self.browser.click('[role="dialog"] [id$="option-0-0"]')
  29. # check if we got to the configuration page with the form
  30. self.browser.wait_until_not('[data-test-id="loading-indicator"]')
  31. self.browser.wait_until_test_id("plugin-config")
  32. self.browser.snapshot("integrations - plugin config form")
  33. def test_uninstallation(self):
  34. self.plugin.set_option("api_key", "7c8951d1", self.project)
  35. self.plugin.set_option("alert_url", "https://api.opsgenie.com/v2/alerts", self.project)
  36. self.load_page("opsgenie", configuration_tab=True)
  37. self.browser.snapshot("integrations - plugin detail one configuration")
  38. detail_view_page = OrganizationAbstractDetailViewPage(browser=self.browser)
  39. assert self.browser.element_exists('[aria-label="Configure"]')
  40. detail_view_page.uninstall()
  41. self.browser.wait_until('[data-test-id="toast-success"]')
  42. assert not self.browser.element_exists('[aria-label="Configure"]')
  43. self.browser.snapshot("integrations - plugin detail no configurations")