def setup(self): share_icon = self.last_sleep.get_sleep() if share_icon is None: self.last_sleep = BaseDriver.andriod_driver().to_my_status_sleep_page() else: pass self.logInfo = LogInfo()
def setup(self): my_collect_icon = self.collect.get_course_tab() if my_collect_icon is None: self.collect = BaseDriver.andriod_driver().to_mine_collect_page() else: pass self.logInfo = LogInfo()
def setup(self): # foreign_icon = self.foreign.get_foreign_workout_icon() # if foreign_icon is None: # self.foreign = BaseDriver.andriod_driver().to_other_country_workout_tab() # else: # pass self.logInfo = LogInfo()
def setup(self): activities_icon = self.find_page.get_activity_icon() if activities_icon is None: self.find_page = BaseDriver.andriod_driver().to_find_page() else: pass self.logInfo = LogInfo()
def setup(self): my_course_icon = self.course.get_add_course_icon() if my_course_icon is None: self.course = BaseDriver.andriod_driver().to_mine_course_page() else: pass self.logInfo = LogInfo()
def setup(self): my_friends_icon = self.friends.get_first_friend_name() if my_friends_icon is None: self.friends = BaseDriver.andriod_driver().to_mine_friends_page() else: pass self.logInfo = LogInfo()
def setup(self): edit_profile_icon = self.dynamic.get_edit_profile_icon() if edit_profile_icon is None: self.dynamic = BaseDriver.andriod_driver().to_my_dynamic_page() else: pass self.logInfo = LogInfo()
def setup(self): my_status_icon = self.my_status.get_my_status_icon() if my_status_icon is None: self.my_status = BaseDriver.andriod_driver().to_my_status_page() else: pass self.logInfo = LogInfo()
def setup(self): # print ("这是用户类") # self.user_page.get_device_state_custom() # community_icon = self.community_post.get_community_icon() # if community_icon is None: # self.community_post = BaseDriver.andriod_driver().to_community_tab() # else: # pass self.logInfo = LogInfo()
def setup(self): # sport_icon = self..get_sport_icon() # if sport_icon is None: # self.sport_page.driver.quit() # time.sleep(3) # self.sport_page = BaseDriver.andriod_driver().to_heart_rate_page() # else: # pass self.logInfo = LogInfo()
def setup(self): # print ("这是用户信息类") # self.user_info.get_device_state_custom() nick_name_icon = self.user_info.get_nick_name_value() if nick_name_icon is None: self.user_info = BaseDriver.andriod_driver().to_mine_user_page() else: pass self.logInfo = LogInfo()
def setup(self): # print ("这是个人主页类") # self.homepage.get_device_state_custom() edit_profile_icon = self.homepage.get_edit_profile_icon() if edit_profile_icon is None: self.homepage = BaseDriver.andriod_driver().to_mine_personal_homepage() else: pass self.logInfo = LogInfo()
def setup(self): # print ("这是今日步数类") # self.todaySteps.get_device_state_custom() statistics_icon = self.todaySteps.get_statistics_icon() if statistics_icon is None: self.todaySteps = BaseDriver.andriod_driver().to_today_steps_page() else: pass self.logInfo = LogInfo()
def setup(self): # print ("这是用户类") # self.user_page.get_device_state_custom() add_device_icon = self.user_page.get_add_device_icon() if add_device_icon is None: self.user_page = BaseDriver.andriod_driver().to_mine_page_user() else: pass self.logInfo = LogInfo()
def setup(self): # print ("这是运动类") # self.sport_page.get_device_state_custom() # sport_icon = self.todaySport.get_sport_icon() # if sport_icon is None: # self.todaySport.driver.quit() # time.sleep(3) # self.todaySport = BaseDriver.andriod_driver().to_mine_sport_page() # else: # pass self.logInfo = LogInfo()
def setup(self): # print ("这是运动类") # self.sport_page.get_device_state_custom() sport_icon = self.sport_page.get_sport_icon() if sport_icon is None: self.sport_page.driver.quit() time.sleep(3) self.sport_page = BaseDriver.andriod_driver().to_sport_page() else: pass self.logInfo = LogInfo()
def setup(self): message_icon = self.message.get_message_icon() if message_icon is None: self.message = BaseDriver.andriod_driver().to_mine_page() else: pass self.logInfo = LogInfo()
def setup_class(cls): print("开始执行初次安装") cls.filepath = FileConfig().get_path(type="apk") cls.logInfo = LogInfo() # cls.path = ("../com.xiaomi.hm.health.apk") cls.check_command = "adb shell pm path com.xiaomi.hm.health" cls.install_command = "adb install " + cls.filepath cls.uninstall_command = "adb uninstall com.xiaomi.hm.health"
class TestFriendsCase: @classmethod def setup_class(cls): cls.friends = BaseDriver.andriod_driver().to_mine_friends_page() # cls.logInfo = LogInfo() def setup(self): my_friends_icon = self.friends.get_first_friend_name() if my_friends_icon is None: self.friends = BaseDriver.andriod_driver().to_mine_friends_page() else: pass self.logInfo = LogInfo() @allure.story("亲友-亲友详情页测试") @allure.severity('critical') @allure.issue('http://www.baidu.com', '问题') @allure.testcase('http://www.sina.com', '测试用例') @pytest.mark.smoke @pytest.mark.core @pytest.mark.release @pytest.mark.mineP0 def test_care(self): """ 跳转亲友详情页 :return: 是否成功跳转到亲友详情页面 """ first_name = self.friends.get_first_friend_name() first_steps = self.friends.get_first_friend_steps() first_sleep = self.friends.get_first_friend_sleep() first_weight = self.friends.get_first_friend_weight() self.friends.click_first_friend_layout() person_name = self.friends.get_person_name() person_steps = self.friends.get_person_steps() person_sleep = self.friends.get_person_sleep() person_weight = self.friends.get_person_weight() self.friends.save_screenshots("查看跳转亲友详情页截图") self.logInfo.logEnd("查看亲友详情页日志") assert first_name == person_name and first_steps == person_steps and first_sleep == person_sleep and first_weight == person_weight @classmethod def teardown_class(cls): # cls.friends.click_back_by_native(type="friend") cls.friends.driver.quit()
class TestTodaySportCase: @classmethod def setup_class(cls): cls.todaysport = BaseDriver.andriod_driver().to_mine_sport_page() # cls.logInfo = LogInfo() def setup(self): # print ("这是运动类") # self.sport_page.get_device_state_custom() # sport_icon = self.todaySport.get_sport_icon() # if sport_icon is None: # self.todaySport.driver.quit() # time.sleep(3) # self.todaySport = BaseDriver.andriod_driver().to_mine_sport_page() # else: # pass self.logInfo = LogInfo() @allure.story("我的运动今日运动历史列表页跳转测试") @allure.severity("block") # @pytest.mark.smoke #重复 @pytest.mark.sportNormal def test_today_sports(self): """ 测试我的运动看今日运动页面跳转 :return:跳转成功,且跳转前与跳转后运动数值相同即为通过 """ today_sport_title = self.todaysport.get_today_sport_title() self.todaysport.to_today_sport_page() today_all_sports_run_mile = self.todaysport.get_today_all_sport_run_mile( ) print(today_sport_title) print(today_all_sports_run_mile) self.todaysport.save_screenshots("今日运动所有运动公里数截图") self.logInfo.logEnd("今日运动所有运动公里数日志") # assert today_sport_title == today_all_sports_run_mile @classmethod def teardown_class(cls): cls.todaysport.click_back_by_native(type="left_btn") cls.todaysport.driver.quit()
class TestTodayStepsCase: @classmethod def setup_class(cls): cls.todaySteps = BaseDriver.andriod_driver().to_today_steps_page() # cls.logInfo = LogInfo() def setup(self): # print ("这是今日步数类") # self.todaySteps.get_device_state_custom() statistics_icon = self.todaySteps.get_statistics_icon() if statistics_icon is None: self.todaySteps = BaseDriver.andriod_driver().to_today_steps_page() else: pass self.logInfo = LogInfo() @allure.story("今日步数-分享页面测试") @allure.severity('Normal') @pytest.mark.sportNormal @pytest.mark.smoke # @allure.issue('http://www.baidu.com',"问题") # @allure.testcase('http://www.sina.com', '测试用例') def test_share(self): """ 测试今日步数页面,点击分享按钮,跳转到分享页面,对两侧数值的一致性进行验证 :return: 两侧数据一致,PASS """ steps_before = self.todaySteps.get_steps_today_page() self.todaySteps.click_share_btn() steps_after = self.todaySteps.get_share_steps() self.todaySteps.save_screenshots("今日步数页面分享截图") self.logInfo.logEnd("今日步数页面分享日志") self.todaySteps.click_back_by_native(type="title") assert steps_before == steps_after @allure.story("今日步数-今日统计页面测试") @pytest.mark.smoke def test_count_today_day_steps(self): """ 测试今日步数统计页面每日点击切换结果 :return: 点击后页面可查找到符合结果特殊字符即为通过 """ self.todaySteps.click_statistics_btn() day_count = self.todaySteps.get_step_statistics() self.todaySteps.save_screenshots("今日步数统计日页面截图") self.logInfo.logEnd("今日步数根据日统计") self.todaySteps.click_back_by_native(type="left_btn") if "-" not in day_count and "日" in day_count: assert "日", "月" in day_count @pytest.mark.smoke @allure.story("今日步数-统计分享页面测试") @allure.severity('Normal') @pytest.mark.sportNormal def test_share_day_count(self): """ 测试今日步数日统计活动时长,活动历程,消耗千卡 :return: 分享前与分享后数值相等即为通过 """ self.todaySteps.click_statistics_btn() self.todaySteps.click_statistics_day() day_active_steps = self.todaySteps.get_day_active_steps() day_active_steps = del_symbol(day_active_steps) day_active_time = self.todaySteps.get_day_active_time() day_active_miles = self.todaySteps.get_day_active_miles() day_active_carolie = self.todaySteps.get_day_use_calorie() time.sleep(2) self.todaySteps.click_share_btn() share_active_steps = self.todaySteps.get_day_share_steps() share_active_times = self.todaySteps.get_day_share_times() share_active_miles = self.todaySteps.get_day_share_miles() share_active_carolie = self.todaySteps.get_day_share_carolie() time.sleep(2) self.todaySteps.save_screenshots("今日步数统计日页面分享截图") self.logInfo.logEnd("今日步数根据日统计分享") self.todaySteps.day_share_back_btn() self.todaySteps.click_back_by_native(type="left_btn") self.todaySteps.click_back_by_native(type="left_btn") assert day_active_steps in share_active_steps and \ share_active_miles == day_active_miles and day_active_carolie == share_active_carolie # and day_active_time == share_active_times @allure.story("今日步数-周统计页面测试") @pytest.mark.smoke def test_count_today_week_steps(self): """ 测试今日步数统计页面每周点击切换结果 :return: 点击后页面可查找到符合结果特殊字符即为通过 """ self.todaySteps.click_statistics_btn() self.todaySteps.click_week_statistics() day_count = self.todaySteps.get_step_statistics() self.todaySteps.save_screenshots("今日步数统计周页面截图") self.logInfo.logEnd("今日步数根据周统计日志") self.todaySteps.click_back_by_native(type="left_btn") if "-" in day_count: assert "日", "月" in day_count @allure.story("今日步数-周统计页面分享测试") @pytest.mark.smoke def test_share_week_count(self): """ 测试今日步数周活动时长,活动历程,消耗千卡 :return: 分享前与分享后数值相等即为通过 """ self.todaySteps.click_statistics_btn() self.todaySteps.click_week_statistics() week_active_miles = self.todaySteps.get_week_active_miles() week_active_carolie = self.todaySteps.get_week_active_carolie() time.sleep(2) self.todaySteps.click_share_btn() share_week_miles = self.todaySteps.get_week_share_miles() share_week_carolie = self.todaySteps.get_week_share_carolie() self.todaySteps.save_screenshots("今日步数统计周页面分享截图") self.logInfo.logEnd("今日步数根据周统计分享日志") self.todaySteps.click_week_back_btn() self.todaySteps.click_back_by_native(type="left_btn") assert share_week_miles == week_active_miles and share_week_carolie == week_active_carolie @allure.story("今日步数-月统计页面测试") @pytest.mark.smoke def test_count_today_month_steps(self): """ 测试今日步数统计页面每月点击切换结果 :return: 点击后页面可查找到符合结果特殊字符即为通过 """ self.todaySteps.click_statistics_btn() self.todaySteps.click_month_statistics() day_count = self.todaySteps.get_step_statistics() self.todaySteps.save_screenshots("今日步数统计月页面截图") self.logInfo.logEnd("今日步数根据月统计") self.todaySteps.click_back_by_native(type="left_btn") if "年" in day_count: assert "年", "月" in day_count @allure.story("今日步数-月统计分享页面测试") @pytest.mark.smoke def test_share_month_count(self): """ 测试今日步数月活动时长,活动历程,消耗千卡 :return: 分享前与分享后数值相等即为通过 """ self.todaySteps.click_statistics_btn() self.todaySteps.click_month_statistics() month_active_miles = self.todaySteps.get_month_active_miles() month_active_carolie = self.todaySteps.get_month_active_carolie() time.sleep(2) self.todaySteps.click_share_btn() share_month_miles = self.todaySteps.get_month_share_miles() share_month_carolie = self.todaySteps.get_month_share_carolie() self.todaySteps.day_share_back_btn() self.todaySteps.click_back_by_native(type="left_btn") assert month_active_carolie == share_month_carolie and month_active_miles == share_month_miles # @allure.story("今日步数-统计-日视图页面测试") # @allure.severity('Blocker') # # @allure.issue('http://www.baidu.com',"问题") # # @allure.testcase('http://www.sina.com', '测试用例') # def test_share(self): # """ # 测试今日步数,统计页面,日试图,界面跳转 # :return:可以正确进入统计日试图,PASS # """ # self.todaySteps.click_statistics_btn() # #暂时无法定位日视图的控件,暂时不写 # self.todaySteps.save_screenshots("今日步数页面分享截图") # self.logInfo.logEnd("今日步数页面分享日志") # assert steps_before == steps_after @classmethod def teardown_class(cls): cls.todaySteps.click_back_by_native(type='left') cls.todaySteps.driver.quit()
def setup_class(cls): print("开始执行覆盖安装") cls.filepath = FileConfig().get_path(type="apk") cls.logInfo = LogInfo() cls.command = "adb install -r " + cls.filepath
class TestMyDynamic: """ 测试我的tab下我的动态下动态展示和帖子点赞评论删除操作 """ @classmethod def setup_class(cls): cls.dynamic = BaseDriver.andriod_driver().to_my_dynamic_page() # cls.logInfo = LogInfo() def setup(self): edit_profile_icon = self.dynamic.get_edit_profile_icon() if edit_profile_icon is None: self.dynamic = BaseDriver.andriod_driver().to_my_dynamic_page() else: pass self.logInfo = LogInfo() @allure.story("个人主页-动态tab下帖子跳转功能测试") @allure.severity('critical') @pytest.mark.smoke def test_dynamic_page(self): """ 查看个人主页-动态tab下帖子跳转功能 :return: 是否成功跳转到帖子页面 """ time.sleep(1) first_name = self.dynamic.get_first_post_name() self.dynamic.to_post_page() time.sleep(1) self.dynamic.swipe_on(direction='down') nick_name = self.dynamic.get_publisher_name() self.dynamic.save_screenshots("查看个人主页-动态tab下帖子跳转功能截图") self.logInfo.logEnd("查看个人主页-动态tab下帖子跳转功能日志") self.dynamic.click_back_by_native() assert first_name == nick_name @allure.story("个人主页-动态tab下帖子点赞测试") @pytest.mark.smoke def test_dynamic_like_post(self): """ 测试对社区帖子进行点赞 :return:若帖子点赞数为0则点赞后数量为1,若>0,则点赞后结果加一,或取消点赞,结果减一 """ self.dynamic.to_post_page() before_press_like_btn = self.dynamic.get_like_btn_value() if before_press_like_btn == "点赞": self.dynamic.click_like_btn() time.sleep(1) after_press_like_btn = self.dynamic.get_like_btn_value() self.dynamic.save_screenshots("社区tab帖子点赞功能截图") self.logInfo.logEnd("社区tab帖子点赞功能日志") assert after_press_like_btn == '1' else: before_press_like_btn = int(before_press_like_btn) self.dynamic.save_screenshots("社区tab帖子点赞功能截图") self.logInfo.logEnd("社区tab帖子点赞功能日志") self.dynamic.click_like_btn() time.sleep(1) after_press_like_btn = int(self.dynamic.get_like_btn_value()) assert after_press_like_btn == before_press_like_btn + 1 \ or after_press_like_btn == before_press_like_btn - 1 @allure.story("个人主页-动态tab下帖子评论功能测试") @pytest.mark.smoke def test_dynamic_comment_post(self): """ 测试对帖子评论功能 :return:帖子评论数为0时,评论后返回结果为1,或当前评论数>1时,返回结果为评论数+1即为通过 """ self.dynamic.to_post_page() before_comment_value = self.dynamic.get_comment_value() if before_comment_value == "评论": self.dynamic.click_to_comment_page() self.dynamic.edit_comment() self.dynamic.press_comment_btn() after_comment_value = self.dynamic.get_comment_value() self.dynamic.save_screenshots("社区tab帖子评论功能截图") self.logInfo.logEnd("社区tab帖子评论功能日志") assert after_comment_value == '1' else: before_comment_value = int(before_comment_value) self.dynamic.click_to_comment_page() self.dynamic.edit_comment() self.dynamic.press_comment_btn() after_comment_value = int(self.dynamic.get_comment_value()) assert after_comment_value == before_comment_value + 1 @allure.story("个人主页-动态tab下帖子删除功能测试") @pytest.mark.smoke def test_dynamic_delete_post(self): """ 测试社区删帖功能 :return:删帖前当前帖子发布者名称与删帖后贴子发布者名称不同即为pass """ now_my_dynamic_num = int(self.dynamic.get_my_dynamic_num_value()) time.sleep(2) before_dynamic_index = self.dynamic.get_my_dynamic_index() self.dynamic.to_post_page() if now_my_dynamic_num == 1: self.dynamic.click_share_btn() self.dynamic.click_delete_btn() self.dynamic.click_confirm_delete_btn() after_dynamic_index = self.dynamic.get_my_dynamic_index() self.dynamic.save_screenshots("社区tab帖子删除功能截图") self.logInfo.logEnd("社区tab帖子删除功能日志") assert len( before_dynamic_index) == 1 and after_dynamic_index is None else: now_publisher_name = self.dynamic.get_publisher_name() self.dynamic.click_share_btn() self.dynamic.click_delete_btn() self.dynamic.click_confirm_delete_btn() after_publisher_name = self.dynamic.get_publisher_name() self.dynamic.save_screenshots("社区tab帖子删除功能截图") self.logInfo.logEnd("社区tab帖子删除功能日志") assert now_publisher_name != after_publisher_name @classmethod def teardown_class(cls): cls.dynamic.driver.quit()
class TestCourseCase: @classmethod def setup_class(cls): cls.course = BaseDriver.andriod_driver().to_mine_course_page() # cls.course = CoursePage(cls.driver) # cls.logInfo = LogInfo() def setup(self): my_course_icon = self.course.get_add_course_icon() if my_course_icon is None: self.course = BaseDriver.andriod_driver().to_mine_course_page() else: pass self.logInfo = LogInfo() @allure.story("我的课程-添加课程测试") @allure.severity('critical') @allure.issue('http://www.baidu.com', '问题') @allure.testcase('http://www.sina.com', '测试用例') @pytest.mark.smoke @pytest.mark.core @pytest.mark.release @pytest.mark.mineP0 def test_add_course(self): """ 添加课程 备注:当课程列表第一个为付费课程时,则无法添加课程 :return: 是否成功添加课程 """ time.sleep(2) self.course.to_add_course_list() self.course.click_yoga_tab() # self.course.find_free_course() # time.sleep(10) # self.course.click_free_course_label() first_course_name = self.course.get_first_course_list_name() if first_course_name == "New": first_course_name = self.course.get_first_course_list_name_2() self.course.to_first_course_list() course_name = self.course.get_course_name() if first_course_name == course_name: self.course.add_coursec_btn() self.course.click_back_by_native() self.course.click_back_by_native(type='left') mine_course_first_name = self.course.get_first_course_name() self.course.save_screenshots("查看跳转课程详情页截图") self.logInfo.logEnd("查看课程详情页日志") # self.course.click_back_by_native(type='left') assert mine_course_first_name == first_course_name @allure.story("我的课程-课程详情页测试") @allure.severity('critical') @allure.issue('http://www.baidu.com', '问题') @allure.testcase('http://www.sina.com', '测试用例') @pytest.mark.smoke @pytest.mark.core @pytest.mark.release @pytest.mark.mineP0 def test_course_page(self): """ 跳转课程详情页 :return: 是否成功跳转到课程详情页面 """ time.sleep(2) # self.course.click_to_my_course() # self.course.to_add_course_list() first_name = self.course.get_first_course_name() self.course.to_first_course_page() second_name = self.course.get_course_name() self.course.save_screenshots("查看跳转课程详情页截图") self.logInfo.logEnd("查看课程详情页日志") self.course.click_back_by_native() assert first_name == second_name @allure.story("我的课程-观看课程测试") @allure.severity('critical') @pytest.mark.smoke def test_watch_course(self): """ 测试观看课程 :return:播放视频后查找到播放视频整体surface元素即为通过 """ self.course.to_first_course_page() time.sleep(3) self.course.click_to_course_list() self.course.click_to_watch_video() video_play_judge = self.course.get_video_play_element() self.course.click_to_pause_video() self.course.click_to_exit_video() self.course.click_feedback() self.course.save_screenshots("课程详情视频播放页截图") self.logInfo.logEnd("课程详情视频播放页日志") self.course.click_back_by_native() assert video_play_judge is not None @allure.story("我的课程-退出课程测试") @allure.severity('critical') @pytest.mark.smoke def test_exit_course(self): """ 测试退出课程 :return: """ self.course.to_first_course_page() time.sleep(1) self.course.click_more_btn() self.course.click_exit_course_btn() after_exit_course = self.course.get_course_info() self.course.save_screenshots("退出课程课程详情页截图") self.logInfo.logEnd("退出课程日志") self.course.click_back_by_native() assert after_exit_course is not None and after_exit_course == "学习课程" @allure.story("我的课程-添加付费课程测试") @allure.severity('critical') @pytest.mark.smoke def test_add_pay_course(self): """ 添加付费课程 :return: 调起收银台即为通过 """ time.sleep(3) self.course.to_add_course_list() self.course.click_all_tab() self.course.find_quality_goods() self.course.click_quality_goods_label() pay_course_info = self.course.get_buy_course_info() self.course.click_to_pay_page() time.sleep(1) ensure_btn = self.course.get_confirm_pay_btn() self.course.save_screenshots("查看购买付费课程页截图") self.logInfo.logEnd("查看购买付费课程页日志") assert pay_course_info == "购买课程" and ensure_btn == "确认支付" @classmethod def teardown_class(cls): cls.course.click_back_by_native(type='left') cls.course.driver.quit()
class TestLastSleep: @classmethod def setup_class(cls): cls.last_sleep = BaseDriver.andriod_driver().to_my_status_sleep_page() # cls.logInfo = LogInfo() def setup(self): share_icon = self.last_sleep.get_sleep() if share_icon is None: self.last_sleep = BaseDriver.andriod_driver().to_my_status_sleep_page() else: pass self.logInfo = LogInfo() @allure.story("昨晚睡眠-视图切换页面测试") @allure.severity('Blocker') @pytest.mark.sleepNormal #@pytest.mark.smoke def test_last_sleep_day_view(self): """ 测试昨晚睡眠日视图切换 :return:查找到睡眠得分即为通过 """ self.last_sleep.click_day_btn() last_sleep_score = self.last_sleep.get_sleep_score() edit_icon = self.last_sleep.get_edit_icon() self.last_sleep.save_screenshots("昨晚睡眠页面日视图截图") self.logInfo.logEnd("昨晚睡眠页面日视图日志") assert last_sleep_score is not None and edit_icon is not None #@pytest.mark.smoke def test_last_week_day_view(self): """ 测试昨晚睡眠周统计视图 :return: 点击后若页面展示周睡眠统计即为pass """ self.last_sleep.click_week_btn() click_week_result = self.last_sleep.get_click_result() self.last_sleep.save_screenshots("昨晚睡眠页面周视图截图") self.logInfo.logEnd("昨晚睡眠页面周视图日志") assert click_week_result == "周睡眠统计" #@pytest.mark.smoke def test_last_month_day_view(self): """ 测试昨晚睡眠月统计视图 :return: 点击后若页面展示月睡眠统计即为pass """ self.last_sleep.click_month_btn() click_month_result = self.last_sleep.get_click_result() self.last_sleep.save_screenshots("昨晚睡眠页面月视图截图") self.logInfo.logEnd("昨晚睡眠页面月视图日志") assert click_month_result == "月睡眠统计" #@pytest.mark.smoke def test_last_year_day_view(self): """ 测试昨晚睡眠年统计视图 :return: 点击后若页面展示年睡眠统计即为pass """ self.last_sleep.click_year_btn() click_tear_result = self.last_sleep.get_click_result() self.last_sleep.save_screenshots("昨晚睡眠页面年视图截图") self.logInfo.logEnd("昨晚睡眠页面年视图日志") assert click_tear_result == "年睡眠统计" @classmethod def teardown_class(cls): cls.last_sleep.click_back_by_native(type='left') cls.last_sleep.driver.quit()
def setup_class(cls): # self.login_page = BaseDriver().andriod_driver(i=get_devices_list).to_login_page() # self.logInfo = LogInfo() cls.driver = BaseDriver.andriod_driver() cls.login_page = cls.driver.to_login_page() cls.logInfo = LogInfo()
class TestSportCase: @classmethod def setup_class(cls): cls.sport_page = BaseDriver.andriod_driver().to_sport_page() # cls.logInfo = LogInfo() def setup(self): # print ("这是运动类") # self.sport_page.get_device_state_custom() sport_icon = self.sport_page.get_sport_icon() if sport_icon is None: self.sport_page.driver.quit() time.sleep(3) self.sport_page = BaseDriver.andriod_driver().to_sport_page() else: pass self.logInfo = LogInfo() @allure.story("首页点击步数进入今日步数页面测试") @allure.severity('Blocker') # @allure.issue('http://www.baidu.com',"问题") # @allure.testcase('http://www.sina.com', '测试用例') @pytest.mark.sportP0 @pytest.mark.core @pytest.mark.release @pytest.mark.smoke def test_steps_page(self): """ 测试从首页点击步数,进入今日详情页,对两侧步数是否一致进行验证 :return: 两侧数据一致时,代表PASS """ steps_nums = self.sport_page.get_steps_main_page() steps_num = int(del_symbol(steps_nums)) if steps_num > 0: self.sport_page.click_steps_layout() steps = int(self.sport_page.get_steps_today()) isSuccess = (steps_num == steps) else: #此时没有产生步数,不知道文案,暂时标为失败 isSuccess = False self.sport_page.save_screenshots("进入今日步数详情页截图") self.logInfo.logEnd("进入今日步数详情页日志") self.sport_page.click_back_by_native("left_btn") assert isSuccess is True # @allure.story("首页点击睡眠卡片进入昨晚睡眠页面测试") # @allure.severity('Blocker') # def test_last_sleep_time(self): # """ # 测试从首页点击昨晚睡眠长卡片,进入昨晚睡眠页面,对两侧睡眠时长是否一致进行验证 # :return: 两侧数值一致时,PASS # """ # sleep_time_mian_page = self.sport_page.get_sleep_time_main_page() # sleep_before = sleep_time_mian_page.split(" ")[1] # self.sport_page.click_first_layout() # sleep_time_mine_page = self.sport_page.get_sleep_time_mine() # # sleep_middle = del_symbol(sleep_time_mine_page) # # sleep_after = del_str(sleep_middle, " ") # self.sport_page.save_screenshots("从首页点击睡眠卡片进入昨晚睡眠截图") # self.logInfo.logEnd("从首页点击睡眠卡片进入昨晚睡眠日志") # self.sport_page.click_back_by_native("left_btn") # assert sleep_before == sleep_time_mine_page @allure.story("首页点击体重卡片进入体重详情页面测试") @allure.severity('Blocker') # @allure.issue('http://www.baidu.com',"问题") # @allure.testcase('http://www.sina.com', '测试用例') @pytest.mark.sportP0 @pytest.mark.core @pytest.mark.release # @pytest.mark.smoke #首页布局不固定,当前账号暂不修改布局 @pytest.mark.skip #首页布局原因 def test_weight(self): """ 测试从首页点击体重卡片,进入体重详情页,对两侧数值是否一致进行验证 :return:两侧数值一致时,PASS """ weight_main_page = self.sport_page.get_weight_main_page() weight_temp = weight_main_page.split(" ")[1] # self.sport_page.to_mine_status_page() self.sport_page.click_weight_layout() weight_mine_page = self.sport_page.get_weight_mine_page() + "斤" self.sport_page.save_screenshots("进入体重详情页截图") self.logInfo.logEnd("进入体重详情页日志") self.sport_page.click_back_by_native("left_btn") assert weight_temp == weight_mine_page @allure.story("进行健走测试") @allure.severity('Blocker') @pytest.mark.core @pytest.mark.release @pytest.mark.smoke @pytest.mark.sportP0 def test_work_page(self): temp = self.sport_page.to_work_page() self.sport_page.save_screenshots("进行健走截图") self.logInfo.logEnd("进行健走日志") assert temp is True @allure.story("进行室外跑测试") @allure.severity('Blocker') @pytest.mark.core @pytest.mark.release @pytest.mark.smoke @pytest.mark.sportP0 def test_outdoor_run_page(self): temp = self.sport_page.to_run_outdoor_page() self.sport_page.save_screenshots("进行室外跑截图") self.logInfo.logEnd("进行室外跑日志") assert temp is True @allure.story("进行室内跑测试") @allure.severity('Blocker') @pytest.mark.core @pytest.mark.release # @pytest.mark.smoke #元素未找到 @pytest.mark.sportP0 def test_indoor_run_page(self): temp = self.sport_page.to_run_indoor_page() self.sport_page.save_screenshots("进行室内跑截图") self.logInfo.logEnd("进行室内跑日志") assert temp is True @allure.story("进行骑行测试") @allure.severity('Blocker') @pytest.mark.core @pytest.mark.release # @pytest.mark.smoke #元素未找到 @pytest.mark.sportP0 def test_cycling_page(self): temp = self.sport_page.to_cycling_page() self.sport_page.save_screenshots("进行骑行截图") self.logInfo.logEnd("进行骑行日志") assert temp is True @allure.story("查找运动tab页广告位") @allure.severity('Normal') @pytest.mark.dependency() @pytest.mark.sportNormal def test_find_ad(self): self.sport_page.to_status_page() # 获取广告控件 if self.sport_page.get_ad_element() is None: is_have_ad = False else: is_have_ad = True assert is_have_ad is True @allure.story("进入首页广告页测试") @allure.severity('Normal') @pytest.mark.flaky(reruns=2, reruns_delay=3) @pytest.mark.dependency(depends=['TestSportCase::test_find_ad']) @pytest.mark.sportNormal def test_ad_page(self): self.sport_page.to_advertisement_page() time.sleep(2) back_btn = self.sport_page.get_back_btn() ad_back_btn = self.sport_page.get_ad_back_btn() self.sport_page.save_screenshots("进入首页广告截图") self.logInfo.logEnd("进入首页广告日志") if back_btn is not None: self.sport_page.click_back_btn() else: self.sport_page.click_back_by_native(type="back") assert back_btn is not None or ad_back_btn is not None @allure.story("进入首页大家都在练-长卡片测试") @allure.severity('Normal') @pytest.mark.dependency() @pytest.mark.flaky(reruns=2, reruns_delay=5) @pytest.mark.sportNormal def test_practice_long_card(self): time.sleep(5) self.sport_page.swipe_on("up_middle") self.sport_page.to_practice_long_card() back_btn = self.sport_page.get_classic_back_btn() time.sleep(2) self.sport_page.save_screenshots("进入首页大家都在练长卡片截图") self.logInfo.logEnd("进入首页大家都在练长卡片日志") self.sport_page.click_classic_back_btn() assert back_btn is not None @allure.story("进入首页大家都在练-短卡片1测试") @allure.severity('Normal') @pytest.mark.dependency(depends=["TestSportCase::test_practice_long_card"]) @pytest.mark.flaky(reruns=2, reruns_delay=5) @pytest.mark.sportNormal def test_practice_short_card_1(self): time.sleep(5) self.sport_page.swipe_on("up_middle") self.sport_page.to_practice_short_card_1() back_btn = self.sport_page.get_classic_back_btn() time.sleep(2) self.sport_page.save_screenshots("进入首页大家都在练-短卡片1截图") self.logInfo.logEnd("进入首页大家都在练-短卡片1日志") self.sport_page.click_classic_back_btn() assert back_btn is not None @allure.story("进入首页大家都在练-短卡片2测试") @allure.severity('Normal') @pytest.mark.dependency( depends=["TestSportCase::test_practice_short_card_1"]) @pytest.mark.flaky(reruns=2, reruns_delay=5) @pytest.mark.sportNormal def test_practice_short_card_2(self): # time.sleep(5) # self.sport_page.swipe_on("up_middle") self.sport_page.to_practice_short_card_2() back_btn = self.sport_page.get_classic_back_btn() time.sleep(2) self.sport_page.save_screenshots("进入首页大家都在练-短卡片2截图") self.logInfo.logEnd("进入首页大家都在练-短卡片2日志") self.sport_page.click_classic_back_btn() assert back_btn is not None @pytest.mark.skip(reason="暂时没有赛事活动模块") @allure.story("进入首页赛事活动页面测试") @allure.severity('Normal') @pytest.mark.sportNormal def test_premitition_page(self): # time.sleep(5) # self.sport_page.swipe_on("up_middle") # time.sleep(3) # self.sport_page.swipe_on("up_middle") self.sport_page.to_competition_activity_page() back_btn = self.sport_page.get_back_btn() time.sleep(5) self.sport_page.save_screenshots("进入首页赛事活动页面截图") self.logInfo.logEnd("进入首页赛事活动页面日志") self.sport_page.click_back_btn() assert back_btn is not None # @allure.story("进入首页热门话题第一部分详情页测试") # @allure.severity('Normal') # def test_hot_topic_first_page(self): # time.sleep(5) # self.sport_page.swipe_on("up_middle") # time.sleep(2) # self.sport_page.swipe_on("up_middle") # time.sleep(2) # self.sport_page.swipe_on("up_middle") # time.sleep(2) # self.sport_page.swipe_on("up_middle") # # nick_element = self.sport_page.get_nick_element() # # self.sport_page.find_element_to_element(nick_element) # nick_name = self.sport_page.get_hot_topic_nick_name() # self.sport_page.to_hot_topic_first_card() # nick_name_page = self.sport_page.get_topic_page_nick_name() # time.sleep(3) # self.sport_page.save_screenshots("进入首页热门话题第一部分详情页截图") # self.logInfo.logEnd("进入首页热门话题第一部分详情页日志") # assert nick_name == nick_name_page # # @allure.story("进入首页热门话题第二部分详情页测试") # @allure.severity('Normal') # def test_hot_topic_second_page(self): # time.sleep(5) # self.sport_page.swipe_on("up_middle") # time.sleep(2) # self.sport_page.swipe_on("up_middle") # time.sleep(2) # self.sport_page.swipe_on("up_middle") # time.sleep(2) # self.sport_page.swipe_on("up_middle") # # nick_element = self.sport_page.get_nick_element() # # self.sport_page.find_element_to_element(nick_element) # nick_name = self.sport_page.get_second_nick_name() # self.sport_page.to_hot_topic_second_card() # nick_name_page = self.sport_page.get_topic_page_nick_name() # time.sleep(3) # self.sport_page.save_screenshots("进入首页热门话题第二部分详情页截图") # self.logInfo.logEnd("进入首页热门话题第二部分详情页日志") # assert nick_name == nick_name_page # # @allure.story("进入首页热门话题第三部分详情页测试") # @allure.severity('Normal') # def test_hot_topic_third_page(self): # time.sleep(5) # self.sport_page.swipe_on("up_middle") # time.sleep(2) # self.sport_page.swipe_on("up_middle") # time.sleep(2) # self.sport_page.swipe_on("up_middle") # time.sleep(2) # self.sport_page.swipe_on("up_middle") # time.sleep(2) # self.sport_page.swipe_on("up_middle") # # nick_element = self.sport_page.get_nick_element() # # self.sport_page.find_element_to_element(nick_element) # nick_name = self.sport_page.get_third_nick_name() # self.sport_page.to_hot_topic_third_card() # nick_name_page = self.sport_page.get_topic_page_nick_name() # time.sleep(3) # self.sport_page.save_screenshots("进入首页热门话题第三部分详情页截图") # self.logInfo.logEnd("进入首页热门话题第三部分详情页日志") # assert nick_name == nick_name_page @classmethod def teardown_class(cls): cls.sport_page.driver.quit()
class TestMyStatus(): """ 运动模块-我的状态测试 """ @classmethod def setup_class(cls): cls.my_status = BaseDriver.andriod_driver().to_my_status_page() def setup(self): my_status_icon = self.my_status.get_my_status_icon() if my_status_icon is None: self.my_status = BaseDriver.andriod_driver().to_my_status_page() else: pass self.logInfo = LogInfo() @pytest.mark.smoke # @pytest.mark.skip(reason="滑动到指定元素的方法还需要优化,此用例跳过") def test_pai_value(self): """ 测试pai值我的状态页面展示数值与点击进入后数值 :return: 一致则通过 """ self.my_status.swipe_on(direction="up") get_before_all_pai_value = self.my_status.get_before_pai_value() get_before_today_pai_value = self.my_status.get_today_pai_value() self.my_status.click_to_pai_page() judge_if_pai_guide_exist = self.my_status.find_pai_guide_element() if judge_if_pai_guide_exist is not None: self.my_status.swipe_on("up") get_after_all_pai_value = self.my_status.get_after_all_pai_value() get_after_today_pai_value = self.my_status.get_after_today_pai_value() get_after_today_pai_value = get_after_today_pai_value.split("P")[0] self.my_status.save_screenshots("查看运动-我的状态-PAI值截图") self.logInfo.logEnd("查看运动-我的状态-PAI值日志") self.my_status.click_back_by_native(type="left_btn") time.sleep(1) assert get_after_all_pai_value in get_before_all_pai_value and \ get_after_today_pai_value in get_before_today_pai_value @pytest.mark.smoke def test_press_value(self): """ 测试运动-我的状态-压力值和点击进入后压力值 :return: 数值一致即为通过 """ self.my_status.swipe_on(direction="down") get_before_press = self.my_status.get_before_recent_press() self.my_status.click_to_press_page() get_after_press = self.my_status.get_after_recent_press() self.my_status.save_screenshots("查看运动-我的状态-压力值截图") self.logInfo.logEnd("查看运动-我的状态-压力值日志") self.my_status.click_back_by_native(type="left_btn") time.sleep(1) assert get_after_press in get_before_press @pytest.mark.smoke def test_heart_rate(self): """ 测试运动-我的状态-心率数值和点击进入后数值 :return: 进入前后心率数值相同即为通过 """ get_before_heart_rate = self.my_status.get_before_heart_rate() self.my_status.click_to_heart_rate_page() time.sleep(1) get_after_heart_rate = self.my_status.get_after_heart_rate() self.my_status.save_screenshots("查看运动-我的状态-心率截图") self.logInfo.logEnd("查看运动-我的状态-心率日志") self.my_status.click_back_by_native(type="left_btn") assert get_after_heart_rate in get_before_heart_rate # @pytest.mark.smoke #展示用暂时注释,需考虑无数据时场景 @pytest.mark.skip(reason="暂无睡眠数据") def test_last_sleep(self): """ 测试运动-我的状态-睡眠卡片跳转 :return:跳转前与跳转后睡眠时间相同即为通过 """ # get_sleep_element = self.my_status.find_before_last_sleep_element() self.my_status.swipe_to_half() get_before_sleep_time = self.my_status.get_before_sleep_time() get_before_sleep_time = get_before_sleep_time.split("昨晚睡眠 ")[1] self.my_status.click_to_sleep_page() get_after_sleep_time = self.my_status.get_after_sleep_time() self.my_status.save_screenshots("查看运动-我的状态-睡眠截图") self.logInfo.logEnd("查看运动-我的状态-睡眠日志") self.my_status.click_back_by_native(type="left_btn") assert get_before_sleep_time == get_after_sleep_time # @pytest.mark.smoke #演示原因 暂时注释 @pytest.mark.skip(reason="暂无睡眠数据") def test_a_few_sleep(self): """ 测试运动-我的状态-零星小睡跳转 :return: """ self.my_status.find_before_last_sleep_element() self.my_status.click_to_sleep_page() get_before_little_sleep = self.my_status.get_before_little_sleep_time() self.my_status.click_to_little_sleep() get_after_little_sleep = self.my_status.get_after_little_sleep_time() print(get_after_little_sleep, get_before_little_sleep) self.my_status.click_back_by_native(type="back") self.my_status.click_back_by_native(type="back") @pytest.mark.smoke # @pytest.mark.skip(reason="滑动到指定元素的方法还需要优化,此用例跳过") def test_weight_kilogram(self): """ 测试运动-我的状态-体重数值进入前与进入后 :return: 数值相同即为pass """ # self.my_status.swipe_to_bottle() self.my_status.swipe_on(direction="down") # self.my_status.find_before_weight_value() get_before_weight = self.my_status.get_before_weight_value() self.my_status.click_to_weight_page() time.sleep(1) get_after_weight = self.my_status.get_after_weight_value() self.my_status.save_screenshots("查看运动-我的状态-体重截图") self.logInfo.logEnd("查看运动-我的状态-体重日志") self.my_status.click_back_by_native(type="left_btn") assert get_after_weight in get_before_weight ''' 由于体重元素不在屏幕展示范围内,需要先执行滑动,再查找元素 待解决 ''' @pytest.mark.smoke # @pytest.mark.skip(reason="滑动到指定元素的方法还需要优化,此用例跳过") def test_body_fat(self): """ 测试运动-我的状态-身体指数卡片跳转 :return:跳转前与跳转后身体指数相同即为通过 """ # self.my_status.swipe_to_bottle() self.my_status.find_body_fat_element() before_body_fat = self.my_status.get_before_body_fat() before_body_fat = before_body_fat.split(" ")[1] self.my_status.click_to_body_fat_page() after_body_fat = self.my_status.get_after_body_fat() self.my_status.save_screenshots("查看运动-我的状态-身体指数截图") self.logInfo.logEnd("查看运动-我的状态-身体指数日志") self.my_status.click_back_by_native(type="left_btn") assert before_body_fat in after_body_fat @pytest.mark.smoke # @pytest.mark.skip(reason="滑动到指定元素的方法还需要优化,此用例跳过") def test_balance(self): """ 测试运动-我的状态-平衡性卡片跳转 :return: 点击前后页面平衡性一致即为通过 """ # self.my_status.swipe_to_bottle() self.my_status.find_balance_element() before_balance = self.my_status.get_before_balance() before_balance = before_balance.split(" ")[1] self.my_status.click_to_balance_page() time.sleep(1) after_balance = self.my_status.get_after_balance() self.my_status.save_screenshots("查看运动-我的状态-平衡性截图") self.logInfo.logEnd("查看运动-我的状态-平衡性日志") self.my_status.click_back_by_native(type="left_btn") assert after_balance in before_balance @classmethod def teardown_class(cls): cls.my_status.driver.quit()
class TestUserCase: @classmethod def setup_class(cls): cls.user_page = BaseDriver.andriod_driver().to_mine_page_user() # cls.logInfo = LogInfo() def setup(self): # print ("这是用户类") # self.user_page.get_device_state_custom() add_device_icon = self.user_page.get_add_device_icon() if add_device_icon is None: self.user_page = BaseDriver.andriod_driver().to_mine_page_user() else: pass self.logInfo = LogInfo() @allure.story("健康周报功能测试") @allure.severity('Trivial') @allure.issue('http://www.baidu.com', '问题6') @allure.testcase('http://www.sina.com', '测试用例6') @pytest.mark.smoke @pytest.mark.release @pytest.mark.core @pytest.mark.mineP0 def test_mine_report(self): """ 查看健康周报 :return: 是否成功查看健康周报页面 """ self.user_page.to_mine_report() title = self.user_page.get_title() self.user_page.save_screenshots("查看健康周报截图") self.logInfo.logEnd("查看健康周报日志") self.user_page.click_back_by_native(type='left') assert title == "健康周报" @allure.story("设置步数功能测试") @allure.severity('blocker') @allure.issue("http://www.baidu.com", '问题7') @allure.testcase("http://www.sina.com", '测试用例7') @pytest.mark.smoke @pytest.mark.release @pytest.mark.core @pytest.mark.mineP0 def test_set_steps_goal(self): """ 设置步数 :return: 是否成功设置步数 """ self.user_page.swipe_on('up') steps_before = self.user_page.get_steps_goal() self.user_page.set_goal() self.user_page.set_steps_goal() time.sleep(2) # blue_tooth_tip = self.user_page.get_blue_tooth_tip() steps_tip = self.user_page.get_steps_tip() while steps_tip is None: time.sleep(3) # blue_tooth_tip = self.user_page.get_blue_tooth_tip() steps_tip = self.user_page.get_steps_tip() time.sleep(5) self.user_page.swipe_on('up_middle') self.user_page.set_steps_goal_confirm() steps_after = self.user_page.get_steps_goal() self.user_page.save_screenshots("修改步数截图") self.logInfo.logEnd("修改步数日志") assert steps_before != steps_after @allure.story("查看订单功能测试") @allure.severity('blocker') @allure.issue("http://www.baidu.com", '问题9') @allure.testcase("http://www.sina.com", '测试用例9') @pytest.mark.smoke @pytest.mark.release @pytest.mark.core @pytest.mark.mineP0 def test_order_page(self): """ 查看订单功能 :return: 查看订单功能是否正常 """ self.user_page.swipe_on('up') self.user_page.to_order_page() title = self.user_page.get_title() self.user_page.save_screenshots("查看订单截图") self.logInfo.logEnd("查看订单日志") self.user_page.click_back_by_native(type='left') assert title == "我的订单" @allure.story("查看行为标注功能测试") @allure.severity('blocker') @allure.issue("http://www.baidu.com", '问题10') @allure.testcase("http://www.sina.com", '测试用例10') @pytest.mark.smoke @pytest.mark.release @pytest.mark.core @pytest.mark.mineP0 def test_behavior_page(self): """ 查看行为标注功能 :return: 查看行为标注是否正常 """ self.user_page.swipe_on('up') self.user_page.to_behavior_page() title = self.user_page.get_title() self.user_page.save_screenshots("查看行为标注截图") self.logInfo.logEnd("查看行为标注日志") self.user_page.click_back_by_native(type='left') assert title == "行为标注" @allure.story("查看第三方接入功能测试") @allure.severity('blocker') @allure.issue("http://www.baidu.com", '问题11') @allure.testcase("http://www.sina.com", '测试用例11') @pytest.mark.smoke @pytest.mark.release @pytest.mark.core @pytest.mark.mineP0 def test_third_page(self): """ 查看第三方接入功能 :return: 查看第三方接入功能是否正常 """ self.user_page.swipe_on('up') self.user_page.to_third() title = self.user_page.get_title() self.user_page.save_screenshots("查看第三方接入截图") self.logInfo.logEnd("查看第三方接入日志") self.user_page.click_back_by_native(type='left') assert title == "第三方接入" @allure.story("提交意见反馈功能测试") @allure.severity('blocker') @allure.issue("http://www.baidu.com", '问题12') @allure.testcase("http://www.sina.com", '测试用例12') @pytest.mark.smoke @pytest.mark.release @pytest.mark.core @pytest.mark.mineP0 def test_feed_back(self): """ 提交意见反馈功能 :return: 提交意见反馈功能是否正常 """ self.user_page.swipe_on('up') self.user_page.to_feed_back_page() self.user_page.feed_back_send_keys("测试") self.user_page.save_screenshots("提交意见反馈截图") self.user_page.to_submit() toast = self.user_page.get_toast("提交成功") # print("文案为:" + toast) self.logInfo.logEnd("提交意见反馈日志") assert toast is not None #现版本里没有此选项,4.0.19版本里恢复此功能 @allure.story("查看账号与安全功能测试") @allure.severity('blocker') @allure.issue("http://www.baidu.com", '问题13') @allure.testcase("http://www.sina.com", '测试用例13') @pytest.mark.smoke @pytest.mark.release @pytest.mark.core @pytest.mark.mineP0 def test_setting_account(self): """ 查看账号与安全 :return: 查看账号与安全是否正常 """ self.user_page.swipe_on('up') self.user_page.to_setting_page() self.user_page.to_account_page() time.sleep(1) title = self.user_page.get_title() self.user_page.save_screenshots("查看账号与安全截图") self.logInfo.logEnd("查看账号与安全日志") self.user_page.click_back_by_native(type='left') self.user_page.click_back_by_native(type='left') assert title == "账号与安全" @allure.story("查看单位功能测试") @allure.severity('blocker') @allure.issue("http://www.baidu.com", '问题14') @allure.testcase("http://www.sina.com", '测试用例14') #@pytest.mark.smoke #查找不到unit元素 @pytest.mark.release @pytest.mark.core @pytest.mark.mineP0 def test_unit(self): """ 查看单位 :return:查看单位是否正常 """ # self.user_page.swipe_on('up') self.user_page.to_setting_page() self.user_page.to_unit_page() time.sleep(2) title = self.user_page.get_title() self.user_page.save_screenshots("查看单位截图") self.logInfo.logEnd("查看单位日志") self.user_page.click_back_by_native(type='left') self.user_page.click_back_by_native(type='left') assert title == "单位" @allure.story("改变在通知栏显示连接状态功能测试") @allure.severity('blocker') @allure.issue("http://www.baidu.com", '问题15') @allure.testcase("http://www.sina.com", '测试用例15') # @pytest.mark.smoke #无法执行 @pytest.mark.release @pytest.mark.core @pytest.mark.mineP0 def test_notification_connect_switch(self): """ 改变在通知栏显示连接状态 :return: 改变在通知栏显示连接状态是否成功 """ # self.user_page.swipe_on('up') self.user_page.to_setting_page() time.sleep(3) status = self.user_page.get_switch_status() time.sleep(1) self.user_page.change_switch() time.sleep(1) self.user_page.save_screenshots("改变在通知栏显示连接状态截图") self.logInfo.logEnd("改变在通知栏显示连接状态日志") if status == 'true': assert self.user_page.get_switch_status() == 'false' else: assert self.user_page.get_switch_status() == 'true' @classmethod def teardown_class(cls): cls.user_page.driver.quit()
def setup(self): self.logInfo = LogInfo()