def is_file_explorer_visible(self):
        panel_state = explorer_state = constants.STATE_HIDDEN
        theia_left_panel = self.find_it(UI.get_theia_left_panel_locator())
        if constants.THEIA_ELEMENT_COLLAPSED not in theia_left_panel.get_attribute(
                constants.TYPE_CLASS):
            panel_state = constants.STATE_VISIBLE

        try:
            file_explorer_id_element = self.find_it(
                UI.get_files_explorer_locator())
            explorer_classes = file_explorer_id_element.get_attribute(
                constants.TYPE_CLASS)
            if constants.THEIA_ELEMENT_COLLAPSED not in explorer_classes and \
                    constants.THEIA_HIDDEN not in explorer_classes:
                explorer_state = constants.STATE_VISIBLE

        except NoSuchElementException:
            pass

        except Exception:
            raise GeneralException(
                self.get_driver(),
                call_from=self.is_file_explorer_visible.__name__)

        return constants.STATE_HIDDEN not in [panel_state, explorer_state]
Exemple #2
0
    def invoke_left_bar_item(self, item):
        WebDriverWait(self._driver, self.DEFAULT_TIMEOUT).until(
            expected_conditions.presence_of_element_located(UI.get_left_menu_bar_locator())
        )

        WebDriverWait(self._driver, self.DEFAULT_TIMEOUT).until(
            expected_conditions.presence_of_all_elements_located(UI.get_tabs_locator())
        )

        theia_left_panel = self.find_it(UI.get_theia_left_panel_locator())
        menu_content = self.find_it(UI.get_left_menu_bar_locator(), theia_left_panel)
        menu_elements = self.find_them(UI.get_tabs_locator(), menu_content)

        menu_item = None
        for menu_element in menu_elements:
            title = menu_element.get_attribute(constants.ELEMENT_TITLE)
            if title == item:
                menu_item = menu_element
                break

        if menu_item is None:
            raise WebDriverException

        self.click_me(menu_item, item)