Beispiel #1
0
 def list_data_table(self, raw=False):
     """Returns list of data from table"""
     self.load_chart_reference()
     data = []
     if self.has_warning:
         return data
     table = Table(table_locator="//table[contains(@class, 'table')]")
     headers = []
     for header in table.headers:
         headers.append(attributize_string(sel.text_sane(header)))
     for row in table.rows():
         _data = {}
         for header in headers:
             if header == "datetime":
                 _datetime = sel.text_sane(row[header])
                 if raw:
                     _data[header] = _datetime
                 else:
                     # sample 10/19/16 15:23:38 UTC
                     _data['timestamp'] = self._timestamp(
                         datetime.strptime(_datetime,
                                           "%m/%d/%y %H:%M:%S %Z"))
             else:
                 _value = round_double(value_of(sel.text_sane(row[header])))
                 _data[header] = None if _value == '' else _value
         data.append(_data)
     return data
 def list_data_table(self, raw=False):
     """Returns list of data from table"""
     self.load_chart_reference()
     data = []
     if self.has_warning:
         return data
     table = Table(table_locator="//table[contains(@class, 'table')]")
     headers = []
     for header in table.headers:
         headers.append(attributize_string(sel.text_sane(header)))
     for row in table.rows():
         _data = {}
         for header in headers:
             if header == "datetime":
                 _datetime = sel.text_sane(row[header])
                 if raw:
                     _data[header] = _datetime
                 else:
                     # sample 10/19/16 15:23:38 UTC
                     _data['timestamp'] = self._timestamp(
                         datetime.strptime(_datetime, "%m/%d/%y %H:%M:%S %Z"))
             else:
                 _value = round_double(value_of(sel.text_sane(row[header])))
                 _data[header] = None if _value == '' else _value
         data.append(_data)
     return data
def test_routes_search(routes_search_strings):
    """ Routes summary page - Search bar

           This test checks Search bar functionality on the Routes summary page

           Steps:
               * Goes to Containers Routes page
               * Inserts: Irregular symbol, '*' character, full search string, partial search string
               * Verify proper results
           """
    sel.force_navigate('containers_routes')
    if ''.join(routes_search_strings) == '*':
        full_name_to_search = '*'
        names_list = []
        located_names = []
        projects_table = Table(table_el)
        for row in projects_table.rows():
            names_list.append(row.name.text)
        search.normal_search(full_name_to_search)
        for row in projects_table.rows():
            located_names.append(row.name.text)
        for name in located_names:
            assert name in names_list
    elif ''.join(routes_search_strings) == 'front':
        full_name_to_search = 'front'
        search.normal_search(full_name_to_search)
        projects_table = Table(table_el)
        for row in projects_table.rows():
            name = row.name.text
            assert full_name_to_search in name
    elif ''.join(routes_search_strings) == '$':
        full_name_to_search = '$'
        search.normal_search(full_name_to_search)
        assert sel.is_displayed_text("No Records Found.")
    else:
        full_name_to_search = ''.join(routes_search_strings)
        search.normal_search(full_name_to_search)
        projects_table = Table(table_el)
        for row in projects_table.rows():
            name = row.name.text
            assert name == full_name_to_search
def test_routes_search(routes_search_strings):
    """ Routes summary page - Search bar

           This test checks Search bar functionality on the Routes summary page

           Steps:
               * Goes to Containers Routes page
               * Inserts: Irregular symbol, '*' character, full search string, partial search string
               * Verify proper results
           """
    navigate_to(Route, 'All')
    if ''.join(routes_search_strings) == '*':
        full_name_to_search = '*'
        names_list = []
        located_names = []
        projects_table = Table(table_el)
        for row in projects_table.rows():
            names_list.append(row.name.text)
        search.normal_search(full_name_to_search)
        for row in projects_table.rows():
            located_names.append(row.name.text)
        for name in located_names:
            assert name in names_list
    elif ''.join(routes_search_strings) == 'front':
        full_name_to_search = 'front'
        search.normal_search(full_name_to_search)
        projects_table = Table(table_el)
        for row in projects_table.rows():
            name = row.name.text
            assert full_name_to_search in name
    elif ''.join(routes_search_strings) == '$':
        full_name_to_search = '$'
        search.normal_search(full_name_to_search)
        assert sel.is_displayed_text("No Records Found.")
    else:
        full_name_to_search = ''.join(routes_search_strings)
        search.normal_search(full_name_to_search)
        projects_table = Table(table_el)
        for row in projects_table.rows():
            name = row.name.text
            assert name == full_name_to_search