# -*- coding: utf-8 -*- # __author__ = 'luozhipeng' from airtest.core.api import * import allure from ui_auto_lego.common.handle_action import HandleAction from ui_auto_lego.common.handle_driver import HandleDriver from ui_library.page.student import login, home,schedule,homework,assessment,setting from ui_library.common.read_config import readconfig from ui_auto_lego.common.launch import InitMobilStartApp from ui_library.logic.student.login_logic import LoginLogic obj_handle_action = HandleAction() obj_handle_driver = HandleDriver() obj_login_page = login.Login() obj_home_page = home.Home() obj_homework_page = homework.Homework() obj_assessment_page = assessment.Assessment() obj_setting_page = setting.Setting() obj_schedule_page = schedule.Schedule() obj_rf_config = readconfig() obj_login_logic = LoginLogic() obj_user_info = eval(obj_rf_config.study_user) @allure.feature('ViSpark Study 首页测试') class TestHome(object): init_mobile_start_app = InitMobilStartApp() poco_driver = init_mobile_start_app.poco_driver def setup(self): # 启动被测试应用 # self.init_mobile_start_app.launch_app() pass def teardown(self): # 退出被测试应用并清理数据 pass # self.init_mobile_start_app.quit() # self.init_mobile_start_app.clear_app() @allure.title("首页页面跳转") def test_home_schedule(self): with allure.step("点击课后任务项"): poco = self.poco_driver obj_handle_action.click_by_poco(poco, obj_home_page.get_left_menu_homework()) assert obj_handle_action.is_exists_by_poco(poco, obj_homework_page.get_homework_course_task_container()) with allure.step("点击课表项"): obj_handle_action.click_by_poco(poco, obj_home_page.get_left_menu_schedule()) assert obj_handle_action.is_exists_by_poco(poco,obj_schedule_page.get_schedule_avatar()) with allure.step("点击我的测评项"): obj_handle_action.click_by_poco(poco, obj_home_page.get_left_menu_assessment()) assert obj_handle_action.is_exists_by_poco(poco, obj_assessment_page.get_assessment_testList()) with allure.step("点击设置按钮"): obj_handle_action.click_by_poco(poco, obj_home_page.get_left_menu_setting()) assert obj_handle_action.is_exists_by_poco(poco, obj_setting_page.get_setting_title()) obj_handle_action.click_by_poco(poco,obj_setting_page.get_setting_close_location()) with allure.step("检查菜单目录logo"): assert obj_handle_action.is_exists_by_poco(poco, obj_home_page.get_left_menu_logo()) if __name__ == '__main__': A = TestHome() A.test_home_schedule()