def test_data_integrity_for_topology(test_data): """ This test verifies that every status box value under Containers Overview is identical to the number present on its page. Steps: * Go to Containers / Overview * All cells should contain the correct relevant information # of nodes # of providers # ... """ section_values = {} sel.force_navigate('container_dashboard') # We should wait ~2 seconds for the StatusBox population # (until we find a better solution) time.sleep(2) status_box = StatusBox(test_data[2]) section_values[test_data[0]] = int(status_box.value()) sel.force_navigate(test_data[1]) if section_values[test_data[0]] > 0: if test_data[0] is Provider: assert len(map(lambda i: i, Quadicon.all())) == section_values[test_data[0]] else: assert len(map(lambda r: r, test_data[3].rows()) ) == section_values[test_data[0]] else: assert sel.is_displayed_text('No Records Found.')
def test_containers_summary_objects(provider, soft_assert): """ Containers overview page > Widgets > Widgets summary This test checks that the amount of a selected object in the system is shown correctly in the widgets in the Overview menu Steps: * Goes to Compute --> Containers --> Overview * Checks how many objects are shown in the selected widget * Goes to Containers summary page and checks how many objects are shown there. * Checks the amount is equal """ container_object = version.pick(objects_key) prov_ui_values, status_box_values = dict(), dict() navigate_to(ContainersOverview, 'All') for obj_type in container_object: status_box_values[obj_type] = StatusBox(obj_type).value() for obj_type in container_object: prov_ui_values[obj_type] = getattr(provider.summary.relationships, obj_type).value soft_assert( status_box_values[obj_type] == prov_ui_values[obj_type], '{}: Mismatch between status box ({}) value in Containers overview' 'and provider\'s relationships table ({}):'.format( obj_type, status_box_values[obj_type], prov_ui_values[obj_type]))
def test_containers_summary_objects(provider, soft_assert): """ Containers overview page > Widgets > Widgets summary This test checks that the amount of a selected object in the system is shown correctly in the widgets in the Overview menu Steps: * Goes to Compute --> Containers --> Overview * Checks how many objects are shown in the selected widget * Goes to Containers summary page and checks how many objects are shown there. * Checks the amount is equal """ navigate_to(ContainersOverview, 'All') # Collecting status boxes values: status_box_values = { obj: StatusBox(obj.PLURAL.split(' ')[-1]).value() for obj in tested_objects } # Comparing to the values in the relationships tables: for obj in tested_objects: sb_val = status_box_values[obj] ui_val = getattr(provider.summary.relationships, attributize_string(obj.PLURAL)).value soft_assert( sb_val == ui_val, '{}: Mismatch between status box ({}) value in Containers overview' 'and provider\'s relationships table ({}):'.format( obj.PLURAL, sb_val, ui_val))
def test_data_integrity_for_topology(test_data): """ This test verifies that every status box value under Containers Overview is identical to the number present on its page. """ navigate_to(ContainersOverview, 'All') # We should wait ~2 seconds for the StatusBox population # (until we find a better solution) time.sleep(2) status_box = StatusBox(test_data.name) statusbox_value = int(status_box.value()) navigate_to(test_data.object, 'All') if statusbox_value > 0: tb.select('Grid View') try: ensure_no_filter_applied() except NoSuchElementException: pass assert len(list(Quadicon.all())) == statusbox_value else: assert sel.is_displayed_text('No Records Found.')
def test_data_integrity_for_topology(test_data): """ This test verifies that every status box value under Containers Overview is identical to the number present on its page. Steps: * Go to Containers / Overview * All cells should contain the correct relevant information # of nodes # of providers # ... """ sel.force_navigate('container_dashboard') # We should wait ~2 seconds for the StatusBox population # (until we find a better solution) time.sleep(2) status_box = StatusBox(test_data.name) statusbox_value = int(status_box.value()) navigate_to(test_data.object, 'All') if statusbox_value > 0: tb.select('Grid View') assert len(map(lambda i: i, Quadicon.all())) == statusbox_value else: assert sel.is_displayed_text('No Records Found.')
def test_containers_overview_data_integrity(appliance, soft_assert): """Test data integrity of status boxes in containers dashboard. Steps: * Go to Containers / Overview * All cells should contain the correct relevant information # of nodes # of providers # ... """ navigate_to(ContainersOverview, 'All') api_values = get_api_object_counts(appliance) for cls in tested_objects: statusbox_value = StatusBox(cls.PLURAL.split(' ')[-1]).value() soft_assert( api_values[cls] == statusbox_value, 'There is a mismatch between API and UI values: {}: {} (API) != {} (UI)' .format(cls.__name__, api_values[cls], statusbox_value))
def test_containers_overview_data_integrity(provider): """Test data integrity of status boxes in containers dashboard. Steps: * Go to Containers / Overview * All cells should contain the correct relevant information # of nodes # of providers # ... """ navigate_to(ContainersOverview, 'All') # We should wait ~2 seconds for the StatusBox population # (until we find a better solution) # Since we collect images from Openshift and from the pods, # images are tested separately time.sleep(2) statusbox_values = { data_set.object: int(StatusBox(data_set.name).value()) for data_set in DATA_SETS } api_values = get_api_object_counts( list_providers_by_class(ContainersProvider)) list_img_from_registry = provider.mgmt.list_image() list_img_from_registry_splitted = [ i.id.split('@sha256:')[-1] for i in list_img_from_registry ] list_img_from_openshift = provider.mgmt.list_image_openshift() list_img_from_openshift_splitted = [ d['name'] for d in list_img_from_openshift ] list_img_from_openshift_parsed = [ i[7:].split('@sha256:')[-1] for i in list_img_from_openshift_splitted ] list_img_from_registry_splitted_new = set(list_img_from_registry_splitted) list_img_from_openshift_parsed_new = set(list_img_from_openshift_parsed) list_img_from_openshift_parsed_new.update( list_img_from_registry_splitted_new) num_img_cfme_56 = len(provider.mgmt.list_image()) num_img_cfme_57 = len(list_img_from_openshift_parsed_new) assert StatusBox('images').value() == version.pick({ version.LOWEST: num_img_cfme_56, '5.7': num_img_cfme_57 }) results = {} for cls in DATA_SETS: results[cls.object] = api_values[cls.object] == statusbox_values[ cls.object] if not all(results.values()): pytest.fail( 'There is a mismatch between API and UI values:\n{}'.format( '\n'.join([ '{}: {} (API) != {} (UI)'.format(obj.__name__, api_values[obj], statusbox_values[obj]) for obj, is_pass in results.items() if not is_pass ])))
def resetter(self): # We should wait ~2 seconds for the StatusBox population wait_for(lambda: StatusBox(ContainersProvider.PLURAL.split(' ')[-1]). value(), num_sec=10, delay=1)