def run_detail_test(self, browser, data, temp_dir, grid_number): dashboard = DashBoardPage(browser).open() take_screenshot(browser, "dashboard") detail_tab = dashboard.select_detail_tab() take_screenshot(browser, "detail_tab_before_search_grid_" + str(grid_number)) # for transit in data.transits: # dashboard.select_transit(transit) detail_tab.search_for_book(data) take_screenshot(browser, "detail_tab_after_search_grid_" + str(grid_number)) # unpivot only for 2-nd and 3-rd grids if grid_number != 1: detail_tab.unpivot_grid(grid_number - 1) if grid_number == 1: detail_tab.download_csv_1() elif grid_number == 2: detail_tab.download_csv_2() else: detail_tab.download_csv_3() actual_file = path.realpath(path.join(temp_dir, "export.csv")) wait_until_file_exists(actual_file) self.reporter = GenericDiffReporterFactory().get_first_working() verify_file(actual_file)
def run_ntc_test(self, browser, data, temp_dir, grid_number): dashboard = DashBoardPage(browser).open() take_screenshot(browser, "dashboard") ntc_tab = dashboard.select_ntc_tab() take_screenshot(browser, "NTC_tab_before_search") ntc_tab.clear() ntc_tab.set_date(data.date) if len(data.transits) == 1 and data.transits[0] == 'all': ntc_tab.select_all_transits() else: for transit in data.transits: ntc_tab.select_transit(transit) if data.book != "": ntc_tab.select_book(data.book) if data.parallel_mode.lower() == 'true': ntc_tab.select_parallel_mode() dashboard.search_no_wait() take_screenshot(browser, "NTC_tab_after_search") ntc_tab.download_csv(grid_number) actual_file = path.realpath(path.join(temp_dir, "export.csv")) wait_until_file_exists(actual_file) self.reporter = GenericDiffReporterFactory().get_first_working() verify_file(actual_file)
def test_dashboard_3(self, temp_dir, browser): data = DataBuilder().get_default_data() data.date = "2017-03-31" data.transits = ["95307"] dashboard = DashBoardPage(browser).open() take_screenshot(browser, "dashboard") dashboard.clear() dashboard.set_date(data.date) for transit in data.transits: dashboard.select_transit(transit) dashboard.search() dashboard.download_csv_1() actual_file = path.realpath(path.join(temp_dir, "export.csv")) wait_until_file_exists(actual_file) data = "sfsdfsdf\ndfsdsdf\nsdfsdfsdfs\n" self.reporter = GenericDiffReporterFactory().get_first_working() verify(data)
def run_balance_sheet_test(self, browser, data, temp_dir): dashboard = DashBoardPage(browser).open() take_screenshot(browser, "dashboard") balance_sheet_tab = dashboard.select_balance_sheet_tab() take_screenshot(browser, "Balance_sheet_tab_before_search") balance_sheet_tab.clear() balance_sheet_tab.set_date(data.date) for transit in data.transits: balance_sheet_tab.select_transit(transit) balance_sheet_tab.select_book(data.book) if data.parallel_mode.lower() == 'true': balance_sheet_tab.select_parallel_mode() dashboard.search() take_screenshot(browser, "Balance_sheet_tab__after_search") balance_sheet_tab.unpivot_grid(1) balance_sheet_tab.download_csv_1() actual_file = path.realpath(path.join(temp_dir, "export.csv")) wait_until_file_exists(actual_file) self.reporter = GenericDiffReporterFactory().get_first_working() verify_file(actual_file)
def downloaded_file_matches(self, temp_dir, expected): actual_excel_file = path.join(temp_dir, "export.csv") wait_until_file_exists(actual_excel_file) # for dash board daysoutstanding changes each day, so we will count number of lines for now # TODO will use this method when define list of attributes to check files_match = compare_files_lines(actual_excel_file, expected) remove(actual_excel_file) return files_match
def downloaded_file_matches(self, temp_dir, expected): actual_excel_file = path.join(temp_dir, "export.csv") wait_until_file_exists(actual_excel_file) files_match = compare_files_lines(actual_excel_file, expected) if files_match: files_match = compare_attributes(actual_excel_file, expected, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 12, 13, 14, 15, 16]) remove(actual_excel_file) assert files_match
def run_management_view_test(self, browser, data, temp_dir): dashboard = DashBoardPage(browser).open() take_screenshot(browser, "dashboard") management_view_tab = dashboard.select_management_view_tab() take_screenshot(browser, "Management_View_tab_before_search") management_view_tab.set_date(data.date) management_view_tab = dashboard.select_management_view_tab() take_screenshot(browser, "Management_View_tab__after_search") management_view_tab.download_csv_1_long() actual_file = path.realpath(path.join(temp_dir, "management-report.csv")) wait_until_file_exists(actual_file) self.reporter = GenericDiffReporterFactory().get_first_working() verify_file(actual_file)
def run_position_test(self, browser, data, temp_dir, grid_number): dashboard = DashBoardPage(browser).open() take_screenshot(browser, "dashboard") position_tab = dashboard.select_position_tab() take_screenshot(browser, str(grid_number) + " grid. position_tab_before_search") position_tab.clear() position_tab.set_date(data.date) if len(data.transits) == 1 and data.transits[0] == 'all': position_tab.select_all_transits() else: for transit in data.transits: position_tab.select_transit(transit) if data.book != "": position_tab.select_book(data.book) if data.parallel_mode.lower() == 'true': position_tab.select_parallel_mode() dashboard.search_long() take_screenshot(browser, str(grid_number) + " grid. position_tab__after_search") if grid_number == 2: position_tab.load_second_grid() position_tab.unpivot_grid(grid_number) if grid_number == 1: position_tab.download_csv_1() elif grid_number == 2: position_tab.download_csv_2() actual_file = path.realpath(path.join(temp_dir, "export.csv")) wait_until_file_exists(actual_file) self.reporter = GenericDiffReporterFactory().get_first_working() verify_file(actual_file)