organization_integration_settings.py 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. from .base import BasePage, ButtonElement, ModalElement
  2. class ExampleIntegrationSetupWindowElement(ModalElement):
  3. name_field_selector = "name"
  4. submit_button_selector = '[type="submit"]'
  5. def __init__(self, *args, **kwargs):
  6. super().__init__(*args, **kwargs)
  7. self.name = self.element.find_element_by_name("name")
  8. continue_button_element = self.element.find_element_by_css_selector(
  9. self.submit_button_selector
  10. )
  11. self.continue_button = ButtonElement(continue_button_element)
  12. def fill_in_setup_form(self, installation_data):
  13. self.name.send_keys(installation_data[self.name_field_selector])
  14. class OrganizationAbstractDetailViewPage(BasePage):
  15. configurations_text = "Configurations"
  16. def click_install_button(self):
  17. self.browser.click('[data-test-id="install-button"]')
  18. # uninstalls any configuration (not a particular one)
  19. def uninstall(self):
  20. self.browser.click('[aria-label="Uninstall"]')
  21. self.browser.click('[data-test-id="confirm-button"]')
  22. def switch_to_configuration_view(self):
  23. self.browser.find_element_by_link_text(self.configurations_text).click()
  24. class OrganizationIntegrationDetailViewPage(OrganizationAbstractDetailViewPage):
  25. def click_through_integration_setup(self, setup_window_cls, installation_data):
  26. self.driver.switch_to_window(self.driver.window_handles[1])
  27. integration_setup_window = setup_window_cls(element=self.browser)
  28. integration_setup_window.fill_in_setup_form(installation_data)
  29. integration_setup_window.continue_button.click()
  30. self.driver.switch_to_window(self.driver.window_handles[0])
  31. class OrganizationSentryAppDetailViewPage(OrganizationAbstractDetailViewPage):
  32. def uninstall(self):
  33. self.browser.click('[data-test-id="sentry-app-uninstall"]')
  34. self.browser.click('[data-test-id="confirm-button"]')