diff --git a/zhyy/test_case/TestCase/UI自动化/gue/__init__.py b/zhyy/test_case/TestCase/UI自动化/gue/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/zhyy/test_case/TestCase/UI自动化/gue/chenjiang.py b/zhyy/test_case/TestCase/UI自动化/gue/chenjiang.py deleted file mode 100644 index 9d9116f..0000000 --- a/zhyy/test_case/TestCase/UI自动化/gue/chenjiang.py +++ /dev/null @@ -1,42 +0,0 @@ -# encoding: utf-8 -# @Time : 2023/04/19 上午8:24 -# @Author : chenjiang -# @Site : -# @File : test_chen_jiang.py - - -# def setup_module(): -# print("初始化。。。") -# -# -# def teardown_method(): -# print("清理。。。") -# -# -# class TestDemo: -# def test_case1(self): -# print("开始执行测试用例1") -# assert 1 + 1 == 2 -# -# def test_case2(self): -# print("开始执行测试用例2") -# assert 2 + 8 == 10 -# -# def test_case3(self): -# print("开始执行测试用例3") -# assert 99 + 1 == 100 - - -if __name__ == '__main__': - import time - from ui_auto_lego.common.pc_browser_launch import PcBrowserLaunch - - pc_browser_launch_obj = PcBrowserLaunch(is_head_less=False, is_maximize_window=False, - window_size=(1920, 1080)) - driver = pc_browser_launch_obj.driver_obj - - pc_browser_launch_obj.browser_quit() - - driver_obj = PcBrowserLaunch(is_head_less=False, is_maximize_window=False, - window_size=(1920, 1080)).driver_obj - pc_browser_launch_obj.browser_quit() diff --git a/zhyy/test_case/TestCase/UI自动化/gue/vispark/__init__.py b/zhyy/test_case/TestCase/UI自动化/gue/vispark/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/zhyy/test_case/TestCase/UI自动化/gue/vispark/test_page_loading.py b/zhyy/test_case/TestCase/UI自动化/gue/vispark/test_page_loading.py deleted file mode 100644 index 791dd95..0000000 --- a/zhyy/test_case/TestCase/UI自动化/gue/vispark/test_page_loading.py +++ /dev/null @@ -1,161 +0,0 @@ -# encoding: utf-8 -# @Time : 2023/04/19 上午8:24 -# @Author : chenjiang -# @Site : -# @File : test_page_loading.py -import sys -import os -import time -import allure - -sys.path.append(os.path.abspath(os.path.join(os.path.abspath(__file__), '../../../../../../../'))) - -import pytest -from ubrd.ui_library.page.gue.home_page import * -from ubrd.ui_library.logic.gue.page_view_logic import * -from ui_auto_lego.common.pc_browser_launch import PcBrowserLaunch -from ubrd.ui_library.page.gue.about_page import * -from ubrd.ui_library.page.gue.blog_page import * -from ubrd.ui_library.page.gue.faq_page import * -from ubrd.ui_library.page.gue.download_page import * -from ubrd.ui_library.page.gue.course_outline_page import * -from ubrd.ui_library.page.gue.course_detail_page import * -from ubrd.ui_library.page.gue.demo_page import * -from ubrd.ui_library.page.gue.login_page import * -from ubrd.ui_library.page.gue.leads_reserve_page import * -from ubrd.ui_library.page.gue.worksheet_page import * - -class TestPageLoading: - driver_obj = None - pc_browser_launch_obj = None - - def setup_method(self): - self.pc_browser_launch_obj = PcBrowserLaunch(launch_param=['no-sandbox'], is_head_less=True, - is_maximize_window=False, - window_size=(1920, 1080)) - self.driver_obj = self.pc_browser_launch_obj.driver_obj - - def teardown_method(self): - self.pc_browser_launch_obj.browser_quit() - - @pytest.mark.monitor - @pytest.mark.page_loading - @pytest.mark.QA_陈江 - @allure.title("首页页面加载") - def test_gue_home_page_loading_test(self): - element_tuple = SgEnglishHome.try_a_free_class_button_by_css() - common_get_url_find_element(self.driver_obj, 'https://www.sparkedu.com/en-sg', element_tuple) - - @pytest.mark.monitor - @pytest.mark.page_loading - @pytest.mark.QA_陈江 - @allure.title("关于页面加载") - def test_gue_about_page_loading_test(self): - element_tuple = AboutPage.come_work_with_us_by_link() - common_get_url_find_element(self.driver_obj, 'https://www.sparkedu.com/en-sg/about', element_tuple) - - @pytest.mark.monitor - @pytest.mark.page_loading - @pytest.mark.QA_陈江 - @allure.title("blog页面加载") - def test_gue_blog_page_loading_test(self): - element_tuple = BlogPage.read_full_post_by_css() - common_get_url_find_element(self.driver_obj, 'https://blog.sparkedu.com/home-sg/', element_tuple) - self.driver_obj.switch_to.default_content() - - @pytest.mark.monitor - @pytest.mark.page_loading - @pytest.mark.QA_陈江 - @allure.title("faq页面加载") - def test_gue_faq_page_loading_test(self): - element_tuple = FaqPage.spark_math_by_link() - common_get_url_find_element(self.driver_obj, 'https://www.sparkedu.com/en-sg/faq/questions', - element_tuple) - - @pytest.mark.monitor - @pytest.mark.page_loading - @pytest.mark.QA_陈江 - @allure.title("下载页面加载") - def test_gue_download_page_loading_test(self): - element_tuple = DownloadPage.windows_download_by_css() - common_get_url_find_element(self.driver_obj, 'https://www.sparkedu.com/en-sg/download', element_tuple) - - @pytest.mark.monitor - @pytest.mark.page_loading - @pytest.mark.QA_陈江 - @allure.title("worksheet页面加载") - def test_gue_worksheet_page_loading_test(self): - element_tuple = WorkSheetPage.worksheet_by_css() - common_get_url_find_element(self.driver_obj, 'https://worksheet.sparkedu.com/', element_tuple) - - @pytest.mark.monitor - @pytest.mark.page_loading - @pytest.mark.QA_陈江 - @allure.title("AP大纲页面加载") - def test_gue_spark_math_advanced_program_outline_page_loading_test(self): - element_tuple = CourseOutlinePage.try_a_free_class_by_css() - common_get_url_find_element(self.driver_obj, - 'https://www.sparkedu.com/en-sg/spark-math/advanced-program', element_tuple) - - @pytest.mark.monitor - @pytest.mark.page_loading - @pytest.mark.QA_陈江 - @allure.title("AP课程详情页面加载") - def test_gue_spark_math_advanced_program_detail_page_loading_test(self): - element_tuple = CourseDetailPage.subscribe_button_by_xpath() - common_get_url_find_element(self.driver_obj, 'https://www.sparkedu.com/en-sg/syllabus/K2', element_tuple) - - @pytest.mark.monitor - @pytest.mark.page_loading - @pytest.mark.QA_陈江 - @allure.title("cp大纲页面加载") - def test_gue_spark_math_competition_program_outline_page_loading_test(self): - element_tuple = CourseOutlinePage.try_a_free_class_by_css() - common_get_url_find_element(self.driver_obj, - 'https://www.sparkedu.com/en-sg/spark-math/competition-program', - element_tuple) - - @pytest.mark.monitor - @pytest.mark.page_loading - @pytest.mark.QA_陈江 - @allure.title("cp课程详情页面加载") - def test_gue_spark_math_competition_program_detail_page_loading_test(self): - element_tuple = CourseDetailPage.subscribe_button_by_xpath() - common_get_url_find_element(self.driver_obj, 'https://www.sparkedu.com/en-sg/syllabus/P3?type=cp', - element_tuple) - - @pytest.mark.monitor - @pytest.mark.page_loading - @pytest.mark.QA_陈江 - @allure.title("lingo大纲页面加载") - def test_gue_spark_math_lingo_spark_outline_page_loading_test(self): - element_tuple = CourseOutlinePage.try_a_free_class_by_css() - common_get_url_find_element(self.driver_obj, 'https://www.sparkedu.com/en-sg/lingospark', element_tuple) - - @pytest.mark.monitor - @pytest.mark.page_loading - @pytest.mark.QA_陈江 - @allure.title("game-demo页面加载") - def test_gue_demo_page_loading_test(self): - element_tuple = DemoPage.full_screen_by_css() - common_get_url_find_element(self.driver_obj, 'https://www.sparkedu.com/en-sg/game-demo/program', - element_tuple) - - @pytest.mark.monitor - @pytest.mark.page_loading - @pytest.mark.QA_陈江 - @allure.title("登录页面加载") - def test_gue_login_page_loading_test(self): - element_tuple = LoginPage.user_terms_of_services_button_by_css() - common_get_url_find_element(self.driver_obj, 'https://www.sparkedu.com/en-sg/login', element_tuple) - - @pytest.mark.monitor - @pytest.mark.page_loading - @pytest.mark.QA_陈江 - @allure.title("留资页面加载") - def test_gue_leads_reserve_page_loading_test(self): - element_tuple = LeadsReservePage.services_tip_by_id() - common_get_url_find_element(self.driver_obj, 'https://www.sparkedu.com/en-sg/leads-reserve', element_tuple) - -# if __name__ == '__main__': -# print(os.path.join(os.path.abspath('__file__'))) diff --git a/zhyy/test_case/TestCase/UI自动化/gue/vispark/test_performance_test.py b/zhyy/test_case/TestCase/UI自动化/gue/vispark/test_performance_test.py deleted file mode 100644 index 7fe9c1a..0000000 --- a/zhyy/test_case/TestCase/UI自动化/gue/vispark/test_performance_test.py +++ /dev/null @@ -1,44 +0,0 @@ -# encoding: utf-8 -# @Time : 2023/04/19 上午8:24 -# @Author : chenjiang -# @Site : -# @File : test_performance_test.py - -import pytest -import sys -import os -import datetime -import time -import unittest - -sys.path.append(os.path.abspath(os.path.join(os.path.abspath(__file__), '../../../../../../../'))) - -from ubrd.ui_library.logic.gue.page_view_logic import * -from ui_auto_lego.common.pc_browser_launch import PcBrowserLaunch - - -class TestGueFePerformanceTest(unittest.TestCase): - # 获取当前日期 - today = datetime.date.today() - # 构造时间对象 - dt = datetime.datetime.combine(today, datetime.time(hour=8)) - # 转换为时间戳 - timestamp_in_seconds = str(int(time.mktime(dt.timetuple()))) - - ua = f'user-agent="Mozilla/5.0 (iPhone; CPU iPhone OS 13_2_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.3 Mobile/15E148 Safari/604.1 {timestamp_in_seconds}"' - driver_obj = PcBrowserLaunch(launch_param=[ua, 'no-sandbox'], is_head_less=True, is_maximize_window=False, - window_size=(1920, 1080)).driver_obj - - @pytest.mark.performance - @pytest.mark.gue_fe_performance - def test_gue_fe_performance_test(self): - try: - vispark_page_loading(self.driver_obj) - self.driver_obj.quit() - except Exception as e: - self.driver_obj.quit(f"异常信息:{e}") - raise Exception(e) - print(1) - print(self.timestamp_in_seconds) - - diff --git a/zhyy/test_case/TestCase/UI自动化/parent/__init__.py b/zhyy/test_case/TestCase/UI自动化/parent/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/zhyy/test_case/TestCase/UI自动化/parent/vispark/__init__.py b/zhyy/test_case/TestCase/UI自动化/parent/vispark/__init__.py deleted file mode 100644 index aaa962e..0000000 --- a/zhyy/test_case/TestCase/UI自动化/parent/vispark/__init__.py +++ /dev/null @@ -1,8 +0,0 @@ -import os -import sys -BASIC_PATH = os.path.dirname(os.path.abspath(__file__)) -# sys.path.append(BASIC_PATH) -PROJECT_PATH = os.path.abspath(os.path.join(BASIC_PATH, '../../../../../../')) -BAS_PATH = os.path.abspath(os.path.join(BASIC_PATH, '../../../../../../{}'.format("UBRD"))) -sys.path.append(PROJECT_PATH) -sys.path.append(BAS_PATH) diff --git a/zhyy/test_case/TestCase/UI自动化/parent/vispark/cc_url_subscription.py b/zhyy/test_case/TestCase/UI自动化/parent/vispark/cc_url_subscription.py deleted file mode 100644 index 3159717..0000000 --- a/zhyy/test_case/TestCase/UI自动化/parent/vispark/cc_url_subscription.py +++ /dev/null @@ -1,78 +0,0 @@ -# -*- coding: utf-8 -*- -# __author__ = 'justinchen' - -import allure -from ui_auto_lego.common.handle_action import HandleAction -from ui_library.page.common.chrome import Chrome -from ui_library.common.read_config import readconfig -from ui_auto_lego.common.launch import InitMobilStartApp -from ui_library.logic.common.chrome_logic import ChromeLogic -from ui_library.logic.parent.vispark.cc_url_subscription_logic import CCUrlSubscriptionLogic -from ui_library.page.parent.vispark.cc_url_subscription import CCUrlSubscription, CCUrlConfirmSubscriptionPlan, CheckOut -from base_framework.public_business.CC.cc_ui_business import CcUiBUSINESS - -obj_handle_action = HandleAction() -obj_chrome_page = Chrome() -obj_rf_config = readconfig() -obj_chrome_logic = ChromeLogic() -obj_cc_url_subscription_logic = CCUrlSubscriptionLogic() -obj_cc_url_subscription_page = CCUrlSubscription() -obj_cc_url_confirm_subscription_plan_page = CCUrlConfirmSubscriptionPlan() -obj_check_out_page = CheckOut() -obj_cc_ui_business = CcUiBUSINESS() - - -@allure.feature('CC生成的url进行订阅') -class TestCCUrlSubscription(object): - pass - # init_mobile_start_app = InitMobilStartApp() - # poco_driver = init_mobile_start_app.poco_driver - # - # def setup(self): - # # 启动被测试应用 - # self.init_mobile_start_app.init_app(client_config_name='chrome_client_info', poco_driver=self.poco_driver, check_name=obj_chrome_page.accept_and_continue_by_poco()) - # obj_chrome_logic.init_chrome_browser(self.poco_driver) - # pass - # def teardown(self): - # # 退出被测试应用并清理数据 - # import time - # time.sleep(5) - # self.init_mobile_start_app.quit(client_config_name='chrome_client_info') - # self.init_mobile_start_app.clear_app(client_config_name='chrome_client_info') - - @allure.title("cc生成带档期url进行订阅") - def test_schedule_subscription(self): - sub_link_info = obj_cc_ui_business.kw_get_course_sub_link(leads_type=2) - print(sub_link_info) - # with allure.step("浏览器输入cc链接进行加载"): - # # 点击url输入框 - # obj_handle_action.click_by_poco(self.poco_driver, obj_chrome_page.search_box_text_by_poco()) - # obj_handle_action.set_text_by_poco(self.poco_driver, obj_chrome_page.url_bar_by_poco(), 'https://h5.qa.visparklearning.com/sso/redirect?mockKey=F3DF94MPXPQ4CX') - # obj_handle_action.click_by_poco(self.poco_driver, obj_chrome_page.chrome_loading_button_by_poco()) - # - # # 点击subscribe_now_by_poco - # obj_handle_action.click_by_poco(self.poco_driver, obj_cc_url_subscription_page.subscribe_now_by_poco()) - # - # # 加载后检查 - # obj_cc_url_subscription_logic.check_confirm_subscription_plan(self.poco_driver, - # schedule_time='{"3":"4:30", "4":"5:35"}', - # subscriber='+1 99***394', - # subscription_fee='S$1000', - # total_price='TotalS$1000') - # with allure.step("创建订单"): - # # 勾选协议 - # obj_handle_action.click_by_poco(self.poco_driver, - # obj_cc_url_confirm_subscription_plan_page.terms_i_agree_by_poco()) - # # 点击pay now - # obj_handle_action.click_by_poco(self.poco_driver, - # obj_cc_url_confirm_subscription_plan_page.pay_now_button_by_poco()) - # - # with allure.step("进行支付"): - # # 支付页面检查 - # - # # 选择测试支付 - # obj_handle_action.click_by_poco(self.poco_driver, - # obj_check_out_page.test_pay_by_pococo()) - # # 点击支付 - # obj_handle_action.click_by_poco(self.poco_driver, - # obj_check_out_page.pay_now_button_by_poco()) diff --git a/zhyy/test_case/TestCase/UI自动化/parent/vispark/home.py b/zhyy/test_case/TestCase/UI自动化/parent/vispark/home.py deleted file mode 100644 index 14d5f07..0000000 --- a/zhyy/test_case/TestCase/UI自动化/parent/vispark/home.py +++ /dev/null @@ -1,108 +0,0 @@ -# -*- coding: utf-8 -*- -# __author__ = 'xinjiu.qiao' - -import allure -from airtest.core.api import * -from ui_auto_lego.common import handle_driver -from ui_library.page.parent.vispark import advance_program, ap_create_class_schedule, home,confirm_subscription_plan -from ui_library.common.read_config import readconfig -from ui_library.operation.parent.vispark.handle_swipe import hd_swipe -from ui_library.logic.parent.vispark.login_logic import logic_login -from ui_auto_lego.common.handle_action import HandleAction - -handle_driver_obj = handle_driver.HandleDriver() -home_page = home.prHome() -us_ap = advance_program.adprogram() -subscribe_ap = ap_create_class_schedule.create_class_schedule() -cofirm_subscribe_ap = confirm_subscription_plan.subscribe_confirm() -obj_handle_action = HandleAction() - -rf_config = readconfig() -user_info = eval(rf_config.parent_user) -h_swipe = hd_swipe() -handle_login = logic_login() - -@allure.feature('ViSpark home') -class TestAP(object): - poco_driver = handle_login.poco_driver - - def setup(self): - # 启动被测试应用,并且进行登录到首页 - handle_login.login() - - def teardown(self): - # 退出被测试应用并清理数据 - self.init_mobile_start_app.quit() - sleep(5) - self.init_mobile_start_app.clear_app() - - @allure.story("[trial(试听课)--00*]") - @allure.title("[trial(试听课按钮功能检查)--00*]") - def test_us_ap_trial(self): - with allure.step("北美未付费用户进入ap,点击获取试听课"): - #首页进入ap - obj_handle_action.click_by_poco(self.poco_driver, home_page.home_us_ap()) - #点击试听课按钮 - obj_handle_action.click_by_poco(self.poco_driver, us_ap.book_a_free_trial_button_by_poco()) - #检查试听课页面 - assert obj_handle_action.is_exists_by_poco(poco=self.poco_driver, - ssion="Book a FREE trial with VISPARK") == True - # 点击返回 - obj_handle_action.click_by_poco(self.poco_driver, us_ap.get_trial_first_page_back_by_poco()) - - @allure.story("[Subscribe(订阅)--00*]") - @allure.title("[Subscribe(订阅按钮功能检查)--00*]") - def test_us_ap_subscribe(self): - with allure.step("北美未付费用户点击进行订阅"): - # 点击订阅按钮 - allure.attach('点击订阅界面') - obj_handle_action.click_by_poco(self.poco_driver, us_ap.subscribe_now_button_by_poco()) - # 检查订阅界面 - assert obj_handle_action.is_exists_by_poco(poco=self.poco_driver, - ssion="Select a course") == True - - @allure.story("[Subscribe(订阅)--00*]") - @allure.title("[Subscribe(订阅后选择档期功能检查)--00*]") - def test_us_ap_subscribe_schedule(self): - with allure.step("北美未付费用户点击进行订阅"): - # 点击订阅按钮 - obj_handle_action.click_by_poco(self.poco_driver, us_ap.subscribe_now_button_by_poco()) - with allure.step("然后选择K2的课程级别"): - # 选择K2 - allure.attach('点击K2的课程级别') - handle_driver_obj.touch_pos([subscribe_ap.select_level_by_air("K2")],self.poco_driver) - # 选择课程级别后,档期还未加载完成 - # 选择一个档期(为wait的档期) - allure.attach('选择一个档期') - handle_driver_obj.touch_pos([subscribe_ap.ap_select_schedule_wait_by_air()],self.poco_driver) - # 选择一个档期后,需要页面加载,然后刷新出一个另外的档期选择 - # 再次选择一个档期(为wait的档期) - allure.attach('再次选择一个档期') - handle_driver_obj.touch_pos([subscribe_ap.ap_select_schedule_wait_by_air()], self.poco_driver) - # 点击提交 - obj_handle_action.click_by_poco(self.poco_driver, subscribe_ap.ap_create_class_schedule_submit_by_poco()) - assert obj_handle_action.is_exists_by_poco(poco=self.poco_driver, - ssion="Confirm subscription plan") == True - - @allure.story("[Subscribe(订阅)--00*]") - @allure.title("[Subscribe(选择档期后进行确认,然后走支付)--00*]") - def test_us_ap_subscribe_confirm(self): - with allure.step("北美未付费用户跳转到支付页面"): - allure.attach('勾选同意协议') - obj_handle_action.click_by_poco(self.poco_driver, cofirm_subscribe_ap.get_course_subscribe_agreement_by_poco()) - allure.attach('点击立即支付') - obj_handle_action.click_by_poco(self.poco_driver, - cofirm_subscribe_ap.get_pay_now_button_agreement_by_poco()) - assert obj_handle_action.is_exists_by_poco(poco=self.poco_driver, - ssion="Checkout") == True - - def a(self): - handle_driver_obj.touch_pos([subscribe_ap.ap_select_schedule_wait_by_air()], self.poco_driver) -if __name__ == '__main__': - # TestLogin().teardown() - # TestLogin().setup() - # TestLogin().test_us_ap_trial() - # TestLogin().test_us_ap_subscribe() - # TestLogin().test_us_ap_subscribe_schedule() - TestAP().test_us_ap_subscribe_confirm() - # TestLogin().a() diff --git a/zhyy/test_case/TestCase/UI自动化/parent/vispark/login.py b/zhyy/test_case/TestCase/UI自动化/parent/vispark/login.py deleted file mode 100644 index 1d77abc..0000000 --- a/zhyy/test_case/TestCase/UI自动化/parent/vispark/login.py +++ /dev/null @@ -1,69 +0,0 @@ -# -*- coding: utf-8 -*- -# __author__ = 'xinjiu.qiao' - -import allure -from airtest.core.api import * -from ui_auto_lego.common import handle_driver -from ui_auto_lego.common.handle_action import HandleAction -from ui_library.page.parent.vispark import advance_program, home, login -from ui_library.common.read_config import readconfig -from ui_auto_lego.common.launch import InitMobilStartApp -from ui_library.operation.parent.vispark.handle_swipe import hd_swipe - -handle_driver_obj = handle_driver.HandleDriver() -login_page = login.prLogin() -obj_handle_action = HandleAction() -home_page = home.prHome() -us_ap = advance_program.adprogram() -rf_config = readconfig() -user_info = eval(rf_config.parent_user) -h_swipe = hd_swipe() - -@allure.feature('ViSpark 登录前及登录测试') -class TestLogin(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): - # 退出被测试应用并清理数据 - self.init_mobile_start_app.quit() - sleep(5) - self.init_mobile_start_app.clear_app() - - @allure.story("[login(登录)--001]") - @allure.title("[login(家长端首页进入登录验证)--001]") - def test_login_check(self): - # nickname = user_info.get("nickname") - # 步骤1(建议一个页面用一个步骤) - with allure.step("同意用户协议"): - obj_handle_action.click_by_poco(self.poco_driver, login_page.user_terms_agree_by_poco()) - with allure.step("是否进行升级,选择否"): - obj_handle_action.click_by_poco(self.poco_driver, login_page.get_no_upgrade_by_poco()) - # 步骤2(建议一个页面用一个步骤) - with allure.step("切换为密码登录,输入用户名和密码,勾选协议,并登录"): - # 切换到登录页面,点击me - obj_handle_action.click_by_poco(self.poco_driver, login_page.get_me_button_by_poco()) - # 切换为密码登录 - obj_handle_action.click_by_poco(self.poco_driver, login_page.login_via_password_by_poco()) - # 输入用户名 - allure.attach(user_info.get("username"), '用户名:') - handle_driver_obj.text_by_touch_pos([login_page.login_username_by_air()], self.poco_driver, user_info.get("username")) - # 输入密码 - allure.attach(user_info.get("password"), '密码:') - obj_handle_action.set_text_by_poco(self.poco_driver, login_page.login_password_by_poco(), user_info.get("password")) - # 勾选用户协议 - obj_handle_action.click_by_poco(self.poco_driver, login_page.get_agreement_by_poco()) - # 点击登录 - obj_handle_action.click_by_poco(self.poco_driver, login_page.get_login_button_by_poco()) - #首页进入登录时,判断登录后是否存在首页的元素信息 - assert obj_handle_action.is_exists_by_poco(poco=self.poco_driver, ssion="VISPARK Courses") == True - - # assert_equal("New Users","2","登录功能正确") - -if __name__ == '__main__': - TestLogin().test_login_check() diff --git a/zhyy/test_case/TestCase/UI自动化/parent/vispark/pcenter.py b/zhyy/test_case/TestCase/UI自动化/parent/vispark/pcenter.py deleted file mode 100644 index 1981ff7..0000000 --- a/zhyy/test_case/TestCase/UI自动化/parent/vispark/pcenter.py +++ /dev/null @@ -1,234 +0,0 @@ -# -*- coding: utf-8 -*- -# __author__ = 'xinjiu.qiao' - -import allure -from airtest.core.api import * -from ui_auto_lego.common import handle_driver -from ui_library.page.parent.vispark import login, p_center -from ui_library.common.read_config import readconfig -from ui_library.operation.parent.vispark.handle_swipe import hd_swipe -from ui_library.logic.parent.vispark.login_logic import logic_login -from ui_auto_lego.common.handle_action import HandleAction - -handle_driver_obj = handle_driver.HandleDriver() -login_page = login.prLogin() -my_lists = p_center.my_lists_or_servers() -obj_handle_action = HandleAction() - -rf_config = readconfig() -user_info = eval(rf_config.parent_user) -h_swipe = hd_swipe() -handle_login = logic_login() - - -@allure.feature('ViSpark home') -class TestPcenter(object): - poco_driver = handle_login.poco_driver - - def setup(self): - # 启动被测试应用,并且进行登录到首页 - handle_login.login() - - def teardown(self): - # 退出被测试应用并清理数据 - self.init_mobile_start_app.quit() - sleep(5) - self.init_mobile_start_app.clear_app() - - @allure.story("[my_lists(个人中心)--00*]") - @allure.title("[my_lists(检查个人中心的我的课时)--00*]") - def test_my_lists_credits(self): - with allure.step("用户进入me"): - # 用户登录后,点击me - allure.attach('点击me进入个人设置页面') - obj_handle_action.click_by_poco(self.poco_driver, login_page.get_me_button_by_poco()) - # 点击我的课时按钮 - allure.attach('点击我的课时,进入我的课时页面') - obj_handle_action.click_by_poco(self.poco_driver, my_lists.get_my_class_credit_by_poco()) - # 检查我的课时页面是否正常 - list_my = [] - for i in self.poco_driver(textMatches="My.*?"): - list_my.append(i.get_text()) - allure.attach('我的课时页面获取所有关于My*的元素text') - if "My Class Credits" in list_my: - assert True - else: - assert False, "我的课时页面获取标题失败" - # todo 检查课时是否正常 - # 点击返回 - obj_handle_action.click_by_poco(self.poco_driver, my_lists.get_back_by_poco()) - - @allure.story("[my_lists(个人中心)--00*]") - @allure.title("[my_lists(检查个人中心的我的订阅)--00*]") - def test_my_lists_subscribe(self): - # with allure.step("判断是否在me的这个界面,如果不在则点击进入"): - # if not obj_handle_action.is_exists_by_poco(poco=self.poco_driver, ssion="Spark Student"): - # obj_handle_action.click_by_poco(self.poco_driver, my_lists.get_back_by_poco()) - with allure.step("用户进入me"): - # 用户登录后,点击me - allure.attach('点击me进入个人设置页面') - obj_handle_action.click_by_poco(self.poco_driver, login_page.get_me_button_by_poco()) - # 点击我的课时按钮 - allure.attach('点击我的订阅,进入我的订阅页面') - obj_handle_action.click_by_poco(self.poco_driver, my_lists.get_subscriptions_by_poco()) - # 检查我的订阅信息页面是否正常 - list_my = [] - for i in self.poco_driver(textMatches="Subscription.*?"): - list_my.append(i.get_text()) - allure.attach('我的订阅页面获取所有关于Subscription*的元素text') - if "Subscription" in list_my: - assert True - else: - assert False, "我的订阅页面获取标题失败" - # todo 检查课时是否正常 - # 点击返回 - obj_handle_action.click_by_poco(self.poco_driver, my_lists.get_back_by_poco()) - - @allure.story("[my_lists(个人中心)--00*]") - @allure.title("[my_lists(检查个人中心的我的邮寄地址)--00*]") - def test_my_lists_deliveries(self): - # with allure.step("判断是否在me的这个界面,如果不在则点击进入"): - # if not obj_handle_action.is_exists_by_poco(poco=self.poco_driver, ssion="Spark Student"): - # obj_handle_action.click_by_poco(self.poco_driver, my_lists.get_back_by_poco()) - with allure.step("用户进入me"): - # 用户登录后,点击me - allure.attach('点击me进入个人设置页面') - obj_handle_action.click_by_poco(self.poco_driver, login_page.get_me_button_by_poco()) - # 点击我的邮寄地址按钮 - allure.attach('点击我的邮寄地址,进入我的邮寄地址页面') - obj_handle_action.click_by_poco(self.poco_driver, my_lists.get_delieveries_by_poco()) - # 检查我的邮寄地址信息页面是否正常 - list_my = [] - for i in self.poco_driver(textMatches="My.*?"): - list_my.append(i.get_text()) - allure.attach('我的邮寄地址页面获取所有关于My*的元素text') - if "My Delivery List" in list_my: - assert True - else: - assert False, "我的邮寄地址页面获取标题失败" - # todo 检查课时是否正常 - # 点击返回 - obj_handle_action.click_by_poco(self.poco_driver, my_lists.get_back_by_poco()) - - @allure.story("[my_lists(个人中心)--00*]") - @allure.title("[my_lists(检查个人中心的我的优惠劵)--00*]") - def test_my_lists_coupons(self): - # with allure.step("判断是否在me的这个界面,如果不在则点击进入"): - # if not obj_handle_action.is_exists_by_poco(poco=self.poco_driver, ssion="Spark Student"): - # obj_handle_action.click_by_poco(self.poco_driver, my_lists.get_back_by_poco()) - with allure.step("用户进入me"): - # 用户登录后,点击me - allure.attach('点击me进入个人设置页面') - obj_handle_action.click_by_poco(self.poco_driver, login_page.get_me_button_by_poco()) - # 点击我的邮寄地址按钮 - allure.attach('点击我的优惠劵,进入我的优惠劵页面') - obj_handle_action.click_by_poco(self.poco_driver, my_lists.get_coupons_by_poco()) - # 检查我的邮寄地址信息页面是否正常 - list_my = [] - for i in self.poco_driver(textMatches="My.*?"): - list_my.append(i.get_text()) - allure.attach('我的优惠劵页面获取所有关于My*的元素text') - if "My Coupons" in list_my: - assert True - else: - assert False, "我的优惠劵页面获取标题失败" - allure.attach('在我的优惠劵界面,分别点击不可用,可用,失效的优惠劵table') - obj_handle_action.click_by_poco(self.poco_driver, my_lists.get_unused_coupons_by_poco()) - #todo 需要加入不可用优惠劵的检查点 - obj_handle_action.click_by_poco(self.poco_driver, my_lists.get_used_coupons_by_poco()) - #todo 需要加入可用的优惠劵的检查点 - obj_handle_action.click_by_poco(self.poco_driver, my_lists.get_expired_coupons_by_poco()) - #todo 需要加入失效优惠劵的检查点 - # 点击返回 - obj_handle_action.click_by_poco(self.poco_driver, my_lists.get_back_by_poco()) - - @allure.story("[my_lists(个人中心)--00*]") - @allure.title("[my_lists(检查个人中心中我的服务的帮助中心)--00*]") - def test_my_servers_help(self): - # with allure.step("判断是否在me的这个界面,如果不在则点击进入"): - # if not obj_handle_action.is_exists_by_poco(poco=self.poco_driver, ssion="Spark Student"): - # obj_handle_action.click_by_poco(self.poco_driver, my_lists.get_back_by_poco()) - with allure.step("在当前页面下方,所以需要往上滑动"): - handle_driver_obj.swipe_pos([my_lists.swipe_start_by_air()],poco_driver=self.poco_driver,vector=[0.0181, -0.3073]) - with allure.step("用户进入me"): - # 用户登录后,点击me - allure.attach('点击me进入个人设置页面') - obj_handle_action.click_by_poco(self.poco_driver, login_page.get_me_button_by_poco()) - # 点击我的帮助中心按钮 - allure.attach('点击我的帮助中心,进入帮助中心页面') - obj_handle_action.click_by_poco(self.poco_driver, my_lists.get_help_center_by_poco()) - # 检查我的帮助中心信息页面是否正常 - list_my = [] - for i in self.poco_driver(textMatches="VISPARK.*?"): - list_my.append(i.get_text()) - allure.attach('我的帮助中心页面获取所有关于VISPARK*的元素text') - if "VISPARK-April" in list_my: - assert True - else: - assert False, "我的帮助中心页面获取标题失败" - # 点击返回 - obj_handle_action.click_by_poco(self.poco_driver, my_lists.get_close_help_center_by_poco()) - - @allure.story("[my_lists(个人中心)--00*]") - @allure.title("[my_lists(检查个人中心中我的服务的意见反馈)--00*]") - def test_my_servers_feedback(self): - # with allure.step("判断是否在me的这个界面,如果不在则点击进入"): - # if not obj_handle_action.is_exists_by_poco(poco=self.poco_driver, ssion="Spark Student"): - # obj_handle_action.click_by_poco(self.poco_driver, my_lists.get_back_by_poco()) - with allure.step("在当前页面下方,所以需要往上滑动"): - handle_driver_obj.swipe_pos([my_lists.swipe_start_by_air()], poco_driver=self.poco_driver, - vector=[0.0181, -0.3073]) - with allure.step("用户进入me"): - # 用户登录后,点击me - allure.attach('点击me进入个人设置页面') - obj_handle_action.click_by_poco(self.poco_driver, login_page.get_me_button_by_poco()) - # 点击我的意见反馈按钮 - allure.attach('点击我的意见反馈,进入意见反馈的页面') - obj_handle_action.click_by_poco(self.poco_driver, my_lists.get_feedback_by_poco()) - # 检查我的意见反馈信息页面是否正常 - list_my = [] - for i in self.poco_driver(textMatches="History.*?"): - list_my.append(i.get_text()) - allure.attach('我的意见反馈页面获取所有关于History*的元素text') - if "History" in list_my: - assert True - else: - assert False, "我的意见反馈页面获取标题失败" - # 提交意见反馈 - allure.attach('意见反馈进行提交-1.选择表扬') - obj_handle_action.click_by_poco(self.poco_driver, my_lists.get_feedback_compliment_by_poco()) - allure.attach('意见反馈进行提交-2.录入反馈信息') - obj_handle_action.set_text_by_poco(self.poco_driver, my_lists.get_feedback_detail_by_poco(), - "auto-feedback") - allure.attach('意见反馈进行提交-3.进行提交') - obj_handle_action.click_by_poco(self.poco_driver, my_lists.get_feedback_submit_by_poco()) - allure.attach('意见反馈提交成功后-4.点击确定') - obj_handle_action.click_by_poco(self.poco_driver, my_lists.get_feedback_ok_by_poco()) - # 提交成功后,需要返回到上级页面,无返回按钮,只能右滑进行返回 - handle_driver_obj.swipe_pos([my_lists.swipe_feedback_right_by_air()], poco_driver=self.poco_driver, - vector=[0.8162, 0.068]) - # 点击History,检查刚刚新增的数据是否存在 - allure.attach('意见反馈提交成功后-5.查看历史记录,检查刚刚数据是否存在') - time.sleep(2) - obj_handle_action.click_by_poco(self.poco_driver, my_lists.get_feedback_history_by_poco()) - list_feedback_history = [] - for i in self.poco_driver(textMatches="auto-feedback.*?"): - list_feedback_history.append(i.get_text()) - allure.attach('我的意见反馈页面获取所有关于History*的元素text') - if "auto-feedback" in list_feedback_history: - assert True - else: - assert False, "我的意见反馈页面未查询到相应新增数据失败" - # 点击返回 - obj_handle_action.click_by_poco(self.poco_driver, my_lists.get_back_feedback_by_poco()) - obj_handle_action.click_by_poco(self.poco_driver, my_lists.get_back_feedback_by_poco()) - - -if __name__ == '__main__': - # TestLogin().teardown() - # TestLogin().setup() - # TestLogin().test_us_ap_trial() - # TestLogin().test_us_ap_subscribe() - # TestLogin().test_us_ap_subscribe_schedule() - TestPcenter().test_my_servers_feedback() - diff --git a/zhyy/test_case/TestCase/UI自动化/parent/vispark/test.py b/zhyy/test_case/TestCase/UI自动化/parent/vispark/test.py deleted file mode 100644 index 05f5f74..0000000 --- a/zhyy/test_case/TestCase/UI自动化/parent/vispark/test.py +++ /dev/null @@ -1,35 +0,0 @@ -# -*- coding: utf-8 -*- -# __author__ = 'xinjiu.qiao' - -import allure - -@allure.feature('ViSpark 登录前及登录测试') -class TestLogin(object): - - @allure.story("[login(登录)--001]") - @allure.title("[login(家长端首页进入登录验证)--001]") - def test_login_case(self): - # nickname = user_info.get("nickname") - # 步骤1(建议一个页面用一个步骤) - print("第一步") - assert 1==1 - print("第二把") - - @allure.story("[login(登录)--003]") - @allure.title("[login(家长端首页进入登录验证)--003]") - def test_login_case2(self): - # nickname = user_info.get("nickname") - # 步骤1(建议一个页面用一个步骤) - print("第3步") - allure.description("这是一条失败的用例") - assert 1 == 2 - - - @allure.story("[login(登录)--005]") - @allure.title("[login(家长端首页进入登录验证)--005]") - def test_login_case3(self): - # nickname = user_info.get("nickname") - # 步骤1(建议一个页面用一个步骤) - print("第5步") - assert 1 == 1 - print("第6把") \ No newline at end of file diff --git a/zhyy/test_case/TestCase/UI自动化/parent/vispark/test1.py b/zhyy/test_case/TestCase/UI自动化/parent/vispark/test1.py deleted file mode 100644 index a6b52be..0000000 --- a/zhyy/test_case/TestCase/UI自动化/parent/vispark/test1.py +++ /dev/null @@ -1,35 +0,0 @@ -# -*- coding: utf-8 -*- -# __author__ = 'xinjiu.qiao' - -import allure - -@allure.feature('ViSpark 登录前及登录测试') -class TestLogin(object): - - @allure.story("[login(登录)--006]") - @allure.title("[login(家长端首页进入登录验证)--006]") - def test_login_case4(self): - # nickname = user_info.get("nickname") - # 步骤1(建议一个页面用一个步骤) - print("第一步") - assert 1==1 - print("第二把") - - @allure.story("[login(登录)--007]") - @allure.title("[login(家长端首页进入登录验证)--007]") - def test_login_case5(self): - # nickname = user_info.get("nickname") - # 步骤1(建议一个页面用一个步骤) - print("第3步") - assert 1 == 1 - print("第4把") - - @allure.story("[login(登录)--008]") - @allure.title("[login(家长端首页进入登录验证)--008]") - def test_login_case6(self): - # nickname = user_info.get("nickname") - # 步骤1(建议一个页面用一个步骤) - print("第5步") - assert 1 == 1 - print("第6把") - allure.description("成功的用例") \ No newline at end of file diff --git a/zhyy/test_case/TestCase/UI自动化/student/__init__.py b/zhyy/test_case/TestCase/UI自动化/student/__init__.py deleted file mode 100644 index aaa962e..0000000 --- a/zhyy/test_case/TestCase/UI自动化/student/__init__.py +++ /dev/null @@ -1,8 +0,0 @@ -import os -import sys -BASIC_PATH = os.path.dirname(os.path.abspath(__file__)) -# sys.path.append(BASIC_PATH) -PROJECT_PATH = os.path.abspath(os.path.join(BASIC_PATH, '../../../../../../')) -BAS_PATH = os.path.abspath(os.path.join(BASIC_PATH, '../../../../../../{}'.format("UBRD"))) -sys.path.append(PROJECT_PATH) -sys.path.append(BAS_PATH) diff --git a/zhyy/test_case/TestCase/UI自动化/student/huohua/Android/login.ts b/zhyy/test_case/TestCase/UI自动化/student/huohua/Android/login.ts deleted file mode 100644 index fee6c80..0000000 --- a/zhyy/test_case/TestCase/UI自动化/student/huohua/Android/login.ts +++ /dev/null @@ -1,123 +0,0 @@ -import { AndroidAgent, AndroidDevice, getConnectedDevices } from '@midscene/android'; -import * as dotenv from 'dotenv'; -import { expect } from 'vitest'; -import { execSync } from 'child_process'; - -// 加载环境变量 -dotenv.config(); - -// 设置环境变量 -process.env.OPENAI_API_KEY = "fd86bcee-d77a-4299-b4c5-6f2c5c204d9c"; -process.env.MIDSCENE_MODEL_NAME = "doubao-1.5-ui-tars-250328"; -process.env.MIDSCENE_USE_VLM_UI_TARS = "DOUBAO"; -process.env.OPENAI_BASE_URL = "https://ark.cn-beijing.volces.com/api/v3"; - -const sleep = (ms: number): Promise => new Promise((r) => setTimeout(r, ms)); - -async function main() { - console.log('Starting test...'); - try { - console.log('Getting connected devices...'); - const devices = await getConnectedDevices(); - console.log('Found devices:', devices); - - const page = new AndroidDevice(devices[0].udid); - console.log('Created AndroidDevice instance'); - - // 👀 初始化 Midscene agent - console.log('Initializing AndroidAgent...'); - const agent = new AndroidAgent(page, { - aiActionContext: - '如果出现位置、权限、用户协议等弹窗,点击同意。如果出现登录页面,关闭它。' - }); - console.log('AndroidAgent initialized'); - - console.log('Connecting to device...'); - await page.connect(); - console.log('Connected to device'); - - // 强制设置横屏 - console.log('Setting landscape orientation...'); - try { - execSync(`adb -s ${devices[0].udid} shell settings put system accelerometer_rotation 0`); - execSync(`adb -s ${devices[0].udid} shell settings put system user_rotation 1`); - await sleep(2000); - - // 检查屏幕方向 - const orientation = execSync(`adb -s ${devices[0].udid} shell dumpsys input | grep 'SurfaceOrientation'`).toString(); - console.log('Current orientation:', orientation); - - if (!orientation.includes('SurfaceOrientation: 1')) { - console.log('Retrying to set landscape orientation...'); - execSync(`adb -s ${devices[0].udid} shell settings put system user_rotation 1`); - await sleep(3000); - } - } catch (error) { - console.error('Error setting orientation:', error); - } - - // 先强制停止应用,清除缓存 - console.log('Force stopping app...'); - - try { - // 使用adb命令停止应用 - console.log('Stopping app...'); - execSync(`adb -s ${devices[0].udid} shell am force-stop cn.huohua.edustudent`); - await sleep(2000); - - // 使用adb命令清除应用数据 - console.log('Clearing app data...'); - execSync(`adb -s ${devices[0].udid} shell pm clear cn.huohua.edustudent`); - await sleep(2000); - - console.log('App stopped and cleared'); - } catch (error) { - console.error('Error executing commands:', error); - } - - // 启动应用到指定页面 - console.log('Launching app...'); - try { - console.log('Attempting to launch app using aiAction...'); - await agent.aiAction('启动火花思维学生端app'); - console.log('aiAction completed successfully'); - await sleep(5000); // 增加等待时间,确保应用完全启动 - - // 处理权限和协议弹窗 - await agent.aiAction('我在一个横屏显示的用户协议弹窗中。这个弹窗有一个标题"用户注册协议与隐私政策",在弹窗底部有两个按钮。右边的按钮是"同意并使用",它是一个蓝色的TextView按钮,resource-id是"cn.huohua.edustudent:id/btn_yes"。请点击这个"同意并使用"按钮。注意:屏幕是横向旋转的。'); - await sleep(5000); - - // 切换到密码登录 - await agent.aiAction('在屏幕上查找"密码登录"标签或按钮,通常在登录界面顶部。点击它切换到密码登录模式。'); - await sleep(2000); - - // 输入手机号 - await agent.aiAction('在屏幕上查找手机号输入框,它通常显示"请输入手机号"的提示文字。点击输入框,然后输入: 18202810506'); - await sleep(2000); - - // 输入密码 - await agent.aiAction('在屏幕上查找密码输入框,它通常显示"请输入密码"的提示文字。点击输入框,然后输入: A123456'); - await sleep(2000); - - // 勾选协议 - await agent.aiAction('在屏幕底部查找用户协议勾选框,它通常是一个小方框,旁边有"我已阅读并同意"的文字。如果没有被勾选,点击它来勾选。'); - await sleep(2000); - - // 点击登录 - await agent.aiAction('在屏幕上查找"登录"或"立即登录"按钮,它通常是一个醒目的大按钮,位于输入框下方。点击这个按钮。'); - await sleep(2000); - - } catch (error) { - console.error('Error during app launch:', error); - throw error; - } - console.log('App launched'); - - } catch (error) { - console.error('Error occurred:', error); - throw error; - } -} - -// 运行主函数 -main().catch(console.error); \ No newline at end of file diff --git a/zhyy/test_case/TestCase/UI自动化/student/huohua/PC/__init__.py b/zhyy/test_case/TestCase/UI自动化/student/huohua/PC/__init__.py deleted file mode 100644 index 9dad97f..0000000 --- a/zhyy/test_case/TestCase/UI自动化/student/huohua/PC/__init__.py +++ /dev/null @@ -1,4 +0,0 @@ -# -*- coding:utf-8 -*- -# @Time : 2023/7/7 13:37 -# @Author: luozhipeng -# @File : __init__.py.py diff --git a/zhyy/test_case/TestCase/UI自动化/student/huohua/PC/test_huohua_student_login.py b/zhyy/test_case/TestCase/UI自动化/student/huohua/PC/test_huohua_student_login.py deleted file mode 100644 index bcbf1c9..0000000 --- a/zhyy/test_case/TestCase/UI自动化/student/huohua/PC/test_huohua_student_login.py +++ /dev/null @@ -1,228 +0,0 @@ -# -*- coding:utf-8 -*- -from airtest.core.api import * -import allure -import sys -LOCAL_PATH = os.path.dirname(os.path.abspath(__file__)) -BASE_PROJECT_PATH = os.path.abspath(os.path.join(LOCAL_PATH, '../../../../../../../{}'.format("UBRD"))) -BASIC_PATH = os.path.abspath(os.path.join(LOCAL_PATH, '../../../../../../../')) -sys.path.append(BASE_PROJECT_PATH) -sys.path.append(BASIC_PATH) -from ui_library.page.student.huohua.PC.view.view import View -from ui_library.page.student.huohua.PC.home.huohua_pc_home import HuohuaPCHome -from ui_library.page.student.huohua.PC.login.huohua_pc_login import HuohuaPCLogin -from library.CommonFun.host_update import HostUpdate,CoreApollo -from base_framework.public_tools.edu_user_helper import EDUUserHelper -from ui_library.page.student.huohua.PC.classroom.huohua_pc_classroom import HuohuaPCClassroom -import subprocess -import logging -import shutil - -logger = logging.getLogger("airtest") -logger.setLevel(logging.ERROR) -host_update = HostUpdate() -obj_edu_user_helper = EDUUserHelper() -obj_core_apollo = CoreApollo() - - -@allure.feature('Huohua Student') -class TestHuohuaStudentLogin: - - def setup(self): - self.host_list = [] - file_path = r"C:\Users\Administrator\AppData\Roaming\peppa-app-pc-student-sim\db.json" - source_file = r"C:\Users\Administrator\AppData\Roaming\st-huohua\db.json" - if os.path.isfile(file_path): - os.remove(file_path) - shutil.copy(source_file, file_path) - subprocess.Popen(['C:\\Users\\Administrator\\AppData\\Local\\Programs\\peppa-app-pc-student-sim\\火花思维 - SIM版.exe']) - sleep(15) - auto_setup(__file__, logdir=True, devices=["Windows:///?title_re=.*火花思维学生端*"]) - defalut_status = HuohuaPCHome().get_defalut_status() - if not defalut_status : - HuohuaPCHome().login_out() - - def teardown(self): - # 清理域名屏蔽和指向 - for i in self.host_list: - host_update.host_remove_intercept(i["ip"],i["host_name"]) - os.system("ipconfig /flushdns") - subprocess.call(['taskkill', '/F', '/IM', '火花思维 - SIM版.exe']) - - - @allure.title("[国内学生端PC前端登录域名降级--001]") - def test_student_login_by_pwd_low_fe(self): - auto_setup(__file__, logdir=True, devices=["Windows:///?title_re=.*火花思维学生端*"]) - with allure.step("清理客户端缓存"): - file_path = r"C:\Users\Administrator\AppData\Roaming\peppa-app-pc-student-sim\kmm_cache_db.json" - if os.path.isfile(file_path): - os.remove(file_path) - # with allure.step("点击用户默认头像"): - # HuohuaPCHome().click_defult_avatar() - with allure.step("清除前端缓存"): - View().input_console_command("window.localStorage.removeItem{(}'POP_STORAGE_TYPE'{)}") - with allure.step("点击通过密码登录"): - HuohuaPCLogin().click_by_pwd() - with allure.step("输入手机号"): - HuohuaPCLogin().input_phone("12345678001") - with allure.step("点击同意协议"): - HuohuaPCLogin().click_agree_label() - with allure.step("输入密码"): - HuohuaPCLogin().input_pwd("123456") - with allure.step("点击登录按钮"): - HuohuaPCLogin().click_login_button() - sleep(25) - #with allure.step("校验网络异常"): - # HuohuaPCLogin().assert_login_network_error() - with allure.step("点击登录按钮"): - default_status = HuohuaPCLogin().get_login_button() - if default_status: - HuohuaPCLogin().click_login_button() - sleep(25) - else: - print("已经登录进去了") - #with allure.step("校验网络异常"): - # HuohuaPCLogin().assert_login_network_error() - with allure.step("点击登录按钮"): - default_status = HuohuaPCLogin().get_login_button() - if default_status: - HuohuaPCLogin().click_login_button() - else: - print("已经登录进去了") - - @allure.title("[国内学生端PC前端腾讯验证码降级--002]") - def test_student_login_by_pwd_low_ten(self): - with allure.step("添加验证码域名屏蔽并清理客户端缓存"): - self.host_list = [{"ip": "0.0.0.0", "host_name": "turing.captcha.qcloud.com"}] - host_update.host_update_by_host_dict(self.host_list) - host_update.wait_dns_flush(ip="0.0.0.0" ,domain= "turing.captcha.qcloud.com") - file_path = r"C:\Users\Administrator\AppData\Roaming\peppa-app-pc-student-sim\kmm_cache_db.json" - if os.path.isfile(file_path): - os.remove(file_path) - subprocess.call(['taskkill', '/F', '/IM', '火花思维 - SIM版.exe']) - subprocess.Popen( - ['C:\\Users\\Administrator\\AppData\\Local\\Programs\\peppa-app-pc-student-sim\\火花思维 - SIM版.exe']) - sleep(15) - auto_setup(__file__, logdir=True, devices=["Windows:///?title_re=.*火花思维学生端*"]) - defalut_status = HuohuaPCHome().get_defalut_status() - if not defalut_status: - HuohuaPCHome().login_out() - with allure.step("输入手机号"): - HuohuaPCLogin().input_phone("13460219197") - with allure.step("点击同意协议"): - HuohuaPCLogin().click_agree_label() - with allure.step("点击获取验证码"): - HuohuaPCLogin().click_get_code() - with allure.step("确认存在图形验证码的验证按钮"): - HuohuaPCLogin().assert_login_low_button() - - @allure.title("[国内学生端PC前端腾讯验证码正常弹出--003]") - def test_student_login_by_pwd_ten(self): - with allure.step("清除客户端缓存"): - file_path = r"C:\Users\Administrator\AppData\Roaming\peppa-app-pc-student-sim\kmm_cache_db.json" - if os.path.isfile(file_path): - os.remove(file_path) - subprocess.call(['taskkill', '/F', '/IM', '火花思维 - SIM版.exe']) - subprocess.Popen( - ['C:\\Users\\Administrator\\AppData\\Local\\Programs\\peppa-app-pc-student-sim\\火花思维 - SIM版.exe']) - sleep(15) - auto_setup(__file__, logdir=True, devices=["Windows:///?title_re=.*火花思维学生端*"]) - with allure.step("点击用户默认头像"): - HuohuaPCHome().click_defult_avatar() - with allure.step("输入手机号"): - HuohuaPCLogin().input_phone("13460219197") - with allure.step("点击同意协议"): - HuohuaPCLogin().click_agree_label() - with allure.step("点击获取验证码"): - HuohuaPCLogin().click_get_code() - with allure.step("确认存在腾讯验证码的滑动按钮"): - HuohuaPCLogin().assert_login_tencent_image() - - @allure.title("[国内学生端PC磐石登录成功--004]") - def test_student_login_by_pwd_normal(self): - with allure.step("清除客户端缓存"): - file_path = r"C:\Users\Administrator\AppData\Roaming\peppa-app-pc-student-sim\kmm_cache_db.json" - if os.path.isfile(file_path): - os.remove(file_path) - subprocess.call(['taskkill', '/F', '/IM', '火花思维 - SIM版.exe']) - subprocess.Popen( - ['C:\\Users\\Administrator\\AppData\\Local\\Programs\\peppa-app-pc-student-sim\\火花思维 - SIM版.exe']) - sleep(15) - auto_setup(__file__, logdir=True, devices=["Windows:///?title_re=.*火花思维学生端*"]) - with allure.step("清除前端缓存"): - View().input_console_command("window.localStorage.removeItem{(}'POP_STORAGE_TYPE'{)}") - with allure.step("点击用户默认头像"): - HuohuaPCHome().click_defult_avatar() - with allure.step("点击通过密码登录"): - HuohuaPCLogin().click_by_pwd() - with allure.step("输入手机号"): - HuohuaPCLogin().input_phone("13460219197") - with allure.step("点击同意协议"): - HuohuaPCLogin().click_agree_label() - with allure.step("输入密码"): - HuohuaPCLogin().input_pwd("123456") - with allure.step("点击登录按钮"): - HuohuaPCLogin().click_login_button() - sleep(20) - with allure.step("确认登录成功"): - HuohuaPCHome().assert_discover_button() - - - @allure.title("[国内学生端PCcheck备份域名强制登录进入课堂上课--005]") - def test_student_login_by_check(self): - with allure.step("添加域名重定向"): - self.host_list = [{"ip": "127.0.0.1", "host_name": "core-api.sim.huohua.cn"}] - host_update.host_update_by_host_dict(self.host_list) - host_update.wait_dns_flush(ip="127.0.0.1" ,domain= "core-api.sim.huohua.cn") - file_path = r"C:\Users\Administrator\AppData\Roaming\peppa-app-pc-student-sim\kmm_cache_db.json" - if os.path.isfile(file_path): - os.remove(file_path) - subprocess.call(['taskkill', '/F', '/IM', '火花思维 - SIM版.exe']) - subprocess.Popen( - ['C:\\Users\\Administrator\\AppData\\Local\\Programs\\peppa-app-pc-student-sim\\火花思维 - SIM版.exe']) - sleep(15) - auto_setup(__file__, logdir=True, devices=["Windows:///?title_re=.*火花思维学生端*"]) - defalut_status = HuohuaPCHome().get_defalut_status() - if not defalut_status: - HuohuaPCHome().login_out() - with allure.step("清除前端缓存"): - View().input_console_command("window.localStorage.removeItem{(}'POP_STORAGE_TYPE'{)}") - sleep(2) - with allure.step("输入手机号"): - HuohuaPCLogin().input_phone("15890630602") - with allure.step("点击同意协议"): - HuohuaPCLogin().click_agree_label() - with allure.step("点击获取验证码按钮"): - HuohuaPCLogin().click_get_code() - with allure.step("确认存在验证码提示"): - HuohuaPCLogin().assert_login_force_code_image() - sleep(2) - with allure.step("点击通过密码登录"): - HuohuaPCLogin().click_by_pwd() - with allure.step("输入手机号"): - HuohuaPCLogin().input_phone("15890630602") - with allure.step("输入密码"): - HuohuaPCLogin().input_pwd("123456") - # with allure.step("点击登录按钮"): - # HuohuaPCLogin().click_login_button() - # with allure.step("确认存在密码异常提示"): - # HuohuaPCLogin().assert_login_force_pwd_image() - # sleep(2) - sleep(2) - with allure.step("点击通过验证登录"): - HuohuaPCLogin().click_by_code() - with allure.step("输入验证码"): - HuohuaPCLogin().input_code("8888") - with allure.step("点击登录按钮"): - HuohuaPCLogin().click_login_button() - sleep(5) - with allure.step("点击进入课堂按钮"): - HuohuaPCHome().click_enter_classroom() - sleep(120) - with allure.step("成功进入课堂"): - HuohuaPCClassroom.check_classroom_icon() - - - -if __name__ == '__main__': - - TestHuohuaStudentLogin().test_student_login_by_pwd_low_ten() \ No newline at end of file diff --git a/zhyy/test_case/TestCase/UI自动化/student/huohua/PC/test_huohua_student_login_online.py b/zhyy/test_case/TestCase/UI自动化/student/huohua/PC/test_huohua_student_login_online.py deleted file mode 100644 index 2d6a2fa..0000000 --- a/zhyy/test_case/TestCase/UI自动化/student/huohua/PC/test_huohua_student_login_online.py +++ /dev/null @@ -1,231 +0,0 @@ -# -*- coding:utf-8 -*- -from airtest.core.api import * -import allure -import sys -LOCAL_PATH = os.path.dirname(os.path.abspath(__file__)) -BASE_PROJECT_PATH = os.path.abspath(os.path.join(LOCAL_PATH, '../../../../../../../{}'.format("UBRD"))) -BASIC_PATH = os.path.abspath(os.path.join(LOCAL_PATH, '../../../../../../../')) -sys.path.append(BASE_PROJECT_PATH) -sys.path.append(BASIC_PATH) -from ui_library.page.student.huohua.PC.view.view import View -from ui_library.page.student.huohua.PC.home.huohua_pc_home import HuohuaPCHome -from ui_library.page.student.huohua.PC.login.huohua_pc_login import HuohuaPCLogin -from library.CommonFun.host_update import HostUpdate,CoreApollo -from base_framework.public_tools.edu_user_helper import EDUUserHelper -from ui_library.page.student.huohua.PC.classroom.huohua_pc_classroom import HuohuaPCClassroom -import subprocess -import logging -import shutil - -logger = logging.getLogger("airtest") -logger.setLevel(logging.ERROR) -host_update = HostUpdate() -obj_edu_user_helper = EDUUserHelper() -obj_core_apollo = CoreApollo() - -import time - -def assert_with_retry(assertion_func, retries=5, delay=1): - found = False - for i in range(retries): - try: - assertion_func() - found = True - return # If the assertion_func() call doesn't raise an exception, exit the function - except AssertionError: - if i < retries - 1: # If this isn't the last retry - time.sleep(delay) # Wait for a while before retrying - if not found: - raise Exception("Network error message not found after n attempts") - -@allure.feature('Huohua Student Online') -class TestHuohuaStudentLogin: - - def setup(self): - self.host_list = [] - file_path = r"C:\Users\Administrator\AppData\Roaming\huohua-learner-client\db.json" - source_file = r"C:\Users\Administrator\AppData\Roaming\on_huohua\db.json" - if os.path.isfile(file_path): - os.remove(file_path) - shutil.copy(source_file, file_path) - subprocess.Popen(['C:\\Users\\Administrator\\AppData\\Local\\Programs\\huohua-learner-client\\火花思维.exe']) - sleep(15) - auto_setup(__file__, logdir=True, devices=["Windows:///?title_re=.*火花思维学生端*"]) - defalut_status = HuohuaPCHome().get_defalut_status() - if not defalut_status : - HuohuaPCHome().login_out() - - def teardown(self): - # 清理域名屏蔽和指向 - for i in self.host_list: - host_update.host_remove_intercept(i["ip"],i["host_name"]) - os.system("ipconfig /flushdns") - subprocess.call(['taskkill', '/F', '/IM', '火花思维.exe']) - - - @allure.title("[国内学生端PC前端登录域名降级--001]") - def test_student_login_by_pwd_low_fe(self): - auto_setup(__file__, logdir=True, devices=["Windows:///?title_re=.*火花思维学生端*"]) - with allure.step("清理客户端缓存"): - file_path = r"C:\Users\Administrator\AppData\Roaming\huohua-learner-client\kmm_cache_db.json" - if os.path.isfile(file_path): - os.remove(file_path) - #with allure.step("点击用户默认头像"): - # HuohuaPCHome().click_defult_avatar() - with allure.step("清除前端缓存 域名重新轮询"): - View().input_console_command("window.localStorage.removeItem{(}'POP_STORAGE_TYPE'{)}") - with allure.step("点击通过密码登录"): - HuohuaPCLogin().click_by_pwd() - with allure.step("输入手机号"): - HuohuaPCLogin().input_phone("12345678001") - with allure.step("点击同意协议"): - HuohuaPCLogin().click_agree_label() - with allure.step("输入密码"): - HuohuaPCLogin().input_pwd("123456") - sleep(2) - with allure.step("第一次点击登录按钮"): - HuohuaPCLogin().click_login_button() - sleep(5) - with allure.step("第二次点击登录按钮"): - HuohuaPCLogin().get_login_button() - sleep(10) - with allure.step("第三次点击登录按钮"): - HuohuaPCLogin().get_login_button() - sleep(10) - with allure.step("第四次点击登录按钮"): - default_status = HuohuaPCLogin().get_login_button() - if default_status: - HuohuaPCLogin().click_login_button() - sleep(10) - else: - print("已经登录进去了") - - @allure.title("[国内学生端PC前端腾讯验证码降级--002]") - def test_student_login_by_pwd_low_ten(self): - with allure.step("添加验证码域名屏蔽并清理客户端缓存"): - self.host_list = [{"ip": "0.0.0.0", "host_name": "turing.captcha.qcloud.com"}] - host_update.host_update_by_host_dict(self.host_list) - host_update.wait_dns_flush(ip="0.0.0.0" ,domain= "turing.captcha.qcloud.com") - file_path = r"C:\Users\Administrator\AppData\Roaming\huohua-learner-client\kmm_cache_db.json" - if os.path.isfile(file_path): - os.remove(file_path) - subprocess.call(['taskkill', '/F', '/IM', '火花思维.exe']) - subprocess.Popen( - ['C:\\Users\\Administrator\\AppData\\Local\\Programs\\huohua-learner-client\\火花思维.exe']) - sleep(10) - auto_setup(__file__, logdir=True, devices=["Windows:///?title_re=.*火花思维学生端*"]) - defalut_status = HuohuaPCHome().get_defalut_status() - if not defalut_status: - HuohuaPCHome().login_out() - # with allure.step("点击用户默认头像"): - # HuohuaPCHome().click_defult_avatar() - with allure.step("输入手机号"): - HuohuaPCLogin().input_phone("18333586570") - with allure.step("点击同意协议"): - HuohuaPCLogin().click_agree_label() - with allure.step("点击获取验证码"): - HuohuaPCLogin().click_get_code() - with allure.step("确认存在图形验证码的验证按钮"): - HuohuaPCLogin().assert_login_low_button() - - @allure.title("[国内学生端PC前端腾讯验证码正常弹出--003]") - def test_student_login_by_pwd_ten(self): - with allure.step("清除客户端缓存"): - file_path = r"C:\Users\Administrator\AppData\Roaming\huohua-learner-client\kmm_cache_db.json" - if os.path.isfile(file_path): - os.remove(file_path) - subprocess.call(['taskkill', '/F', '/IM', '火花思维.exe']) - subprocess.Popen( - ['C:\\Users\\Administrator\\AppData\\Local\\Programs\\huohua-learner-client\\火花思维.exe']) - sleep(10) - auto_setup(__file__, logdir=True, devices=["Windows:///?title_re=.*火花思维学生端*"]) - defalut_status = HuohuaPCHome().get_defalut_status() - if not defalut_status: - HuohuaPCHome().login_out() - #with allure.step("点击用户默认头像"): - # HuohuaPCHome().click_defult_avatar() - with allure.step("点击同意协议"): - HuohuaPCLogin().click_agree_label() - with allure.step("输入手机号"): - HuohuaPCLogin().input_phone("18333586570") - with allure.step("点击获取验证码"): - HuohuaPCLogin().click_get_code() - with allure.step("确认存在腾讯验证码的滑动按钮"): - HuohuaPCLogin().assert_login_tencent_image() - - @allure.title("[国内学生端PC磐石登录成功--004]") - def test_student_login_by_pwd_normal(self): - with allure.step("清除客户端缓存"): - file_path = r"C:\Users\Administrator\AppData\Roaming\huohua-learner-client\kmm_cache_db.json" - if os.path.isfile(file_path): - os.remove(file_path) - subprocess.call(['taskkill', '/F', '/IM', '火花思维.exe']) - subprocess.Popen( - ['C:\\Users\\Administrator\\AppData\\Local\\Programs\\huohua-learner-client\\火花思维.exe']) - sleep(10) - auto_setup(__file__, logdir=True, devices=["Windows:///?title_re=.*火花思维学生端*"]) - defalut_status = HuohuaPCHome().get_defalut_status() - if not defalut_status: - HuohuaPCHome().login_out() - with allure.step("清除前端缓存"): - View().input_console_command("window.localStorage.removeItem{(}'POP_STORAGE_TYPE'{)}") - with allure.step("点击用户默认头像"): - HuohuaPCHome().click_defult_avatar() - with allure.step("点击通过密码登录"): - HuohuaPCLogin().click_by_pwd() - with allure.step("输入手机号"): - HuohuaPCLogin().input_phone("18333586570") - with allure.step("点击同意协议"): - HuohuaPCLogin().click_agree_label() - with allure.step("输入密码"): - HuohuaPCLogin().input_pwd("123456") - with allure.step("点击登录按钮"): - HuohuaPCLogin().click_login_button() - sleep(10) - with allure.step("确认登录成功"): - HuohuaPCHome().assert_discover_button() - - - @allure.title("[国内学生端PCcheck备份域名强制登录进入课堂上课--005]") - def test_student_login_by_check(self): - with allure.step("添加域名重定向到降级域名"): - self.host_list = [{"ip": "127.0.0.1", "host_name": "core-api.huohua.cn"}] - host_update.host_update_by_host_dict(self.host_list) - host_update.wait_dns_flush(ip="127.0.0.1" ,domain= "core-api.huohua.cn") - file_path = r"C:\Users\Administrator\AppData\Roaming\huohua-learner-client\kmm_cache_db.json" - if os.path.isfile(file_path): - os.remove(file_path) - subprocess.call(['taskkill', '/F', '/IM', '火花思维.exe']) - subprocess.Popen( - ['C:\\Users\\Administrator\\AppData\\Local\\Programs\\huohua-learner-client\\火花思维.exe']) - sleep(10) - auto_setup(__file__, logdir=True, devices=["Windows:///?title_re=.*火花思维学生端*"]) - defalut_status = HuohuaPCHome().get_defalut_status() - if not defalut_status: - HuohuaPCHome().login_out() - with allure.step("清除前端缓存"): - View().input_console_command("window.localStorage.removeItem{(}'POP_STORAGE_TYPE'{)}") - with allure.step("点击用户默认头像"): - HuohuaPCHome().click_defult_avatar() - #with allure.step("点击通过验证登录"): - # HuohuaPCLogin().click_by_code() - with allure.step("点击同意协议"): - HuohuaPCLogin().click_agree_label() - with allure.step("输入手机号"): - HuohuaPCLogin().input_phone("15890630602") - with allure.step("输入验证码"): - HuohuaPCLogin().input_code("8888") - with allure.step("点击登录按钮"): - HuohuaPCLogin().click_login_button() - sleep(5) - with allure.step("点击进入课堂按钮"): - HuohuaPCHome().click_enter_classroom() - sleep(100) - with allure.step("成功进入课堂"): - HuohuaPCClassroom.check_classroom_icon() - - - -if __name__ == '__main__': - - TestHuohuaStudentLogin().test_student_login_by_pwd_low_ten() \ No newline at end of file diff --git a/zhyy/test_case/TestCase/UI自动化/student/huohua/__init__.py b/zhyy/test_case/TestCase/UI自动化/student/huohua/__init__.py deleted file mode 100644 index 9dad97f..0000000 --- a/zhyy/test_case/TestCase/UI自动化/student/huohua/__init__.py +++ /dev/null @@ -1,4 +0,0 @@ -# -*- coding:utf-8 -*- -# @Time : 2023/7/7 13:37 -# @Author: luozhipeng -# @File : __init__.py.py diff --git a/zhyy/test_case/TestCase/UI自动化/student/huohua/log_in_and_log_out.py b/zhyy/test_case/TestCase/UI自动化/student/huohua/log_in_and_log_out.py deleted file mode 100644 index 97f626b..0000000 --- a/zhyy/test_case/TestCase/UI自动化/student/huohua/log_in_and_log_out.py +++ /dev/null @@ -1,75 +0,0 @@ -import allure -from ui_auto_lego.common.handle_action import HandleAction -from ui_library.page.student.huohua import login, home,setting,profile -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 -import time - -obj_handle_action = HandleAction() -obj_login_page = login.Edu_Huo_Hua_Login() -obj_home_page = home.Edu_Huo_Hua_Home() -obj_profile_page = profile.Edu_Huo_Hua_Profile() - -obj_set_page = setting.Edu_Huo_Hua_Set() -obj_rf_config = readconfig() -obj_login_logic = LoginLogic() -obj_user_info = eval(obj_rf_config.study_user) - -@allure.feature('huohua 登录前及登录测试') -class TestLogin(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_setting_info(self): - with allure.step("点击设置项"): - poco = self.poco_driver - for i in range(1, 100): - # obj_handle_action.click_by_poco(poco, obj_home_page.get_reload()) - # time.sleep(3) - - obj_handle_action.click_by_poco(poco, obj_home_page.get_setiing_menu()) - obj_handle_action.click_by_poco(poco, obj_set_page.get_logout_menu()) - obj_handle_action.click_by_poco(poco, obj_home_page.get_setiing_menu()) - obj_handle_action.click_by_poco(poco, obj_login_page.get_on_default_phone()) - - obj_handle_action.click_by_poco(poco, obj_login_page.get_pwd_login_menu()) - obj_handle_action.click_by_poco(poco, obj_login_page.get_agree_label()) - obj_handle_action.set_text_by_poco(poco, obj_login_page.get_phone_insert(), 12345678001) - obj_handle_action.set_text_by_poco(poco, obj_login_page.get_pwd_insert(), 123456) - obj_handle_action.click_by_poco(poco, obj_login_page.get_login_button()) - # obj_handle_action.click_by_poco(poco, obj_home_page.get_reload()) - # time.sleep(3) - - obj_handle_action.click_by_poco(poco, obj_home_page.get_profile_photo_menu()) - obj_handle_action.click_by_poco(poco, obj_profile_page.get_Profile_logout_menu()) - obj_handle_action.click_by_poco(poco, obj_home_page.get_profile_photo_menu()) - obj_handle_action.click_by_poco(poco, obj_login_page.get_on_default_phone()) - - obj_handle_action.click_by_poco(poco, obj_login_page.get_pwd_login_menu()) - obj_handle_action.click_by_poco(poco, obj_login_page.get_agree_label()) - obj_handle_action.set_text_by_poco(poco, obj_login_page.get_phone_insert(), 12345678001) - obj_handle_action.set_text_by_poco(poco, obj_login_page.get_pwd_insert(), 123456) - obj_handle_action.click_by_poco(poco, obj_login_page.get_login_button()) - # obj_handle_action.click_by_poco(poco, obj_home_page.get_reload()) - - - - - -if __name__ == '__main__': - A= TestLogin() - for i in range(1,100): - A.test_setting_info() \ No newline at end of file diff --git a/zhyy/test_case/TestCase/UI自动化/student/vispark/PC/__init__.py b/zhyy/test_case/TestCase/UI自动化/student/vispark/PC/__init__.py deleted file mode 100644 index 833cc99..0000000 --- a/zhyy/test_case/TestCase/UI自动化/student/vispark/PC/__init__.py +++ /dev/null @@ -1,4 +0,0 @@ -# -*- coding:utf-8 -*- -# @Time : 2023/10/11 14:32 -# @Author: luozhipeng -# @File : __init__.py.py diff --git a/zhyy/test_case/TestCase/UI自动化/student/vispark/PC/test_spark_student_login.py b/zhyy/test_case/TestCase/UI自动化/student/vispark/PC/test_spark_student_login.py deleted file mode 100644 index 4f4a7e3..0000000 --- a/zhyy/test_case/TestCase/UI自动化/student/vispark/PC/test_spark_student_login.py +++ /dev/null @@ -1,202 +0,0 @@ -from airtest.core.api import * -import logging -import allure -import os -import sys -LOCAL_PATH = os.path.dirname(os.path.abspath(__file__)) -BASE_PROJECT_PATH = os.path.abspath(os.path.join(LOCAL_PATH, '../../../../../../../{}'.format("UBRD"))) -BASIC_PATH = os.path.abspath(os.path.join(LOCAL_PATH, '../../../../../../../')) -sys.path.append(BASE_PROJECT_PATH) -sys.path.append(BASIC_PATH) -from ui_library.page.student.huohua.PC.view.view import View -from base_framework.public_tools.apollo import Apollo -from library.CommonFun.host_update import HostUpdate,CoreApollo -from ui_library.page.student.spark.PC.login.spark_pc_login import SparkPCLogin -from ui_library.page.student.spark.PC.home.spark_pc_home import SparkPCHome -from ui_library.page.student.spark.PC.classroom.spark_pc_classroom import SparkPCClassroom -import subprocess -import shutil - -logger = logging.getLogger("airtest") -logger.setLevel(logging.ERROR) -host_update = HostUpdate() -obj_core_apollo = CoreApollo() - - -@allure.feature('Spark Student') -class TestSparkStudentLogin: - - def setup(self): - self.host_list = [] - # 打开APP - # nginx = subprocess.Popen(['C:\\Users\\Administrator\\Downloads\\nginx-1.24.0\\nginx.exe', '-p', '.'], cwd=r"C:\Users\Administrator\Downloads\nginx-1.24.0") - file_path = r"C:\Users\Administrator\AppData\Roaming\overseas-pc-student-sim\db.json" - source_file = r"C:\Users\Administrator\AppData\Roaming\st-oversea\db.json" - if os.path.isfile(file_path): - os.remove(file_path) - shutil.copy(source_file, file_path) - subprocess.Popen(['C:\\Users\\Administrator\\AppData\\Local\\Programs\\overseas-pc-student-sim\\SparkMath学生端 - SIM.exe']) - sleep(20) - auto_setup(__file__, logdir=True, devices=["Windows:///?title_re=.*Spark Education*"]) - SparkPCHome().login_out() - - def teardown(self): - for i in self.host_list: - host_update.host_remove_intercept(i["ip"],i["host_name"]) - os.system("ipconfig /flushdns") - subprocess.call(['taskkill', '/F', '/IM', 'SparkMath学生端 - SIM.exe']) - # subprocess.call(['taskkill', '/F', '/IM', 'nginx.exe']) - - @allure.title("[海外学生端PC前端域名降级--001]") - def test_student_login_by_pwd_low_fe(self): - auto_setup(__file__, logdir=True, devices=["Windows:///?title_re=.*Spark Education*"]) - with allure.step("清理客户端缓存"): - file_path = r"C:\Users\Administrator\AppData\Roaming\overseas-pc-student-sim\kmm_cache_db.json" - if os.path.isfile(file_path): - os.remove(file_path) - with allure.step("清除前端缓存"): - View().input_console_command("await{ }window._NATIVE.localStorage.removeItem{(}'POP_STORAGE_TYPE'{)}") - with allure.step("点击密码登录"): - sleep(5) - SparkPCLogin().click_via_pwd() - with allure.step("输入手机号12345678001"): - SparkPCLogin().input_user_phone("12345678001") - with allure.step("输入密码123456"): - SparkPCLogin().input_user_pwd("123456") - with allure.step("点击同意协议"): - SparkPCLogin().click_agree_label() - with allure.step("点击登录按钮"): - SparkPCLogin().click_login_button() - sleep(15) - with allure.step("确认登录成功"): - default_status = SparkPCLogin().get_login_button() - if default_status: - SparkPCLogin().click_login_button() - sleep(10) - sleep(10) - SparkPCHome().check_spark_icon() - - @allure.title("[海外学生端PC腾讯验证码降级--002]") - def test_student_login_low_ten(self): - with allure.step("添加域名屏蔽"): - self.host_list = [{"ip": "1.1.1.1", "host_name": "turing.captcha.qcloud.com"}] - host_update.host_update_by_host_dict(self.host_list) - host_update.wait_dns_flush(ip="1.1.1.1" ,domain= "turing.captcha.qcloud.com") - file_path = r"C:\Users\Administrator\AppData\Roaming\overseas-pc-student-sim\kmm_cache_db.json" - if os.path.isfile(file_path): - os.remove(file_path) - subprocess.call(['taskkill', '/F', '/IM', 'SparkMath学生端 - SIM.exe']) - subprocess.Popen( - ['C:\\Users\\Administrator\\AppData\\Local\\Programs\\overseas-pc-student-sim\\SparkMath学生端 - SIM.exe']) - sleep(20) - auto_setup(__file__, logdir=True, devices=["Windows:///?title_re=.*Spark Education*"]) - SparkPCHome().login_out() - with allure.step("清除前端缓存"): - View().input_console_command("await{ }window._NATIVE.localStorage.removeItem{(}'POP_STORAGE_TYPE'{)}") - with allure.step("输入手机号13460219197"): - SparkPCLogin().input_user_phone("13460219197") - with allure.step("点击同意协议"): - SparkPCLogin().click_agree_label() - with allure.step("点击获取验证码"): - SparkPCLogin().click_get_code() - sleep(10) - with allure.step("确认不存在腾讯验证码"): - SparkPCLogin().assert_no_tencent_button() - - @allure.title("[海外学生端PC腾讯验证码正常流程--003]") - def test_student_login_normal_ten(self): - with allure.step("清除客户端缓存"): - file_path = r"C:\Users\Administrator\AppData\Roaming\overseas-pc-student-sim\kmm_cache_db.json" - if os.path.isfile(file_path): - os.remove(file_path) - subprocess.call(['taskkill', '/F', '/IM', 'SparkMath学生端 - SIM.exe']) - subprocess.Popen( - ['C:\\Users\\Administrator\\AppData\\Local\\Programs\\overseas-pc-student-sim\\SparkMath学生端 - SIM.exe']) - sleep(20) - auto_setup(__file__, logdir=True, devices=["Windows:///?title_re=.*Spark Education*"]) - SparkPCHome().login_out() - with allure.step("清除前端缓存"): - View().input_console_command("await{ }window._NATIVE.localStorage.removeItem{(}'POP_STORAGE_TYPE'{)}") - with allure.step("输入手机号13460219197"): - SparkPCLogin().input_user_phone("13460219197") - with allure.step("点击同意协议"): - SparkPCLogin().click_agree_label() - with allure.step("点击获取验证码"): - SparkPCLogin().click_get_code() - sleep(10) - with allure.step("确认存在腾讯验证码"): - SparkPCLogin().assert_exist_tencent_button() - - @allure.title("[海外学生端PC磐石登录成功--004]") - def test_student_login_by_pwd_normal(self): - with allure.step("清除客户端缓存"): - file_path = r"C:\Users\Administrator\AppData\Roaming\overseas-pc-student-sim\kmm_cache_db.json" - if os.path.isfile(file_path): - os.remove(file_path) - subprocess.call(['taskkill', '/F', '/IM', 'SparkMath学生端 - SIM.exe']) - subprocess.Popen( - ['C:\\Users\\Administrator\\AppData\\Local\\Programs\\overseas-pc-student-sim\\SparkMath学生端 - SIM.exe']) - sleep(10) - auto_setup(__file__, logdir=True, devices=["Windows:///?title_re=.*Spark Education*"]) - with allure.step("清除前端缓存"): - View().input_console_command("await{ }window._NATIVE.localStorage.removeItem{(}'POP_STORAGE_TYPE'{)}") - with allure.step("点击密码登录"): - sleep(5) - SparkPCLogin().click_via_pwd() - with allure.step("输入手机号13460219197"): - SparkPCLogin().input_user_phone("13460219197") - with allure.step("输入密码123456"): - SparkPCLogin().input_user_pwd("123456") - sleep(1) - with allure.step("点击同意协议"): - SparkPCLogin().click_agree_label() - with allure.step("点击登录按钮"): - SparkPCLogin().click_login_button() - sleep(5) - with allure.step("确认登录成功"): - default_status = SparkPCLogin().get_login_button() - if default_status: - SparkPCLogin().click_login_button() - sleep(10) - SparkPCHome().check_spark_icon() - - @allure.title("[海外学生端PC强制验证码登录进入课堂上课--005]") - def test_student_join_classroom_check(self): - with allure.step("添加域名重定向降级服务"): - self.host_list = [{"ip": "127.0.0.1", "host_name": "core-api.sim.huohua.cn"}] - host_update.host_update_by_host_dict(self.host_list) - host_update.wait_dns_flush(ip="127.0.0.1" ,domain= "core-api.sim.huohua.cn") - file_path = r"C:\Users\Administrator\AppData\Roaming\overseas-pc-student-sim\kmm_cache_db.json" - if os.path.isfile(file_path): - os.remove(file_path) - subprocess.call(['taskkill', '/F', '/IM', 'SparkMath学生端 - SIM.exe']) - subprocess.Popen( - ['C:\\Users\\Administrator\\AppData\\Local\\Programs\\overseas-pc-student-sim\\SparkMath学生端 - SIM.exe']) - sleep(20) - auto_setup(__file__, logdir=True, devices=["Windows:///?title_re=.*Spark Education*"]) - SparkPCHome().login_out() - with allure.step("清除前端缓存"): - View().input_console_command("await{ }window._NATIVE.localStorage.removeItem{(}'POP_STORAGE_TYPE'{)}") - sleep(2) - with allure.step("输入手机号15890630602"): - SparkPCLogin().input_user_phone("15890630602") - with allure.step("点击同意协议"): - SparkPCLogin().click_agree_label() - with allure.step("点击输入验证码"): - SparkPCLogin().input_user_code("8888") - with allure.step("点击登录按钮"): - SparkPCLogin().click_login_by_code() - sleep(5) - with allure.step("确认登录成功"): - SparkPCHome().check_spark_icon() - sleep(8) - with allure.step("点击进入课堂按钮"): - SparkPCHome().click_enter_class_button() - sleep(15) - with allure.step("检查课堂内宝箱图标"): - SparkPCClassroom.check_classroom_star_box() - - -if __name__ == '__main__': - TestSparkStudentLogin().test_student_login_by_pwd_low_fe() - diff --git a/zhyy/test_case/TestCase/UI自动化/student/vispark/PC/test_spark_student_login_online.py b/zhyy/test_case/TestCase/UI自动化/student/vispark/PC/test_spark_student_login_online.py deleted file mode 100644 index 7777aa1..0000000 --- a/zhyy/test_case/TestCase/UI自动化/student/vispark/PC/test_spark_student_login_online.py +++ /dev/null @@ -1,189 +0,0 @@ -from airtest.core.api import * -import logging -import allure -import os -import sys -LOCAL_PATH = os.path.dirname(os.path.abspath(__file__)) -BASE_PROJECT_PATH = os.path.abspath(os.path.join(LOCAL_PATH, '../../../../../../../{}'.format("UBRD"))) -BASIC_PATH = os.path.abspath(os.path.join(LOCAL_PATH, '../../../../../../../')) -sys.path.append(BASE_PROJECT_PATH) -sys.path.append(BASIC_PATH) -from ui_library.page.student.huohua.PC.view.view import View -from base_framework.public_tools.apollo import Apollo -from library.CommonFun.host_update import HostUpdate,CoreApollo -from ui_library.page.student.spark.PC.login.spark_pc_login import SparkPCLogin -from ui_library.page.student.spark.PC.home.spark_pc_home import SparkPCHome -from ui_library.page.student.spark.PC.classroom.spark_pc_classroom import SparkPCClassroom -import subprocess -import shutil - -logger = logging.getLogger("airtest") -logger.setLevel(logging.ERROR) -host_update = HostUpdate() -obj_core_apollo = CoreApollo() - - -@allure.feature('Spark Student') -class TestSparkStudentLogin: - - def setup(self): - self.host_list = [] - # 打开APP - # nginx = subprocess.Popen(['C:\\Users\\Administrator\\Downloads\\nginx-1.24.0\\nginx.exe', '-p', '.'], cwd=r"C:\Users\Administrator\Downloads\nginx-1.24.0") - file_path = r"C:\Users\Administrator\AppData\Roaming\sparkedu-learner-client\db.json" - source_file = r"C:\Users\Administrator\AppData\Roaming\on_spark\db.json" - if os.path.isfile(file_path): - os.remove(file_path) - shutil.copy(source_file, file_path) - subprocess.Popen(['C:\\Users\\Administrator\\AppData\\Local\\Programs\\sparkedu-learner-client\\SparkMath学生端.exe']) - sleep(20) - auto_setup(__file__, logdir=True, devices=["Windows:///?title_re=.*Spark Education*"]) - SparkPCHome().login_out() - - def teardown(self): - for i in self.host_list: - host_update.host_remove_intercept(i["ip"],i["host_name"]) - os.system("ipconfig /flushdns") - subprocess.call(['taskkill', '/F', '/IM', 'SparkMath学生端.exe']) - # subprocess.call(['taskkill', '/F', '/IM', 'nginx.exe']) - - @allure.title("[海外学生端PC前端域名降级--001]") - def test_student_login_by_pwd_low_fe(self): - auto_setup(__file__, logdir=True, devices=["Windows:///?title_re=.*Spark Education*"]) - with allure.step("添加域名屏蔽"): - file_path = r"C:\Users\Administrator\AppData\Roaming\sparkedu-learner-client\kmm_cache_db.json" - if os.path.isfile(file_path): - os.remove(file_path) - with allure.step("清除前端缓存 域名重新轮询"): - View().input_console_command("await{ }window._NATIVE.localStorage.removeItem{(}'POP_STORAGE_TYPE'{)}") - with allure.step("点击密码登录"): - SparkPCLogin().click_via_pwd() - with allure.step("输入手机号12345678001"): - SparkPCLogin().input_user_phone("12345678001") - with allure.step("输入密码123456"): - SparkPCLogin().input_user_pwd_online("123456") - sleep(5) - with allure.step("点击同意协议"): - SparkPCLogin().click_agree_label() - with allure.step("第一次点击登录按钮"): - SparkPCLogin().click_login_button() - sleep(5) - with allure.step("第二次点击登录按钮"): - SparkPCLogin().click_login_button() - sleep(10) - with allure.step("第三次点击登录按钮"): - SparkPCLogin().click_login_button() - sleep(10) - with allure.step("确认登录成功"): - SparkPCHome().check_spark_icon() - - @allure.title("[海外学生端PC腾讯验证码降级--002]") - def test_student_login_low_ten(self): - with allure.step("添加域名屏蔽"): - self.host_list = [{"ip": "1.1.1.1", "host_name": "turing.captcha.qcloud.com"}] - host_update.host_update_by_host_dict(self.host_list) - host_update.wait_dns_flush(ip="1.1.1.1" ,domain= "turing.captcha.qcloud.com") - file_path = r"C:\Users\Administrator\AppData\Roaming\sparkedu-learner-client\kmm_cache_db.json" - if os.path.isfile(file_path): - os.remove(file_path) - subprocess.call(['taskkill', '/F', '/IM', 'SparkMath学生端.exe']) - subprocess.Popen( - ['C:\\Users\\Administrator\\AppData\\Local\\Programs\\sparkedu-learner-client\\SparkMath学生端.exe']) - sleep(20) - auto_setup(__file__, logdir=True, devices=["Windows:///?title_re=.*Spark Education*"]) - with allure.step("清除前端缓存"): - View().input_console_command("await{ }window._NATIVE.localStorage.removeItem{(}'POP_STORAGE_TYPE'{)}") - with allure.step("输入手机号18333586570"): - SparkPCLogin().input_user_phone("18333586570") - with allure.step("点击同意协议"): - SparkPCLogin().click_agree_label() - with allure.step("点击获取验证码"): - SparkPCLogin().click_get_code() - with allure.step("确认不存在腾讯验证码"): - SparkPCLogin().assert_no_tencent_button() - - @allure.title("[海外学生端PC腾讯验证码正常流程--003]") - def test_student_login_normal_ten(self): - auto_setup(__file__, logdir=True, devices=["Windows:///?title_re=.*Spark Education*"]) - file_path = r"C:\Users\Administrator\AppData\Roaming\sparkedu-learner-client\kmm_cache_db.json" - if os.path.isfile(file_path): - os.remove(file_path) - with allure.step("清除前端缓存"): - View().input_console_command("await{ }window._NATIVE.localStorage.removeItem{(}'POP_STORAGE_TYPE'{)}") - with allure.step("输入手机号18333586570"): - SparkPCLogin().input_user_phone("18333586570") - with allure.step("点击同意协议"): - SparkPCLogin().click_agree_label() - with allure.step("点击获取验证码"): - SparkPCLogin().click_get_code() - with allure.step("确认存在腾讯验证码"): - SparkPCLogin().assert_exist_tencent_button() - - @allure.title("[海外学生端PC磐石登录成功--004]") - def test_student_login_by_pwd_normal(self): - with allure.step("添加域名屏蔽"): - file_path = r"C:\Users\Administrator\AppData\Roaming\sparkedu-learner-client\kmm_cache_db.json" - if os.path.isfile(file_path): - os.remove(file_path) - with allure.step("清除前端缓存"): - View().input_console_command("await{ }window._NATIVE.localStorage.removeItem{(}'POP_STORAGE_TYPE'{)}") - with allure.step("点击密码登录"): - sleep(2) - SparkPCLogin().click_via_pwd() - sleep(3) - with allure.step("输入手机号18333586570"): - SparkPCLogin().input_user_phone("18333586570") - with allure.step("输入密码123456"): - SparkPCLogin().input_user_pwd_online("123456") - sleep(5) - with allure.step("点击同意协议"): - SparkPCLogin().click_agree_label() - with allure.step("点击登录按钮"): - SparkPCLogin().click_login_button() - sleep(5) - with allure.step("确认登录成功"): - default_status = SparkPCLogin().get_login_button() - if default_status: - SparkPCLogin().click_login_button() - sleep(10) - SparkPCHome().check_spark_icon() - - @allure.title("[海外学生端PC强制验证码登录进入课堂上课--005]") - def test_student_join_classroom_check(self): - with allure.step("添加域名重定向"): - self.host_list = [{"ip": "127.0.0.1", "host_name": "core-api.sparkeduapi.com"}] - host_update.host_update_by_host_dict(self.host_list) - host_update.wait_dns_flush(ip="127.0.0.1" ,domain= "core-api.sparkeduapi.com") - file_path = r"C:\Users\Administrator\AppData\Roaming\sparkedu-learner-client\kmm_cache_db.json" - if os.path.isfile(file_path): - os.remove(file_path) - subprocess.call(['taskkill', '/F', '/IM', 'SparkMath学生端.exe']) - subprocess.Popen( - ['C:\\Users\\Administrator\\AppData\\Local\\Programs\\sparkedu-learner-client\\SparkMath学生端.exe']) - sleep(10) - auto_setup(__file__, logdir=True, devices=["Windows:///?title_re=.*Spark Education*"]) - SparkPCHome().login_out() - with allure.step("清除前端缓存"): - View().input_console_command("await{ }window._NATIVE.localStorage.removeItem{(}'POP_STORAGE_TYPE'{)}") - with allure.step("输入手机号15890630602"): - SparkPCLogin().input_user_phone("15890630602") - with allure.step("点击同意协议"): - SparkPCLogin().click_agree_label() - with allure.step("点击输入验证码"): - SparkPCLogin().input_user_code("8888") - with allure.step("点击登录按钮"): - SparkPCLogin().click_login_by_code() - sleep(5) - with allure.step("确认登录成功"): - SparkPCHome().check_spark_icon() - sleep(10) - with allure.step("点击进入课堂按钮"): - SparkPCHome().click_enter_class_button() - sleep(20) - with allure.step("检查课堂内宝箱图标"): - SparkPCClassroom.check_classroom_star_box() - - -if __name__ == '__main__': - TestSparkStudentLogin().test_student_login_by_pwd_low_fe() - diff --git a/zhyy/test_case/TestCase/UI自动化/student/vispark/__init__.py b/zhyy/test_case/TestCase/UI自动化/student/vispark/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/zhyy/test_case/TestCase/UI自动化/student/vispark/calendar_sign.py b/zhyy/test_case/TestCase/UI自动化/student/vispark/calendar_sign.py deleted file mode 100644 index ac9185f..0000000 --- a/zhyy/test_case/TestCase/UI自动化/student/vispark/calendar_sign.py +++ /dev/null @@ -1,29 +0,0 @@ -# -*- coding: utf-8 -*- -# __author__ = 'luozhipeng' - -import allure -from airtest.core.api import * -from ui_auto_lego.common import handle_driver -from ui_library.page.student import login, home -from ui_library.common.read_config import readconfig -from ui_auto_lego.common.launch import InitMobilStartApp - -handle_driver_obj = handle_driver.HandleDriver() -login_page = login.Login() -home_page = home.Home() -rf_config = readconfig() -user_info = eval(rf_config.study_user) - - -@allure.feature('ViSpark Study 日历标识测试') -class TestCalendarSign(object): - init_mobile_start_app = InitMobilStartApp() - poco_driver = init_mobile_start_app.poco_driver - - def setup(self): - # 启动被测试应用 - self.init_mobile_start_app.launch_app() - - def teardown(self): - # 退出被测试应用并清理数据 - self.init_mobile_start_app.quit() diff --git a/zhyy/test_case/TestCase/UI自动化/student/vispark/home.py b/zhyy/test_case/TestCase/UI自动化/student/vispark/home.py deleted file mode 100644 index 7f9a24c..0000000 --- a/zhyy/test_case/TestCase/UI自动化/student/vispark/home.py +++ /dev/null @@ -1,67 +0,0 @@ -# -*- 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() - diff --git a/zhyy/test_case/TestCase/UI自动化/student/vispark/login.py b/zhyy/test_case/TestCase/UI自动化/student/vispark/login.py deleted file mode 100644 index b2515a5..0000000 --- a/zhyy/test_case/TestCase/UI自动化/student/vispark/login.py +++ /dev/null @@ -1,50 +0,0 @@ -# -*- coding: utf-8 -*- -# __author__ = 'xinjiu.qiao' - -import allure -from ui_auto_lego.common.handle_action import HandleAction -from ui_library.page.student import login, home -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.page.common.sys import Android_Sys -import time - -obj_handle_action = HandleAction() -obj_login_page = login.Login() -obj_home_page = home.Home() -obj_rf_config = readconfig() -obj_login_logic = LoginLogic() -obj_user_info = eval(obj_rf_config.study_user) -obj_sys_page = Android_Sys() - -@allure.feature('ViSpark Study 登录前及登录测试') -class TestLogin(object): - init_mobile_start_app = InitMobilStartApp() - poco_driver = init_mobile_start_app.poco_driver - - def setup(self): - # 启动被测试应用 - self.init_mobile_start_app.init_app() - pass - def teardown(self): - # 退出被测试应用并清理数据 - - self.init_mobile_start_app.quit() - self.init_mobile_start_app.clear_app() - pass - @allure.title("已存在账号密码登录") - def test_login(self): - - obj_login_logic.login_app_by_pwd(self.poco_driver, obj_user_info.get("username"), obj_user_info.get("password"), - obj_user_info.get("nickname")) - - obj_handle_action.find_element_by_poco(self.poco_driver, obj_home_page.get_headers_star()) - text = obj_handle_action.get_text_by_poco(self.poco_driver, obj_home_page.get_headers_star()) - str = "2040" - assert str in text - - -if __name__ == '__main__': - A= TestLogin() - A.test_login() \ No newline at end of file diff --git a/zhyy/test_case/TestCase/UI自动化/student/vispark/setting.py b/zhyy/test_case/TestCase/UI自动化/student/vispark/setting.py deleted file mode 100644 index b212266..0000000 --- a/zhyy/test_case/TestCase/UI自动化/student/vispark/setting.py +++ /dev/null @@ -1,95 +0,0 @@ -# -*- 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()) \ No newline at end of file diff --git a/zhyy/test_case/TestCase/UI自动化/teacher/huohua/test_teacher_login.py b/zhyy/test_case/TestCase/UI自动化/teacher/huohua/test_teacher_login.py deleted file mode 100644 index 84febb6..0000000 --- a/zhyy/test_case/TestCase/UI自动化/teacher/huohua/test_teacher_login.py +++ /dev/null @@ -1,137 +0,0 @@ -from airtest.core.api import * -import logging -import allure -import sys -import subprocess -import shutil -LOCAL_PATH = os.path.dirname(os.path.abspath(__file__)) -BASE_PROJECT_PATH = os.path.abspath(os.path.join(LOCAL_PATH, '../../../../../../{}'.format("UBRD"))) -BASIC_PATH = os.path.abspath(os.path.join(LOCAL_PATH, '../../../../../../')) -sys.path.append(BASE_PROJECT_PATH) -sys.path.append(BASIC_PATH) -from ui_library.page.teacher.home.teacher_home import TeacherHome - -from ui_library.page.student.huohua.PC.view.view import View -from library.CommonFun.host_update import HostUpdate,CoreApollo -from ui_library.page.teacher.login.teacher_login import TeacherLogin -from ui_library.page.teacher.classroom.teacher_classroom import TeacherClassroom - - -host_update = HostUpdate() -obj_core_apollo = CoreApollo() - - -@allure.feature('Teacher') -class TestTeacherClassroom: - def setup(self): - self.host_list = [] - # 重启nginx - file_path = r"C:\Users\Administrator\AppData\Roaming\peppa-app-pc-teacher-sim\db.json" - source_file = r"C:\Users\Administrator\AppData\Roaming\st-teacher\db.json" - if os.path.isfile(file_path): - os.remove(file_path) - shutil.copy(source_file, file_path) - - subprocess.Popen(['C:\\Program Files (x86)\\peppa-app-pc-teacher-sim\\Huohua Teacher - sim\\火花教师端 - SIM版.exe']) - sleep(15) - auto_setup(__file__, logdir=True, devices=["Windows:///?title_re=.*火花思维*"]) - TeacherHome().login_out() - - def teardown(self): - for i in self.host_list: - host_update.host_remove_intercept(i["ip"],i["host_name"]) - os.system("ipconfig /flushdns") - subprocess.call(['taskkill', '/F', '/IM', '火花教师端 - SIM版.exe']) - - - - @allure.title("[教师前端磐石正常密码登录成功--001]") - def test_student_login_by_pwd_normal(self): - auto_setup(__file__, logdir=True, devices=["Windows:///?title_re=.*火花思维*"]) - with allure.step("清除客户端缓存"): - file_path = r"C:\Users\Administrator\AppData\Roaming\peppa-app-pc-teacher-sim\kmm_cache_db.json" - if os.path.isfile(file_path): - os.remove(file_path) - with allure.step("清除前端缓存"): - View().input_console_command("window.localStorage.removeItem{(}'POP_STORAGE_TYPE'{)}") - with allure.step("输入手机号"): - TeacherLogin().input_phone("13540133074") - with allure.step("输入密码"): - TeacherLogin().input_pwd("Mima@123") - with allure.step("点击登录按钮"): - TeacherLogin().click_login_button() - sleep(20) - with allure.step("确认登录成功"): - TeacherHome().assert_login_in() - - @allure.title("[教师前端域名降级--002]") - def test_student_login_by_pwd_low_fe(self): - with allure.step("添加域名屏蔽"): - file_path = r"C:\Users\Administrator\AppData\Roaming\peppa-app-pc-teacher-sim\kmm_cache_db.json" - if os.path.isfile(file_path): - os.remove(file_path) - subprocess.call(['taskkill', '/F', '/IM', '火花教师端 - SIM版.exe']) - subprocess.Popen(['C:\\Program Files (x86)\\peppa-app-pc-teacher-sim\\Huohua Teacher - sim\\火花教师端 - SIM版.exe']) - sleep(15) - auto_setup(__file__, logdir=True, devices=["Windows:///?title_re=.*火花思维*"]) - TeacherHome().login_out() - with allure.step("清除前端缓存"): - View().input_console_command("window.localStorage.removeItem{(}'POP_STORAGE_TYPE'{)}") - with allure.step("点击通过验证码登录"): - TeacherLogin().click_by_code() - with allure.step("输入手机号"): - TeacherLogin().input_phone("15890630602") - with allure.step("验证码输入"): - TeacherLogin().input_code("8334") - sleep(5) - with allure.step("点击登录按钮"): - TeacherLogin().click_login_button() - sleep(5) - with allure.step("点击登录按钮"): - TeacherLogin().click_login_button() - sleep(5) - with allure.step("点击登录按钮"): - TeacherLogin().click_login_button() - sleep(5) - with allure.step("确认登录成功"): - sleep(20) - TeacherHome().assert_login_in() - - @allure.title("[教师端PC强制登录进入课堂上课--003]") - def test_teacher_join_classroom_check(self): - with allure.step("添加域名重定向"): - ip = host_update.get_ip_by_host_domain(domain="core-api-check.sim.huohua.cn") - self.host_list = [{"ip": "127.0.0.1", "host_name": "core-api.sim.huohua.cn"}] - host_update.host_update_by_host_dict(self.host_list) - host_update.wait_dns_flush(ip="127.0.0.1" ,domain= "core-api.sim.huohua.cn") - file_path = r"C:\Users\Administrator\AppData\Roaming\peppa-app-pc-teacher-sim\kmm_cache_db.json" - if os.path.isfile(file_path): - os.remove(file_path) - subprocess.call(['taskkill', '/F', '/IM', '火花教师端 - SIM版.exe']) - subprocess.Popen(['C:\\Program Files (x86)\\peppa-app-pc-teacher-sim\\Huohua Teacher - sim\\火花教师端 - SIM版.exe']) - sleep(15) - auto_setup(__file__, logdir=True, devices=["Windows:///?title_re=.*火花思维*"]) - TeacherHome().login_out() - with allure.step("清除前端缓存"): - View().input_console_command("window.localStorage.removeItem{(}'POP_STORAGE_TYPE'{)}") - with allure.step("点击通过验证码登录"): - TeacherLogin().click_by_code() - with allure.step("输入手机号"): - TeacherLogin().input_phone("15890630602") - with allure.step("验证码输入"): - TeacherLogin().input_code("8334") - sleep(5) - with allure.step("点击登录按钮"): - TeacherLogin().click_login_button() - sleep(5) - with allure.step("点击进入课堂"): - TeacherHome().click_join_classrom() - sleep(60) - with allure.step("点击全选并开始"): - TeacherClassroom().click_all_label() - with allure.step("点击开始上课"): - TeacherClassroom().click_start_classroom() - sleep(5) - with allure.step("点击下课"): - TeacherClassroom().close_classroom() - sleep(10) diff --git a/zhyy/test_case/TestCase/UI自动化/teacher/huohua/test_teacher_login_online.py b/zhyy/test_case/TestCase/UI自动化/teacher/huohua/test_teacher_login_online.py deleted file mode 100644 index fbaa69a..0000000 --- a/zhyy/test_case/TestCase/UI自动化/teacher/huohua/test_teacher_login_online.py +++ /dev/null @@ -1,142 +0,0 @@ -from airtest.core.api import * -import logging -import allure -import sys -import subprocess -import shutil -LOCAL_PATH = os.path.dirname(os.path.abspath(__file__)) -BASE_PROJECT_PATH = os.path.abspath(os.path.join(LOCAL_PATH, '../../../../../../{}'.format("UBRD"))) -BASIC_PATH = os.path.abspath(os.path.join(LOCAL_PATH, '../../../../../../')) -sys.path.append(BASE_PROJECT_PATH) -sys.path.append(BASIC_PATH) -from ui_library.page.teacher.home.teacher_home import TeacherHome - -from ui_library.page.student.huohua.PC.view.view import View -from library.CommonFun.host_update import HostUpdate,CoreApollo -from ui_library.page.teacher.login.teacher_login import TeacherLogin -from ui_library.page.teacher.classroom.teacher_classroom import TeacherClassroom - - -host_update = HostUpdate() -obj_core_apollo = CoreApollo() - - -@allure.feature('Teacher') -class TestTeacherClassroom: - def setup(self): - self.host_list = [] - # 重启nginx - file_path = r"C:\Users\Administrator\AppData\Roaming\huohua-teacher-client\db.json" - source_file = r"C:\Users\Administrator\AppData\Roaming\on_teacher\db.json" - if os.path.isfile(file_path): - os.remove(file_path) - shutil.copy(source_file, file_path) - - subprocess.Popen(['C:\\Program Files (x86)\\Huohua Teacher\\Huohua Teacher.exe']) - sleep(15) - auto_setup(__file__, logdir=True, devices=["Windows:///?title_re=.*火花思维*"]) - TeacherHome().login_out() - - def teardown(self): - for i in self.host_list: - host_update.host_remove_intercept(i["ip"],i["host_name"]) - os.system("ipconfig /flushdns") - subprocess.call(['taskkill', '/F', '/IM', 'Huohua Teacher.exe']) - - - - @allure.title("[教师前端磐石正常密码登录成功--001]") - def test_student_login_by_pwd_normal(self): - auto_setup(__file__, logdir=True, devices=["Windows:///?title_re=.*火花思维*"]) - with allure.step("清除客户端缓存"): - file_path = r"C:\Users\Administrator\AppData\Roaming\huohua-teacher-client\kmm_cache_db.json" - if os.path.isfile(file_path): - os.remove(file_path) - with allure.step("清除前端缓存"): - View().input_console_command("window.localStorage.removeItem{(}'POP_STORAGE_TYPE'{)}") - with allure.step("输入手机号"): - TeacherLogin().input_phone("13540133074") - with allure.step("输入密码"): - TeacherLogin().input_pwd("Mima@123") - with allure.step("点击登录按钮"): - default_status = TeacherLogin().get_login_button() - if default_status: - TeacherLogin().click_login_button() - sleep(10) - with allure.step("确认登录成功"): - TeacherHome().assert_login_in() - - @allure.title("[教师前端域名降级--002]") - def test_student_login_by_pwd_low_fe(self): - auto_setup(__file__, logdir=True, devices=["Windows:///?title_re=.*火花思维*"]) - with allure.step("清除客户端缓存"): - file_path = r"C:\Users\Administrator\AppData\Roaming\huohua-teacher-client\kmm_cache_db.json" - if os.path.isfile(file_path): - os.remove(file_path) - subprocess.call(['taskkill', '/F', '/IM', 'Huohua Teacher.exe']) - subprocess.Popen(['C:\\Program Files (x86)\\Huohua Teacher\\Huohua Teacher.exe']) - sleep(10) - auto_setup(__file__, logdir=True, devices=["Windows:///?title_re=.*火花思维*"]) - TeacherHome().login_out() - with allure.step("清除前端缓存 域名重新轮询"): - View().input_console_command("window.localStorage.removeItem{(}'POP_STORAGE_TYPE'{)}") - with allure.step("点击通过验证码登录"): - TeacherLogin().click_by_code() - with allure.step("输入手机号"): - TeacherLogin().input_phone("15890630602") - with allure.step("验证码输入"): - TeacherLogin().input_code("8334") - with allure.step("第一次点击登录按钮"): - TeacherLogin().click_login_button() - sleep(5) - with allure.step("第二次点击登录按钮"): - TeacherLogin().click_login_button() - sleep(10) - with allure.step("第三次点击登录按钮"): - TeacherLogin().click_login_button() - sleep(10) - with allure.step("第四次点击登录按钮"): - TeacherLogin().click_login_button() - sleep(10) - with allure.step("确认登录成功"): - TeacherHome().assert_login_in() - - @allure.title("[教师端PC强制登录进入课堂上课--003]") - def test_teacher_join_classroom_check(self): - with allure.step("添加域名重定向"): - self.host_list = [{"ip": "127.0.0.1", "host_name": "core-api.huohua.cn"}] - host_update.host_update_by_host_dict(self.host_list) - host_update.wait_dns_flush(ip="127.0.0.1" ,domain= "core-api.huohua.cn") - file_path = r"C:\Users\Administrator\AppData\Roaming\huohua-teacher-client\kmm_cache_db.json" - if os.path.isfile(file_path): - os.remove(file_path) - subprocess.call(['taskkill', '/F', '/IM', 'Huohua Teacher.exe']) - subprocess.Popen(['C:\\Program Files (x86)\\Huohua Teacher\\Huohua Teacher.exe']) - sleep(10) - auto_setup(__file__, logdir=True, devices=["Windows:///?title_re=.*火花思维*"]) - TeacherHome().login_out() - with allure.step("清除前端缓存"): - View().input_console_command("window.localStorage.removeItem{(}'POP_STORAGE_TYPE'{)}") - with allure.step("点击通过验证码登录"): - TeacherLogin().click_by_code() - with allure.step("输入手机号"): - TeacherLogin().input_phone("15890630602") - with allure.step("验证码输入"): - TeacherLogin().input_code("8334") - with allure.step("点击登录按钮"): - default_status = TeacherLogin().get_login_button() - if default_status: - TeacherLogin().click_login_button() - sleep(10) - with allure.step("点击进入课堂"): - TeacherHome().click_join_classrom() - sleep(30) - with allure.step("点击全选并开始"): - TeacherClassroom().click_all_label() - with allure.step("点击开始上课"): - TeacherClassroom().click_start_classroom() - sleep(5) - with allure.step("点击下课"): - TeacherClassroom().close_classroom() - sleep(10) - diff --git a/zhyy/test_case/run_tests.py b/zhyy/test_case/run_tests.py index 69d38e3..c387eb8 100644 --- a/zhyy/test_case/run_tests.py +++ b/zhyy/test_case/run_tests.py @@ -222,6 +222,9 @@ def main(): # 生成并打开报告 python run_tests.py --report --open + + # Jenkins环境下使用环境变量 + # 设置 TEST_TYPE=feature TEST_TARGET="深圳采购工作台采购订单页面" """ ) @@ -241,11 +244,17 @@ def main(): args = parser.parse_args() + # 检查Jenkins环境变量 + env = os.environ.copy() + jenkins_test_type = env.get('TEST_TYPE', '').strip() + jenkins_test_target = env.get('TEST_TARGET', '').strip() + # 确保目录存在 ensure_dirs() # 执行测试 exit_code = 0 + if args.feature: exit_code = run_tests(args.feature, 'feature') elif args.story: @@ -258,6 +267,10 @@ def main(): exit_code = run_tests(args.keyword, 'keyword') elif args.marker: exit_code = run_tests(args.marker, 'marker') + elif jenkins_test_type: + # 从Jenkins环境变量获取测试类型 + print(f"从Jenkins环境变量获取测试配置: TEST_TYPE={jenkins_test_type}, TEST_TARGET={jenkins_test_target}") + exit_code = run_tests(jenkins_test_target, jenkins_test_type) else: # 默认运行所有测试 exit_code = run_tests(None, 'all')