Update test framework: fix run_tests.py to support all test files, add auto-import-check for test files

This commit is contained in:
qiaoxinjiu
2026-05-09 15:11:30 +08:00
parent eb053a347f
commit eaba8328da
21739 changed files with 2236758 additions and 719 deletions

View File

@@ -0,0 +1,95 @@
# -*- 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
from ui_library.logic.student.home_logic import HomeLogic
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_home_logic = HomeLogic()
obj_user_info = eval(obj_rf_config.study_user)
@allure.feature('ViSpark Study 设置页测试')
class TestSetting(object):
init_mobile_start_app = InitMobilStartApp()
poco_driver = init_mobile_start_app.poco_driver
def setup(self):
# 启动被测试应用
# self.init_mobile_start_app.launch_app()
# obj_home_logic.click_home_setting(poco=self.poco_driver)
pass
def teardown(self):
# 退出被测试应用并清理数据
pass
# self.init_mobile_start_app.quit()
# self.init_mobile_start_app.clear_app()
@allure.title("设置页修改个人信息")
def test_setting_info(self):
# with allure.step("点击昵称修改按钮"):
# obj_handle_action.click_by_poco(self.poco_driver,obj_setting_page.get_change_nickname_button())
# assert obj_handle_action.is_exists_by_poco(self.poco_driver,obj_setting_page.get_setting_student_profile_title())
#
# with allure.step("输入修改昵称"):
# ui_auto_nickname_empty = ''
# ui_auto_nickname = "UiAutoNickName"
# obj_handle_action.set_text_by_poco(self.poco_driver, obj_setting_page.get_setting_student_profile_nickname_input(),
# ui_auto_nickname)
# with allure.step("点击保存"):
# obj_handle_action.click_by_poco(self.poco_driver, obj_setting_page.get_setting_student_profile_save_button())
# assert obj_handle_action.is_exists_by_poco(self.poco_driver,
# obj_setting_page.get_setting_title())
# birth = obj_handle_action.get_text_by_poco(self.poco_driver,
# obj_setting_page.get_change_date_of_birth_button())
# print(birth)
# with allure.step("点击修改生日"):
#
# obj_handle_action.click_by_poco(self.poco_driver,
# obj_setting_page.get_change_date_of_birth_button())
# obj_handle_action.click_by_poco(self.poco_driver,
# obj_setting_page.get_setting_student_profile_calendar())
#
# if birth != "07/2022":
# obj_handle_action.swipe_by_poco(self.poco_driver, element=obj_setting_page.get_setting_calendar_year_up(), direction="up",duration=0.2)
# obj_handle_action.swipe_by_poco(self.poco_driver, element=obj_setting_page.get_setting_calendar_month_under(),
# direction="up",duration=0.2)
# else:
# obj_handle_action.swipe_by_poco(self.poco_driver, element=obj_setting_page.get_setting_calendar_year_up(), direction="down",duration=0.2)
# obj_handle_action.swipe_by_poco(self.poco_driver, element=obj_setting_page.get_setting_calendar_month_under(),
# direction="down",duration=0.2)
obj_handle_action.click_by_poco(self.poco_driver,obj_setting_page.get_setting_calendar_sure_button())
assert obj_handle_action.is_exists_by_poco(self.poco_driver,
obj_setting_page.get_setting_student_profile_title())
with allure.step("点击保存"):
obj_handle_action.click_by_poco(self.poco_driver, obj_setting_page.get_setting_student_profile_save_button())
assert obj_handle_action.is_exists_by_poco(self.poco_driver,
obj_setting_page.get_setting_title())
# birth_2 = obj_handle_action.get_text_by_poco(self.poco_driver,
# obj_setting_page.get_change_date_of_birth_button())
# print(birth_2)
# assert birth_2 != birth
# with allure.step("点击关闭个人信息页按钮"):
# obj_handle_action.click_by_poco(self.poco_driver, obj_setting_page.get_setting_student_profile_close_location())
# assert obj_handle_action.is_exists_by_poco(self.poco_driver,
# obj_setting_page.get_setting_title())