def contents_when_navigating_the_page_numbers(self, fixture): """When navigating the range of page links, the currently displayed contents stay unchanged.""" fixture.number_of_pages = 30 fixture.max_page_links = 5 fixture.reahl_server.set_app(fixture.wsgi_app) fixture.driver_browser.open('/') fixture.driver_browser.click(XPath.link_with_text('p2')) fixture.driver_browser.wait_for(fixture.container_contents_is, 'contents of page 2') fixture.driver_browser.click(XPath.link_starting_with_text('»')) fixture.driver_browser.wait_for(fixture.container_contents_is, 'contents of page 2')
def paging_through_data(fixture): """DataTable splits its items into different pages (between which a user can navigate), showing only the items of a particular page at a time.""" fixture.reahl_server.set_app(fixture.wsgi_app) fixture.driver_browser.open('/') #click to last page fixture.driver_browser.click(XPath.link_starting_with_text('→')) fixture.driver_browser.click(XPath.link_with_text('9')) vassert(fixture.table_number_rows() == 2) vassert(fixture.get_table_row(1) == ['25', 'D']) vassert(fixture.get_table_row(2) == ['26', 'G']) #click to page 4 fixture.driver_browser.click(XPath.link_starting_with_text('←')) fixture.driver_browser.click(XPath.link_with_text('4')) vassert(fixture.table_number_rows() == 3) vassert(fixture.get_table_row(1) == ['10', 'R']) vassert(fixture.get_table_row(2) == ['11', 'O']) vassert(fixture.get_table_row(3) == ['12', 'W'])
def which_links_display(self, fixture): """The menu displays the correct range of page links, depending on the starting page in the range, the total number of pages and the max number of links in a range""" fixture.reahl_server.set_app(fixture.wsgi_app) fixture.driver_browser.open('/') vassert( fixture.driver_browser.wait_for(fixture.page_range_links_match, fixture.visible_page_descriptions) ) if fixture.goto_last_range: fixture.driver_browser.click(XPath.link_starting_with_text('→')) vassert( fixture.driver_browser.wait_for(fixture.page_range_links_match, fixture.visible_last_page_descriptions) )
def navigating_the_page_numbers(self, fixture): """One can navigate the range of page links displayed by the PageMenu using the special links.""" fixture.number_of_pages = 30 fixture.max_page_links = 5 fixture.reahl_server.set_app(fixture.wsgi_app) fixture.driver_browser.open('/') # Case: next link fixture.driver_browser.click(XPath.link_starting_with_text('»')) vassert( fixture.driver_browser.wait_for(fixture.page_range_links_match, 'p6,p7,p8,p9,p10') ) fixture.driver_browser.click(XPath.link_starting_with_text('»')) vassert( fixture.driver_browser.wait_for(fixture.page_range_links_match, 'p11,p12,p13,p14,p15') ) # Case: prev link fixture.driver_browser.click(XPath.link_starting_with_text('«')) vassert( fixture.driver_browser.wait_for(fixture.page_range_links_match, 'p6,p7,p8,p9,p10') ) # Case: last link fixture.driver_browser.click(XPath.link_starting_with_text('→')) vassert( fixture.driver_browser.wait_for(fixture.page_range_links_match, 'p26,p27,p28,p29,p30') ) # Case: first link fixture.driver_browser.click(XPath.link_starting_with_text('←')) vassert( fixture.driver_browser.wait_for(fixture.page_range_links_match, 'p1,p2,p3,p4,p5') )
def active_state_of_next_prev_links(self, fixture): """Next and Last links are only active when not on the last range of pages, and Prev and First are similarly deactive when on the first range of pages.""" fixture.number_of_pages = 15 fixture.max_page_links = 5 fixture.reahl_server.set_app(fixture.wsgi_app) fixture.driver_browser.open('/') # Case: when you are on the left of the page range vassert( not fixture.driver_browser.is_active(XPath.link_starting_with_text('←')) ) vassert( not fixture.driver_browser.is_active(XPath.link_starting_with_text('«')) ) vassert( fixture.driver_browser.is_active(XPath.link_starting_with_text('»')) ) vassert( fixture.driver_browser.is_active(XPath.link_starting_with_text('→')) ) # Case: when you are in the middle of the page range fixture.driver_browser.click(XPath.link_starting_with_text('»')) fixture.driver_browser.wait_for_element_present(XPath.link_with_text('p6')) vassert( fixture.driver_browser.is_active(XPath.link_starting_with_text('←')) ) vassert( fixture.driver_browser.is_active(XPath.link_starting_with_text('«')) ) vassert( fixture.driver_browser.is_active(XPath.link_starting_with_text('»')) ) vassert( fixture.driver_browser.is_active(XPath.link_starting_with_text('→')) ) # Case: when you are at the end of the page range fixture.driver_browser.click(XPath.link_starting_with_text('»')) fixture.driver_browser.wait_for_element_present(XPath.link_with_text('p11')) vassert( fixture.driver_browser.is_active(XPath.link_starting_with_text('←')) ) vassert( fixture.driver_browser.is_active(XPath.link_starting_with_text('«')) ) vassert( not fixture.driver_browser.is_active(XPath.link_starting_with_text('»')) ) vassert( not fixture.driver_browser.is_active(XPath.link_starting_with_text('→')) )