organization_integration_settings.py 2.0 KB

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