class ConfigurationLocators: """Configuration page elements locators""" description = bys.by_xpath("//*[@placeholder='Description configuration']") search_field = bys.by_id("config_search_input") config_save_button = bys.by_class("form_config_button_save") app_fields_text_boxes = bys.by_tag("app-fields-textbox") app_fields_labels = bys.by_tag("app-fields-label") app_fields_map = bys.by_tag("app-fields-map") app_fields_password = bys.by_tag("app-fields-password") app_fields_textarea = bys.by_tag("app-fields-textarea") app_fields_json = bys.by_tag("app-fields-json") app_fields_list = bys.by_tag("app-fields-list") app_field = bys.by_tag("app-field") app_root_scheme = bys.by_tag("app-root-scheme") map_key = bys.by_xpath("//*[@formcontrolname='key']") map_value = bys.by_xpath("//*[@formcontrolname='value']") app_conf_fields = bys.by_tag("app-config-fields") app_conf_form = bys.by_tag("app-config-form") field_group = bys.by_class("field-group") group_title = bys.by_tag("mat-panel-title") map_key_field = bys.by_class('key-field') map_value_field = bys.by_class('value-field') load_marker = bys.by_class('load_complete') displayed_password_fields = bys.by_xpath("//div[@style='display: flex;']")
class Menu: """Top menu locators""" clusters = bys.by_class("topmenu_clusters") hostproviders = bys.by_class("topmenu_hostproviders") hosts = bys.by_class("topmenu_hosts") jobs = bys.by_class("topmenu_jobs") bundles = bys.by_class("topmenu_bundles")
class Service: """Service elements locators""" name = bys.by_class("mat-card-title") main_tab = bys.by_xpath("//*[@test='tab_main']") configuration_tab = bys.by_xpath("//*[@test='tab_configuration']") status_tab = bys.by_xpath("//*[@test='tab_status']") config_column = bys.by_class("mat-column-config")
class Menu: """Top menu locators""" clusters = bys.by_class("topmenu_clusters") hostproviders = bys.by_class("topmenu_hostproviders") hosts = bys.by_class("topmenu_hosts") jobs = bys.by_class("topmenu_jobs") bundles = bys.by_class("topmenu_bundles") job_button = bys.by_xpath('//button[@mattooltip="Show success jobs"]')
class ClusterDetails(Details, ListPage): _host = bys.by_class('add-host2cluster') _add_host_icon = bys.by_xpath( "//*[@mattooltip='Host will be added to the cluster']") @property def host_tab(self): self._getelement(Cluster.host_tab).click() return ListPage(self.driver) @property def services_tab(self): self._getelement(Cluster.service_tab).click() return ServiceList(self.driver) def _add_host_to_cluster(self): # self._getelement(self._host).click() self._getelement(self._add_host_icon).click() def click_hosts_tab(self): for tab in self._getelements(self._inactive_tabs): if tab.text.strip() == 'Hosts': tab.click() break def click_services_tab(self): return self._click_tab("Services") def click_add_button(self): self._press_add() self._add_host_to_cluster() self.close_form() def add_host_in_cluster(self): self.click_hosts_tab() self.click_add_button() def create_host_from_cluster(self, provider_name, fqdn): self.host_tab # pylint: disable=W0104 self._press_add() self._wait_add_form() self._click_element(Host.prototype) self._click_element(Common.options, name=provider_name) self._set_field_value(Host.name, fqdn) self._press_save() self.close_form() def _approve_action_run(self): self._wait_add_form() return self._getelement(Common.dialog_run).click() def run_action_by_name(self, action_name): actions = self._getelements(Common.action) for action in actions: if action.text == action_name: action.click() self._approve_action_run() break
class ActionPageLocators: """Action page elements locators""" action_run_button = bys.by_xpath('//mat-card//button') run_action_popup = bys.by_class('cdk-overlay-pane') class ActionRunPopup: """Action run popup elements locators""" verbose_chbx = bys.by_xpath( '//mat-checkbox[./label/*[text()="Verbose"]]') run_btn = bys.by_xpath('//button[./*[text()=" Run "]]')
class Common: """List page elements locators""" # Addition form common elements add_btn = bys.by_xpath("//*[@adcm_test='create-btn']") options = bys.by_xpath("//*[@role='option']") description = bys.by_xpath("//*[@placeholder='Description']") save_btn = bys.by_xpath("//span[contains(., 'Save')]/parent::button") cancel_btn = bys.by_xpath("//span[contains(., 'Cancel')]/parent::button") mat_button_wrapper = bys.by_class("mat-button-wrapper") toppanel_button_user = bys.by_class("toppanel_button_user") socket = bys.by_class("socket") profile = bys.by_class("profile") # List elements common elements rows = bys.by_class('mat-row') del_btn = "//span[contains(., 'delete')]/parent::button" list_text = bys.by_class("mat-list-text") # Dialog form common elements dialog = bys.by_class('mat-dialog-container') dialog_yes = bys.by_xpath("//span[contains(text(),'Yes')]/parent::button") dialog_run = bys.by_xpath("//span[contains(text(),'Run')]/parent::button") dialog_no = bys.by_xpath("//span[contains(text(),'No')]/parent::button") # Error dialog elemetns error = bys.by_class('snack-bar-error') hide_err = '' # Action elements action = bys.by_xpath("//*[@adcm_test='action_btn']") # Configuration elements input_el = bys.by_tag("input") mat_error = bys.by_class("mat-error") mat_checkbox = bys.by_tag("mat-checkbox") mat_checkbox_class = bys.by_class("mat-checkbox") mat_select = bys.by_class("mat-select") mat_icon = bys.by_class("mat-icon") mat_input_element = bys.by_class("mat-input-element") display_names = bys.by_class("title.mat-expansion-panel-header-title") mat_expansion_panel = bys.by_class("mat-expansion-panel") textarea = bys.by_tag("textarea") info_icon = bys.by_class("info-icon") item = bys.by_class("item") group_field = bys.by_class("app-group-fields") tooltip = bys.by_tag("app-tooltip") mat_slide_toggle = bys.by_class("mat-slide-toggle") mat_raised_button = bys.by_class("mat-raised-button") mat_form_field = bys.by_tag("mat-form-field") # Comon elements all_childs = bys.by("*")