Beispiel #1
0
 def test_lhn_remembers_tab_state(self, header_dashboard, selenium):
   """Tests if LHN remembers which tab is selected (my or all objects) after
   closing it."""
   lhn_menu = header_dashboard.open_lhn_menu()
   # check if all objects tab is selected by default
   assert selenium_utils.is_value_in_attr(
       lhn_menu.all_objects.element) is True
   for tab in ['my_objects', 'all_objects']:
     getattr(header_dashboard.open_lhn_menu(), 'select_{0}'.format(tab))()
     header_dashboard.close_lhn_menu()
     selenium.refresh()
     new_lhn_menu = dashboard.Header(selenium).open_lhn_menu()
     # check if selected tab saves state
     assert selenium_utils.is_value_in_attr(
         getattr(new_lhn_menu, tab).element) is True
Beispiel #2
0
 def __init__(self,
              driver,
              locator_or_element,
              is_active_attr_val="active"):
     super(Toggle, self).__init__(driver, locator_or_element)
     self.is_activated = selenium_utils.is_value_in_attr(
         self.element, value=is_active_attr_val)
Beispiel #3
0
 def active_tab(self):
   """Getter for active tab. Raise StopIteration If currently TabController
   hasn't active tab.
   """
   if self._active_tab is None:
     self._active_tab = next((
         tab for tab in self.get_items()
         if selenium_utils.is_value_in_attr(tab.element)))
   return self._active_tab
Beispiel #4
0
 def active_tab(self):
     """Getter for active tab. Raise StopIteration If currently TabController
 hasn't active tab.
 """
     if self._active_tab is None:
         self._active_tab = next(
             (tab for tab in self.get_items()
              if selenium_utils.is_value_in_attr(tab.element)))
     return self._active_tab
Beispiel #5
0
 def test_lhn_remembers_tab_state(self, header_dashboard, selenium):
   """Tests if LHN remembers which tab is selected (my or all objects) after
   closing it."""
   lhn_menu = header_dashboard.open_lhn_menu()
   # check if my objects tab saves state
   lhn_menu.select_my_objects()
   header_dashboard.close_lhn_menu()
   header_dashboard.open_user_list()
   selenium.get(dashboard.Dashboard.URL)
   new_lhn_menu = dashboard.Header(selenium).open_lhn_menu()
   assert selenium_utils.is_value_in_attr(
       new_lhn_menu.my_objects.element) is True
   # check if all objects tab saves state
   lhn_menu = header_dashboard.open_lhn_menu()
   lhn_menu.select_all_objects()
   header_dashboard.close_lhn_menu()
   header_dashboard.open_user_list()
   assert selenium_utils.is_value_in_attr(
       new_lhn_menu.all_objects.element) is True
Beispiel #6
0
 def is_open_enabled(self):
   """Find open button in 3BBS dropdown modal and check if it enabled.
   Return:
   True if disabled attribute value does not exist for parent element of open,
   False if disabled attribute value exist for parent element of open.
   """
   parent_element_of_open = selenium_utils.get_parent_element(
       self._driver, self._driver.find_element(*self.open_locator))
   return selenium_utils.is_value_in_attr(
       parent_element_of_open, value=locator.Common.DISABLED_VALUE)
 def test_lhn_remembers_tab_state(self, selenium):
   """Tests if LHN remembers which tab is selected (my or all objects) after
   closing it."""
   conftest_utils.navigate_to_page_with_lhn(selenium)
   header = dashboard.Header(selenium)
   # check if my objects tab saves state
   lhn_menu = header.open_lhn_menu()
   lhn_menu.select_my_objects()
   header.close_lhn_menu()
   header.open_user_list()
   new_lhn = header.open_lhn_menu()
   assert selenium_utils.is_value_in_attr(new_lhn.my_objects.element) is True
   # check if all objects tab saves state
   lhn_menu = header.open_lhn_menu()
   lhn_menu.select_all_objects()
   header.close_lhn_menu()
   header.open_user_list()
   new_lhn = header.open_lhn_menu()
   assert selenium_utils.is_value_in_attr(new_lhn.all_objects.element) is True
 def test_lhn_remembers_tab_state(self, selenium):
   """Tests if LHN remembers which tab is selected (my or all objects) after
   closing it."""
   conftest_utils.navigate_to_page_with_lhn(selenium)
   header = dashboard.Header(selenium)
   # check if my objects tab saves state
   lhn_menu = header.open_lhn_menu()
   lhn_menu.select_my_objects()
   header.close_lhn_menu()
   header.open_user_list()
   new_lhn = header.open_lhn_menu()
   assert selenium_utils.is_value_in_attr(new_lhn.my_objects.element) is True
   # check if all objects tab saves state
   lhn_menu = header.open_lhn_menu()
   lhn_menu.select_all_objects()
   header.close_lhn_menu()
   header.open_user_list()
   new_lhn = header.open_lhn_menu()
   assert selenium_utils.is_value_in_attr(new_lhn.all_objects.element) is True
Beispiel #9
0
        def check_log_item(log_element, label_value):
            """Check consistency of log item by passed log element. Person's label
      will be checked by comparing element 'class' and passed 'label_value'
      Return: dict of bool.
      """
            all_cells_texts = [
                elem.text
                for elem in log_element.find_elements(*tab_locators.CELLS_CSS)
            ]
            expected_headers = [
                tab_elements.FIELD, tab_elements.ORIGINAL_VALUE,
                tab_elements.NEW_VALUE
            ]
            headers_is_valid = ([
                all_cells_texts.pop(0) for _ in xrange(len(expected_headers))
            ] == expected_headers)

            field_is_valid = all(
                cell != "" and cell != tab_elements.EMPTY_STATEMENT
                for cell in all_cells_texts[0::3])
            orignal_value_is_valid = all(cell == tab_elements.EMPTY_STATEMENT
                                         for cell in all_cells_texts[1::3])
            new_value_is_valid = all(
                cell != "" and cell != tab_elements.EMPTY_STATEMENT
                for cell in all_cells_texts[2::3])

            person_label_is_valid = selenium_utils.is_value_in_attr(
                log_element.find_element(*tab_locators.PERSON_LABEL),
                "class",
                value=label_value)
            person_element = log_element.find_element(
                *tab_locators.COMMENT_PERSON_CSS)

            return {
                "headers_is_valid": headers_is_valid,
                "field_is_valid": field_is_valid,
                "orignal_value_is_valid": orignal_value_is_valid,
                "new_value_is_valid": new_value_is_valid,
                "person_is_valid": person_element.text == roles.DEFAULT_USER,
                "person_label_is_valid": person_label_is_valid
            }
Beispiel #10
0
 def is_expanded(self):
     return selenium_utils.is_value_in_attr(self.expand_btn)
Beispiel #11
0
 def is_expanded(self):
   return selenium_utils.is_value_in_attr(self.item_btn)
Beispiel #12
0
 def __init__(self, driver, locator, is_active_attr_val="active"):
   super(Toggle, self).__init__(driver, locator)
   self.is_activated = selenium_utils.is_value_in_attr(
       self.element, value=is_active_attr_val)
Beispiel #13
0
 def __init__(self, driver, el_locator):
     super(DynamicTreeToggle, self).__init__(driver, el_locator)
     self.element = driver.find_element(*el_locator)
     self.is_activated = selenium_utils.is_value_in_attr(self.element)
Beispiel #14
0
 def __init__(self, driver, el_locator):
   super(DynamicTreeToggle, self).__init__(driver, el_locator)
   self.element = driver.find_element(*el_locator)
   self.is_activated = selenium_utils.is_value_in_attr(self.element)
Beispiel #15
0
 def __init__(self, driver, el_locator):
     self.element = driver.find_element(*el_locator)
     self.is_activated = selenium_utils.is_value_in_attr(self.element)