def step_impl(context, content): page = WorkitemsPage(context.browser) if content == 'last': page_num = len(page.page_numbers) else: page_num = content button = page.page_button(page_num) button.click()
def step_impl(context, page_num, display, enable): page = WorkitemsPage(context.browser) page_button = page.page_button(page_num) #Displayed? if display == 'not displayed': assert page_button is None else: assert page_button.is_displayed() href = page_button.get_attribute('href') #Enabled? if enable == 'not enabled': assert href is None else: assert href is not None
def step_impl(context, from_page, to_page): page = WorkitemsPage(context.browser) if to_page == 'next': to_page = int(from_page) + 1 else: to_page = len(page.page_numbers) assert context.browser.current_url == f'{page.url}/page-{to_page}'
def step_impl(context, field, work_item): page = WorkitemsPage(context.browser) #UI details = page.section_details('Work Item Details') split_value = details[0].text.splitlines() ui_value = [f for f in split_value if f.startswith(field)] #DB query = page.work_item_db(work_item) if field == 'Type': db_value = query[0].get('Description') else: db_value = query[0].get(field) expected = f'{field}: {db_value}' assert details[0].is_displayed() assert ui_value[0] == expected, f'Expected: {expected}, Actual: {ui_value[0]}'
def step_impl(context): page = WorkitemsPage(context.browser) row_count = len(page.table_data)-1 page_count = len(page.page_numbers) if page_count > 1: assert row_count == 10, f'actual: {row_count}, expected: {10}' elif page_count == 1: assert row_count < 10, f'actual: {row_count}, expected: {10}'
def step_impl(context): page = WorkitemsPage(context.browser) expected_headers = page.expected_table_headers actual_headers = page.table_headers headers = [h for h in actual_headers if h.text in expected_headers] assert len(expected_headers) == len(headers)
def step_impl(context, icon, work_item): page = WorkitemsPage(context.browser) button = page.row_icon(work_item, icon) while button is None: page.page_button('>').click() button = page.row_icon(work_item, icon) button.click()
def step_impl(context): page = WorkitemsPage(context.browser) db_data = page.work_item_db('all') all_rows_count = len(page.table_rows)-1 while page.page_button('>') is not None: page.page_button('>').click() all_rows_count += len(page.table_rows)-1 assert all_rows_count == len(db_data), f'actual: {all_rows_count}, expected: {len(db_data)}'
def step_impl(context, field, item): page = WorkitemsPage(context.browser) #DB query = page.work_item_db(item) db_value = query[0].get(field) #UI display = page.wiid_data(item, field) while display is None: page.page_button('>').click() display = page.wiid_data(item, field) assert db_value == display.text, f'actual: {db_value}, expected: {display.text}'
def step_impl(context, content): page = WorkitemsPage(context.browser) nav_links = page.nav_links links = [l for l in nav_links if l.text == content] links[0].click()
def step_impl(context, content): page = WorkitemsPage(context.browser) breadcrumbs = page.breadcrumbs links = [l for l in breadcrumbs if l.text == content] links[0].click()
def step_impl(context, content): page = WorkitemsPage(context.browser) element = page.section_header headers = [h for h in element if h.text == content] assert len(headers) > 0 assert headers[0].is_displayed()
def step_impl(context): page = WorkitemsPage(context.browser) page_numbers = page.page_numbers assert len(page_numbers) > 0
def step_impl(context, content): page = WorkitemsPage(context.browser) icons = page.icons(content) row_count = len(page.table_data)-1 assert len(icons) == row_count
def step_impl(context, work_item): page = WorkitemsPage(context.browser) assert context.browser.current_url == f'{page.url}/{work_item}'
def step_impl(context): page = WorkitemsPage(context.browser) assert context.browser.current_url == page.url