def test_paginator(some_dialogs, soft_assert): """ This test tests weird behaviour of the paginator in Service dialogs. Prerequisities: * There have to be couple of service dialogs, about 16 is recommended. Steps: * Go to service dialogs page * Set the paginator to 50 results per page, then to 5 results per page. * Assert there are 5 rows displayed in the table * Then cycle through the pages. Note all the dialogs you see, in the end the list of all dialogs must contain all idalogs you created before. * During the cycling, assert the numbers displayed in the paginator make sense * During the cycling, assert the paginator does not get stuck. """ pytest.sel.force_navigate("service_dialogs") paginator.results_per_page(50) paginator.results_per_page(5) # Now we must have only 5 soft_assert(len(list(common.dialogs_table.rows())) == 5, "Changing number of rows failed!") # try to browse current_rec_offset = None dialogs_found = set() for page in paginator.pages(): if paginator.rec_offset() == current_rec_offset: soft_assert(False, "Paginator is locked, it does not advance to next page") break if current_rec_offset is None: current_rec_offset = paginator.rec_offset() for text in get_relevant_rows(common.dialogs_table): dialogs_found.add(text) current_rec_offset = paginator.rec_offset() assert set([dlg.label for dlg in some_dialogs]) <= dialogs_found, \ "Could not find all dialogs by clicking the paginator!"
def test_paginator(some_dialogs, soft_assert, appliance): """ This test tests weird behaviour of the paginator in Service dialogs. Prerequisities: * There have to be couple of service dialogs, about 16 is recommended. Steps: * Go to service dialogs page * Set the paginator to 50 results per page, then to 5 results per page. * Assert there are 5 rows displayed in the table * Then cycle through the pages. Note all the dialogs you see, in the end the list of all dialogs must contain all idalogs you created before. * During the cycling, assert the numbers displayed in the paginator make sense * During the cycling, assert the paginator does not get stuck. """ navigate_to(DialogCollection(appliance), 'All') from cfme.web_ui import paginator paginator.results_per_page(50) paginator.results_per_page(5) # Now we must have only 5 soft_assert( len(list(dialogs_table.rows())) == 5, "Changing number of rows failed!") # try to browse current_rec_offset = None dialogs_found = set() for page in paginator.pages(): if paginator.rec_offset() == current_rec_offset: soft_assert( False, "Paginator is locked, it does not advance to next page") break if current_rec_offset is None: current_rec_offset = paginator.rec_offset() for text in get_relevant_rows(dialogs_table): dialogs_found.add(text) current_total = paginator.rec_total() current_rec_offset = paginator.rec_offset() current_rec_end = paginator.rec_end() assert current_rec_offset <= current_rec_end <= current_total, \ "Incorrect paginator value, expected {0} <= {1} <= {2}".format( current_rec_offset, current_rec_end, current_total) assert {dlg.label for dlg in some_dialogs} <= dialogs_found, \ "Could not find all dialogs by clicking the paginator!"
def test_paginator(some_dialogs, soft_assert): """ This test tests weird behaviour of the paginator in Service dialogs. Prerequisities: * There have to be couple of service dialogs, about 16 is recommended. Steps: * Go to service dialogs page * Set the paginator to 50 results per page, then to 5 results per page. * Assert there are 5 rows displayed in the table * Then cycle through the pages. Note all the dialogs you see, in the end the list of all dialogs must contain all idalogs you created before. * During the cycling, assert the numbers displayed in the paginator make sense * During the cycling, assert the paginator does not get stuck. """ navigate_to(DialogCollection, 'All') from cfme.web_ui import paginator paginator.results_per_page(50) paginator.results_per_page(5) # Now we must have only 5 soft_assert(len(list(dialogs_table.rows())) == 5, "Changing number of rows failed!") # try to browse current_rec_offset = None dialogs_found = set() for page in paginator.pages(): if paginator.rec_offset() == current_rec_offset: soft_assert(False, "Paginator is locked, it does not advance to next page") break if current_rec_offset is None: current_rec_offset = paginator.rec_offset() for text in get_relevant_rows(dialogs_table): dialogs_found.add(text) current_total = paginator.rec_total() current_rec_offset = paginator.rec_offset() current_rec_end = paginator.rec_end() assert current_rec_offset <= current_rec_end <= current_total, \ "Incorrect paginator value, expected {0} <= {1} <= {2}".format( current_rec_offset, current_rec_end, current_total) assert {dlg.label for dlg in some_dialogs} <= dialogs_found, \ "Could not find all dialogs by clicking the paginator!"
def test_paginator(some_dialogs, soft_assert): """ Ths test currently fails as this thing is completely broken """ pytest.sel.force_navigate("service_dialogs") paginator.results_per_page(50) paginator.results_per_page(5) # Now we must have only 5 soft_assert(len(list(dialogs_table.rows())) == 5, "Changing number of rows failed!") # try to browse current_rec_offset = None dialogs_found = set() for page in paginator.pages(): if paginator.rec_offset() == current_rec_offset: soft_assert(False, "Paginator is locked, it does not advance to next page") break if current_rec_offset is None: current_rec_offset = paginator.rec_offset() for text in get_relevant_rows(dialogs_table): dialogs_found.add(text) current_rec_offset = paginator.rec_offset() assert set([dlg.label for dlg in some_dialogs]) <= dialogs_found, \ "Could not find all dialogs by clicking the paginator!"
def test_paginator(some_dialogs, soft_assert): """ This test tests weird behaviour of the paginator in Service dialogs. Prerequisities: * There have to be couple of service dialogs, about 16 is recommended. Steps: * Go to service dialogs page * Set the paginator to 50 results per page, then to 5 results per page. * Assert there are 5 rows displayed in the table * Then cycle through the pages. Note all the dialogs you see, in the end the list of all dialogs must contain all idalogs you created before. * During the cycling, assert the numbers displayed in the paginator make sense * During the cycling, assert the paginator does not get stuck. """ pytest.sel.force_navigate("service_dialogs") paginator.results_per_page(50) paginator.results_per_page(5) # Now we must have only 5 soft_assert( len(list(dialogs_table.rows())) == 5, "Changing number of rows failed!") # try to browse current_rec_offset = None dialogs_found = set() for page in paginator.pages(): if paginator.rec_offset() == current_rec_offset: soft_assert( False, "Paginator is locked, it does not advance to next page") break if current_rec_offset is None: current_rec_offset = paginator.rec_offset() for text in get_relevant_rows(dialogs_table): dialogs_found.add(text) current_rec_offset = paginator.rec_offset() assert set([dlg.label for dlg in some_dialogs]) <= dialogs_found, \ "Could not find all dialogs by clicking the paginator!"