def report_execution(project, suite, execution): if not user.has_permissions_to_project(g.user.id, project, root_path, 'report'): return render_template('not_permission.html') else: formatted_date = report_parser.get_date_time_from_timestamp(execution) return render_template('report/report_execution.html', project=project, suite=suite, execution=execution, formatted_date=formatted_date)
def test_case_view(project, test_case_name): # check if user has permissions for this project if not user.has_permissions_to_project(g.user.id, project, root_path, 'gui'): return render_template('not_permission.html') # check if the file is locked # is_locked_by = lock.is_file_locked(root_path, project, test_case_name) # print(is_locked_by, g.user.username) # if is_locked_by and is_locked_by != g.user.username: # abort(404, 'This file is locked by someone else.') # else: tc_name, parents = utils.separate_file_from_parents(test_case_name) path = test_case.generate_test_case_path(root_path, project, test_case_name) error = utils.validate_python_file_syntax(path) if error: return render_template('test_builder/test_case_syntax_error.html', project=project, full_test_case_name=test_case_name) else: test_case_contents = test_case.get_test_case_content(root_path, project, test_case_name) print("test_case_content=========", test_case_contents) test_data = test_data_module.get_test_data(root_path, project, test_case_name) return render_template('test_builder/test_case.html', project=project, test_case_contents=test_case_contents, test_case_name=tc_name, full_test_case_name=test_case_name, test_data=test_data)
def project_settings(project): if not user.has_permissions_to_project(g.user.id, project, root_path, 'gui'): return render_template('not_permission.html') global_settings = settings_manager.get_global_settings_as_string(root_path) project_settings = settings_manager.get_project_settings_as_string(root_path, project) return render_template('settings.html', project=project, global_settings=global_settings, settings=project_settings)
def project_apps(project): if not user.has_permissions_to_project(g.user.id, project, root_path, 'gui'): return render_template('not_permission.html') elif not utils.project_exists(root_path, project): abort(404, 'This page does not exists.') else: return render_template('project/project_apps.html', project=project)
def project_view(project): if not user.has_permissions_to_project(g.user.id, project, root_path, 'gui'): return render_template('not_permission.html') elif not utils.project_exists(root_path, project): abort(404, 'This page does not exists.') else: return redirect('/project/{}/suites/'.format(project))
def projects_view(project): if not user.has_permissions_to_project(g.user.id, project, root_path, 'gui'): return render_template('not_permission.html') elif not utils.project_exists(root_path, project): abort(404, 'This page does not exists.') else: projects = utils.get_projects(root_path) return render_template('index.html', projects=projects)
def report_test(project, suite, execution, test_case, test_set): if not user.has_permissions_to_project(g.user.id, project, root_path, 'report'): return render_template('not_permission.html') test_case_data = report_parser.get_test_case_data(root_path, project, test_case, suite=suite, execution=execution, test_set=test_set, is_single=False) return render_template('report/report_test.html', project=project, suite=suite, execution=execution, test_case=test_case, test_set=test_set, test_case_data=test_case_data)
def page_code_view(project, full_page_name, no_sidebar=False): if not user.has_permissions_to_project(g.user.id, project, root_path, 'gui'): return render_template('not_permission.html') path = page_object.generate_page_path(root_path, project, full_page_name) error = utils.validate_python_file_syntax(path) page_object_code = page_object.get_page_object_code(path) return render_template('page_builder/page_object_code.html', project=project, page_object_code=page_object_code, page_name=full_page_name, error=error, no_sidebar=no_sidebar)
def app_view(project, full_page_name, no_sidebar=False): if not user.has_permissions_to_project(g.user.id, project, root_path, 'gui'): return render_template('not_permission.html') path = page_object.generate_page_path(root_path, project, full_page_name) error = utils.validate_python_file_syntax(path) if error: return render_template('app_builder/app_syntax_error.html', project=project, app_page_name=full_page_name) else: page_data = app_object.get_app_object_content(project, full_page_name) return render_template('app_builder/app_object.html', project=project, app_object_data=page_data, app_name=full_page_name, no_sidebar=no_sidebar)
def test_case_code_view(project, test_case_name): # check if user has permissions for this project if not user.has_permissions_to_project(g.user.id, project, root_path, 'gui'): return render_template('not_permission.html') tc_name, parents = utils.separate_file_from_parents(test_case_name) path = os.path.join(root_path, 'projects', project, 'tests', os.sep.join(parents), tc_name + '.py') print("path============") print(path) test_case_contents = test_case.get_test_case_code(path) error = utils.validate_python_file_syntax(path) external_data = test_data_module.get_external_test_data(root_path, project, test_case_name) test_data_setting = test_execution.settings['test_data'] return render_template('test_builder/test_case_code.html', project=project, test_case_contents=test_case_contents, test_case_name=tc_name, full_test_case_name=test_case_name, test_data=external_data, test_data_setting=test_data_setting, error=error)
def suite_view(project, suite): if not user.has_permissions_to_project(g.user.id, project, root_path, 'gui'): return render_template('not_permission.html') all_test_cases = utils.get_test_cases(root_path, project) selected_tests = suite_module.get_suite_test_cases(root_path, project, suite) worker_amount = suite_module.get_suite_amount_of_workers(root_path, project, suite) browsers = suite_module.get_suite_browsers(root_path, project, suite) browsers = ', '.join(browsers) default_browser = test_execution.settings['default_browser'] environments = suite_module.get_suite_environments(root_path, project, suite) environments = ', '.join(environments) return render_template('suite.html', project=project, all_test_cases=all_test_cases['sub_elements'], selected_tests=selected_tests, suite=suite, worker_amount=worker_amount, browsers=browsers, default_browser=default_browser, environments=environments)
def report_dashboard_suite(project, suite): if not user.has_permissions_to_project(g.user.id, project, root_path, 'report'): return render_template('not_permission.html') else: return render_template('report/report_dashboard.html', project=project, suite=suite)
def environments_view(project): if not user.has_permissions_to_project(g.user.id, project, root_path, 'gui'): return render_template('not_permission.html') environment_data = environment_manager.get_environments_as_string(root_path, project) return render_template('environments.html', project=project, environment_data=environment_data)