How to use wait_gone method in ATX

Best Python code snippet using ATX

jw_case.py

Source:jw_case.py Github

copy

Full Screen

...859 pass860 else:861 SameOperation().add_wired(u, video_camera_name)862 u.press('back')863 if u(resourceId="com.yoosee:id/ll_defence_state").wait_gone(timeout=3.0):864 u.swipe_ext("down", scale=0.8)865 u(resourceId="com.yoosee:id/tv_playback").click(timeout=8)866 u(resourceId="com.yoosee:id/tv_sdcard_playback").click(timeout=5)867 u(resourceId='com.yoosee:id/fl_videoplayer_parent').wait(timeout=5)868 timeline_icon_coordinates = u(resourceId='com.yoosee:id/fl_videoplayer_parent').center()869 u.drag(timeline_icon_coordinates[0] - 100, timeline_icon_coordinates[1], timeline_icon_coordinates[0],870 timeline_icon_coordinates[1], 0.2)871 # u(resourceId="com.yoosee:id/fl_videoplayer_parent").swipe("right", steps=10)872 sleep(5)873 u(resourceId="com.yoosee:id/rl_vedioplayer_area").click(timeout=5)874 sleep(1)875 if not u(resourceId="com.yoosee:id/iv_playback_fast").exists:876 u(resourceId="com.yoosee:id/rl_vedioplayer_area").click(timeout=5)877 sleep(1)878 sleep(3)879 pix1 = SameOperation().pixel_value(u,timeline_icon_coordinates)880 # print('pix1', pix1)881 if pix1[0] < 120 and pix1[1] < 120:882 play_status = u(resourceId="com.yoosee:id/iv_playback_fast").info883 assert play_status['enabled'] == True, '时间轴向前快速滑动没有自动播放'884 u.drag(timeline_icon_coordinates[0] + 100, timeline_icon_coordinates[1], timeline_icon_coordinates[0],885 timeline_icon_coordinates[1], 0.2)886 # u(resourceId="com.yoosee:id/fl_videoplayer_parent").swipe("left", steps=10)887 sleep(5)888 if not u(resourceId="com.yoosee:id/iv_playback_fast").exists:889 u(resourceId="com.yoosee:id/rl_vedioplayer_area").click(timeout=5)890 sleep(1)891 sleep(3)892 pix2 = SameOperation().pixel_value(u, timeline_icon_coordinates)893 # print ('pix2',pix2)894 if pix2[0] < 120 and pix2[1] < 120:895 play_status = u(resourceId="com.yoosee:id/iv_playback_fast").info896 assert play_status['enabled'] == True, '时间轴向后快速滑动没有自动播放'897 SameOperation().quit_app(u)898 @classmethod899 def jwt_38(cls, u, video_camera_name): #首次打开云回放,默认播放900 SameOperation().app_go(u)901 if u(resourceId='com.yoosee:id/setting_more_iv').wait(timeout=5):902 pass903 else:904 SameOperation().add_wired(u, video_camera_name)905 u.press('back')906 if u(resourceId="com.yoosee:id/tv_playback").wait_gone(timeout=3.0):907 u.swipe_ext("down", scale=0.8)908 u(resourceId="com.yoosee:id/tv_playback").wait(timeout=5)909 u(resourceId="com.yoosee:id/tv_playback").click(timeout=8)910 u(resourceId="com.yoosee:id/tv_cloud_playback").click(timeout=5)911 u(resourceId="com.yoosee:id/rl_functin_bar").wait(timeout=8)912 sleep(20)913 SameOperation().quit_app(u)914 @classmethod915 def jwt_39(cls, u, video_camera_name): #播放界面小控件竖屏 - 播放按钮916 SameOperation().app_go(u)917 if u(resourceId='com.yoosee:id/setting_more_iv').wait(timeout=5):918 pass919 else:920 SameOperation().add_wired(u, video_camera_name)921 u.press('back')922 if u(resourceId="com.yoosee:id/tv_playback").wait_gone(timeout=3.0):923 u.swipe_ext("down", scale=0.8)924 u(resourceId="com.yoosee:id/tv_playback").wait(timeout=5)925 u(resourceId="com.yoosee:id/tv_playback").click(timeout=8)926 u(resourceId="com.yoosee:id/tv_cloud_playback").click(timeout=5)927 u(resourceId="com.yoosee:id/rl_functin_bar").wait(timeout=8)928 sleep(10)929 if u(resourceId="com.yoosee:id/rl_functin_bar").wait_gone(timeout=3.0):930 u(resourceId="com.yoosee:id/rl_vedioplayer_area").click(timeout=5)931 # u(resourceId="com.yoosee:id/play_iv").click(timeout=5)932 stop_status = SameOperation().icon_statuscheck(u,"com.yoosee:id/play_iv")933 assert stop_status > 0,'播放状态不对'934 # sleep(8)935 # if not u(resourceId="com.yoosee:id/play_iv").exists:936 # u(resourceId="com.yoosee:id/rl_vedioplayer_area").click(timeout=5)937 # u(resourceId="com.yoosee:id/play_iv").click(timeout=5)938 SameOperation().quit_app(u)939 @classmethod940 def jwt_40(cls, u, video_camera_name): #播放界面小控件竖屏 - 暂停时按钮状态941 SameOperation().app_go(u)942 if u(resourceId='com.yoosee:id/setting_more_iv').wait(timeout=5):943 pass944 else:945 SameOperation().add_wired(u, video_camera_name)946 u.press('back')947 if u(resourceId="com.yoosee:id/tv_playback").wait_gone(timeout=3.0):948 u.swipe_ext("down", scale=0.8)949 u(resourceId="com.yoosee:id/tv_playback").click(timeout=8)950 u(resourceId="com.yoosee:id/tv_cloud_playback").click(timeout=5)951 u(resourceId="com.yoosee:id/rl_functin_bar").wait(timeout=8)952 sleep(10)953 if u(resourceId="com.yoosee:id/rl_functin_bar").wait_gone(timeout=3.0):954 u(resourceId="com.yoosee:id/rl_vedioplayer_area").click(timeout=5)955 u(resourceId="com.yoosee:id/play_iv").click(timeout=5)956 sleep(0.5)957 stop_status = SameOperation().icon_statuscheck(u,"com.yoosee:id/play_iv")958 assert stop_status > 0, '暂停状态不对'959 SameOperation().quit_app(u)960 @classmethod961 def jwt_41(cls, u, video_camera_name): #播放界面小控件竖屏 - 截图962 SameOperation().app_go(u)963 if u(resourceId='com.yoosee:id/setting_more_iv').wait(timeout=5):964 pass965 else:966 SameOperation().add_wired(u, video_camera_name)967 u.press('back')968 if u(resourceId="com.yoosee:id/tv_playback").wait_gone(timeout=3.0):969 u.swipe_ext("down", scale=0.8)970 u(resourceId="com.yoosee:id/tv_playback").click(timeout=8)971 u(resourceId="com.yoosee:id/tv_cloud_playback").click(timeout=5)972 u(resourceId="com.yoosee:id/rl_functin_bar").wait(timeout=8)973 sleep(10)974 if u(resourceId="com.yoosee:id/rl_functin_bar").wait_gone(timeout=3.0):975 u(resourceId="com.yoosee:id/rl_vedioplayer_area").click(timeout=5)976 u(resourceId="com.yoosee:id/play_iv").click(timeout=5)977 u(resourceId="com.yoosee:id/iv_palyback_screenshot_btn").click(timeout=5)978 assert u.xpath('//*[@resource-id="com.yoosee:id/rl_vedioplayer_area"]/android.widget.ImageView[1]').wait(timeout=8), '左下角没显示截图缩略图'979 SameOperation().quit_app(u)980 @classmethod981 def jwt_42(cls, u, video_camera_name): #播放界面小控件下载保存982 SameOperation().app_go(u)983 if u(resourceId='com.yoosee:id/setting_more_iv').wait(timeout=5):984 pass985 else:986 SameOperation().add_wired(u, video_camera_name)987 u.press('back')988 if u(resourceId="com.yoosee:id/tv_playback").wait_gone(timeout=3.0):989 u.swipe_ext("down", scale=0.8)990 # u(resourceId="com.yoosee:id/tv_playback").wait(timeout=5)991 # sleep(1)992 u(resourceId="com.yoosee:id/tv_playback").click(timeout=8)993 u(resourceId="com.yoosee:id/tv_cloud_playback").click(timeout=5)994 u(resourceId="com.yoosee:id/rl_functin_bar").wait(timeout=8)995 #清除下载任务996 u(resourceId="com.yoosee:id/tv_download_list").click(timeout=5)997 u(resourceId="com.yoosee:id/rbtn_right").click(timeout=5)998 if u(resourceId="com.yoosee:id/top_tv").exists:999 u(resourceId="com.yoosee:id/top_tv").click(timeout=5)1000 u(resourceId="com.yoosee:id/ll_select_all").click(timeout=5)1001 u(resourceId="com.yoosee:id/ll_delete").click(timeout=5)1002 u(resourceId="com.yoosee:id/tv_yes").click(timeout=5)1003 u(resourceId="com.yoosee:id/back_btn").click(timeout=5)1004 sleep(10)1005 if u(resourceId="com.yoosee:id/rl_functin_bar").wait_gone(timeout=3.0):1006 u(resourceId="com.yoosee:id/rl_vedioplayer_area").click(timeout=5)1007 u(resourceId="com.yoosee:id/play_iv").click(timeout=5)1008 u(resourceId="com.yoosee:id/iv_playback_to_dwonload").click(timeout=5)1009 u(resourceId="com.yoosee:id/iv_palyback_dwonload_ok").click(timeout=5)1010 u(resourceId="com.yoosee:id/tv_download_list").click(timeout=5)1011 try:1012 assert u(resourceId="com.yoosee:id/rl_download_start").wait(timeout=5), '下载中无下载任务'1013 except:1014 assert u(resourceId="com.yoosee:id/rl_download_start").wait(timeout=5), '下载中和已下载都无任务'1015 SameOperation().quit_app(u)1016 @classmethod1017 def jwt_43(cls, u, video_camera_name): #云回放切换日期到过去1018 SameOperation().app_go(u)1019 if u(resourceId='com.yoosee:id/setting_more_iv').wait(timeout=5):1020 pass1021 else:1022 SameOperation().add_wired(u, video_camera_name)1023 u.press('back')1024 if u(resourceId="com.yoosee:id/tv_playback").wait_gone(timeout=3.0):1025 u.swipe_ext("down", scale=0.8)1026 # u(resourceId="com.yoosee:id/tv_playback").wait(timeout=5)1027 u(resourceId="com.yoosee:id/tv_playback").click(timeout=8)1028 sleep(1)1029 u(resourceId="com.yoosee:id/tv_cloud_playback").click(timeout=5)1030 u(resourceId="com.yoosee:id/rl_functin_bar").wait(timeout=8)1031 sleep(10)1032 u(resourceId='com.yoosee:id/date_tv')[2].click(timeout=5)1033 sleep(10)1034 if not u(text="暂无录像").exists:1035 if u(resourceId="com.yoosee:id/rl_functin_bar").wait_gone(timeout=3.0):1036 u(resourceId="com.yoosee:id/rl_vedioplayer_area").click(timeout=5)1037 # u(resourceId="com.yoosee:id/play_iv").click(timeout=5)1038 sleep(1)1039 stop_status = SameOperation().icon_statuscheck(u,"com.yoosee:id/play_iv")1040 # print (stop_status)1041 assert stop_status > 0, '回放播放状态不对'1042 SameOperation().quit_app(u)1043 @classmethod1044 def jwt_44(cls, u, video_camera_name): #云回放消息列表-播放视频1045 SameOperation().app_go(u)1046 if u(resourceId='com.yoosee:id/setting_more_iv').wait(timeout=5):1047 pass1048 else:1049 SameOperation().add_wired(u, video_camera_name)1050 u.press('back')1051 if u(resourceId="com.yoosee:id/tv_playback").wait_gone(timeout=3.0):1052 u.swipe_ext("down", scale=0.8)1053 u(resourceId="com.yoosee:id/tv_playback").click(timeout=8)1054 sleep(3)1055 u(resourceId="com.yoosee:id/tv_cloud_playback").click(timeout=5)1056 u(resourceId="com.yoosee:id/rl_functin_bar").wait(timeout=8)1057 sleep(10)1058 if not u(text="暂无录像").exists:1059 u(resourceId='com.yoosee:id/detection_time_tv')[0].click(timeout=5)1060 sleep(5)1061 assert u(text="正在预览").wait(timeout=5), '点击后没有正在预览'1062 SameOperation().quit_app(u)1063 @classmethod1064 def jwt_45(cls, u, video_camera_name): #云回放时间刻度尺横竖屏切换播放1065 SameOperation().app_go(u)1066 if u(resourceId='com.yoosee:id/setting_more_iv').wait(timeout=5):1067 pass1068 else:1069 SameOperation().add_wired(u, video_camera_name)1070 u.press('back')1071 if u(resourceId="com.yoosee:id/tv_playback").wait_gone(timeout=3.0):1072 u.swipe_ext("down", scale=0.8)1073 u(resourceId="com.yoosee:id/tv_playback").click(timeout=8)1074 u(resourceId="com.yoosee:id/tv_cloud_playback").click(timeout=5)1075 u(resourceId="com.yoosee:id/rl_functin_bar").wait(timeout=8)1076 sleep(10)1077 if u(resourceId="com.yoosee:id/rl_functin_bar").wait_gone(timeout=3.0):1078 u(resourceId="com.yoosee:id/rl_vedioplayer_area").click(timeout=5)1079 u(resourceId="com.yoosee:id/iv_half_screen").click(timeout=5)1080 sleep(2)1081 if not u(resourceId="com.yoosee:id/ll_landscape_timeline").exists:1082 u.xpath('//android.widget.FrameLayout[1]').click()1083 u(resourceId="com.yoosee:id/play_land_iv").click(timeout=5)1084 assert u(resourceId="com.yoosee:id/ll_landscape_timeline").wait(timeout=5),'切换横屏时,刻度尺不存在'1085 SameOperation().quit_app(u)1086 @classmethod1087 def jwt_46(cls, u, video_camera_name): #云回放时间刻度尺横竖屏切换播放1088 SameOperation().app_go(u)1089 if u(resourceId='com.yoosee:id/setting_more_iv').wait(timeout=5):1090 pass1091 else:1092 SameOperation().add_wired(u, video_camera_name)1093 u.press('back')1094 if u(resourceId="com.yoosee:id/tv_playback").wait_gone(timeout=3.0):1095 u.swipe_ext("down", scale=0.8)1096 u(resourceId="com.yoosee:id/tv_playback").click(timeout=8)1097 u(resourceId="com.yoosee:id/tv_cloud_playback").click(timeout=5)1098 u(resourceId="com.yoosee:id/rl_functin_bar").wait(timeout=8)1099 sleep(10)1100 if u(resourceId="com.yoosee:id/rl_functin_bar").wait_gone(timeout=3.0):1101 u(resourceId="com.yoosee:id/rl_vedioplayer_area").click(timeout=5)1102 u(resourceId="com.yoosee:id/iv_half_screen").click(timeout=5)1103 sleep(2)1104 if not u(resourceId="com.yoosee:id/ll_landscape_timeline").exists:1105 u.xpath('//android.widget.FrameLayout[1]').click()1106 u(resourceId="com.yoosee:id/iv_portrait_screen").click(timeout=5)1107 sleep(2)1108 if not u(resourceId="com.yoosee:id/rl_functin_bar").exists:1109 u(resourceId="com.yoosee:id/rl_vedioplayer_area").click(timeout=5)1110 u(resourceId="com.yoosee:id/play_iv").click(timeout=5)1111 assert u(resourceId="com.yoosee:id/fl_videoplayer_parent").exists, '切换竖屏时,刻度尺不存在'1112 SameOperation().quit_app(u)1113 @classmethod1114 def jwt_47(cls, u, video_camera_name): #banner广告1115 SameOperation().app_go(u)1116 if u(resourceId='com.yoosee:id/setting_more_iv').wait(timeout=5):1117 pass1118 else:1119 SameOperation().add_wired(u, video_camera_name)1120 u.press('back')1121 banner_times = 01122 while True:1123 if u.xpath('//*[@resource-id="com.yoosee:id/lv_contact"]/android.widget.LinearLayout[1]').exists:1124 break1125 elif banner_times == 5:1126 break1127 u.swipe_ext("down", scale=0.8)1128 sleep(3)1129 banner_times = banner_times + 11130 assert u.xpath('//*[@resource-id="com.yoosee:id/lv_contact"]/android.widget.LinearLayout[1]').wait(timeout=8), '没有banner广告'1131 SameOperation().quit_app(u)1132 @classmethod1133 def jwt_48(cls, u, video_camera_name): #设置云存入口1134 SameOperation().app_go(u)1135 if u(resourceId='com.yoosee:id/setting_more_iv').wait(timeout=5):1136 pass1137 else:1138 SameOperation().add_wired(u, video_camera_name)1139 u.press('back')1140 SameOperation().find_deldevices(u, '我的云存储')1141 u(text='我的云存储').click(timeout=5)1142 assert u(text="云服务").wait(timeout=10), '没有跳转到增值业务H5页面,页面标题未出现'1143 SameOperation().quit_app(u)1144 @classmethod1145 def jwt_49(cls, u, video_camera_name): #设置基础全天/报警录像互切1146 SameOperation().app_go(u)1147 if u(resourceId='com.yoosee:id/setting_more_iv').wait(timeout=5):1148 pass1149 else:1150 SameOperation().add_wired(u, video_camera_name)1151 u.press('back')1152 SameOperation().find_deldevices(u, '录像设置')1153 u(text='录像设置').click(timeout=5)1154 u(text='报警录像').click(timeout=5)1155 assert u(resourceId='com.yoosee:id/pt_alarm_record_time').wait(timeout=5), '切换报警录像失败'1156 SameOperation().quit_app(u)1157 @classmethod1158 def jwt_50(cls, u, video_camera_name): #设置基础全天/报警录像互切1159 SameOperation().app_go(u)1160 if u(resourceId='com.yoosee:id/setting_more_iv').wait(timeout=5):1161 pass1162 else:1163 SameOperation().add_wired(u, video_camera_name)1164 u.press('back')1165 SameOperation().find_deldevices(u, '录像设置')1166 u(text='录像设置').click(timeout=5)1167 u(text='定时录像').click(timeout=5)1168 assert u(resourceId='com.yoosee:id/pt_timed_record_time').wait(timeout=5), '切换定时录像失败'1169 SameOperation().quit_app(u)1170 @classmethod1171 def jwt_51(cls, u, video_camera_name): #设置基础全天/报警录像互切1172 SameOperation().app_go(u)1173 if u(resourceId='com.yoosee:id/setting_more_iv').wait(timeout=5):1174 pass1175 else:1176 SameOperation().add_wired(u, video_camera_name)1177 u.press('back')1178 SameOperation().find_deldevices(u, '录像设置')1179 u(text='录像设置').click(timeout=5)1180 u(text='全天录像').click(timeout=5)1181 assert u(resourceId='com.yoosee:id/sv_record_switch').wait(timeout=5), '切换全天录像失败'1182 SameOperation().quit_app(u)1183 @classmethod1184 def jwt_52(cls, u, video_camera_name): #监控界面/更多-回放1185 SameOperation().app_go(u)1186 if u(resourceId='com.yoosee:id/setting_more_iv').wait(timeout=5):1187 pass1188 else:1189 SameOperation().add_wired(u, video_camera_name)1190 u.press('back')1191 u.xpath(1192 '//*[@resource-id="com.yoosee:id/lv_contact"]/android.widget.RelativeLayout[1]/android.widget.LinearLayout[1]/android.widget.RelativeLayout[2]/android.widget.LinearLayout[1]').click()1193 sleep(5)1194 u(resourceId='com.yoosee:id/more_btn').click(timeout=5)1195 u(resourceId='com.yoosee:id/root_view')[0].click(timeout=5)1196 u(resourceId='com.yoosee:id/tv_sdcard_playback').click(timeout=5)1197 sleep(5)1198 if u(resourceId="com.yoosee:id/rl_functin_bar").wait_gone(timeout=3.0):1199 u(resourceId="com.yoosee:id/rl_vedioplayer_area").click(timeout=5)1200 # u(resourceId="com.yoosee:id/play_iv").click(timeout=5)1201 play_status = u(resourceId="com.yoosee:id/iv_playback_fast").info1202 sleep(1)1203 assert play_status['enabled'] == True, '没有自动播放'1204 SameOperation().quit_app(u)1205 @classmethod1206 def jwt_53(cls, u, video_camera_name): #监控界面/更多-回放返回重新连接1207 SameOperation().app_go(u)1208 if u(resourceId='com.yoosee:id/setting_more_iv').wait(timeout=5):1209 pass1210 else:1211 SameOperation().add_wired(u, video_camera_name)1212 u.press('back')1213 u.xpath(1214 '//*[@resource-id="com.yoosee:id/lv_contact"]/android.widget.RelativeLayout[1]/android.widget.LinearLayout[1]/android.widget.RelativeLayout[2]/android.widget.LinearLayout[1]').click()1215 sleep(5)1216 u(resourceId='com.yoosee:id/more_btn').click(timeout=5)1217 u(resourceId='com.yoosee:id/root_view')[0].click(timeout=5)1218 sleep(5)1219 u(resourceId='com.yoosee:id/back_btn').click(timeout=5)1220 u(resourceId='com.yoosee:id/center_direction_view').wait(timeout=5)1221 u.xpath(1222 '//*[@resource-id="android:id/content"]/android.widget.RelativeLayout[1]/android.widget.LinearLayout[1]/android.widget.RelativeLayout[1]').click(timeout=5)1223 assert u(resourceId='com.yoosee:id/bottom_control_rl').wait(timeout=5),'没有重新连接视频'1224 SameOperation().quit_app(u)1225 @classmethod1226 def jwt_54(cls, u, video_camera_name): #监控界面/更多-回放返回收起更多菜单1227 SameOperation().app_go(u)1228 if u(resourceId='com.yoosee:id/setting_more_iv').wait(timeout=5):1229 pass1230 else:1231 SameOperation().add_wired(u, video_camera_name)1232 u.press('back')1233 u.xpath(1234 '//*[@resource-id="com.yoosee:id/lv_contact"]/android.widget.RelativeLayout[1]/android.widget.LinearLayout[1]/android.widget.RelativeLayout[2]/android.widget.LinearLayout[1]').click()1235 sleep(5)1236 u(resourceId='com.yoosee:id/more_btn').click(timeout=5)1237 u(resourceId='com.yoosee:id/root_view')[0].click(timeout=5)1238 sleep(5)1239 u(resourceId='com.yoosee:id/back_btn').click(timeout=5)1240 u(resourceId='com.yoosee:id/center_direction_view').wait(timeout=5)1241 assert not u(resourceId='com.yoosee:id/root_view')[0].wait(timeout=5),'没有收起更多菜单'1242 SameOperation().quit_app(u)1243 @classmethod1244 def jwt_55(cls, u, video_camera_name): #监控界面更多-报警开关布防状态1245 SameOperation().app_go(u)1246 if u(resourceId='com.yoosee:id/setting_more_iv').wait(timeout=5):1247 pass1248 else:1249 SameOperation().add_wired(u, video_camera_name)1250 u.press('back')1251 if u(resourceId="com.yoosee:id/ll_defence_state").wait_gone(timeout=3.0):1252 u.swipe_ext("down", scale=0.8)1253 u(resourceId='com.yoosee:id/ll_defence_state').wait(timeout=5)1254 if u(text='警戒中').exists:1255 u(text='警戒中').click(timeout=5)1256 sleep(3)1257 u.xpath(1258 '//*[@resource-id="com.yoosee:id/lv_contact"]/android.widget.RelativeLayout[1]/android.widget.LinearLayout[1]/android.widget.RelativeLayout[2]/android.widget.LinearLayout[1]').click(timeout=5)1259 sleep(5)1260 u(resourceId='com.yoosee:id/more_btn').click(timeout=5)1261 u(resourceId='com.yoosee:id/root_view')[1].click(timeout=5)1262 sleep(3)1263 u(resourceId='com.yoosee:id/back_btn').click(timeout=5)1264 u(resourceId='com.yoosee:id/setting_more_iv').wait(timeout=5)1265 u.swipe_ext("down", scale=0.8)1266 u(resourceId='com.yoosee:id/ll_defence_state').wait(timeout=5)1267 assert u(resourceId="com.yoosee:id/tx_defence_state").get_text() == '警戒中','布防状态切换不成功'1268 u(text='警戒中').click(timeout=5)1269 sleep(2)1270 SameOperation().quit_app(u)1271 @classmethod1272 def jwt_56(cls, u, video_camera_name): #监控界面更多-关闭报警,设备撤销布防1273 SameOperation().app_go(u)1274 if u(resourceId='com.yoosee:id/setting_more_iv').wait(timeout=5):1275 pass1276 else:1277 SameOperation().add_wired(u, video_camera_name)1278 u.press('back')1279 if u(resourceId="com.yoosee:id/ll_defence_state").wait_gone(timeout=3.0):1280 u.swipe_ext("down", scale=0.8)1281 u(resourceId='com.yoosee:id/ll_defence_state').wait(timeout=5)1282 if u(text='警戒中').exists:1283 u(text='警戒中').click(timeout=5)1284 sleep(3)1285 u.xpath(1286 '//*[@resource-id="com.yoosee:id/lv_contact"]/android.widget.RelativeLayout[1]/android.widget.LinearLayout[1]/android.widget.RelativeLayout[2]/android.widget.LinearLayout[1]').click(timeout=5)1287 sleep(5)1288 u(resourceId='com.yoosee:id/more_btn').click(timeout=5)1289 u(resourceId='com.yoosee:id/root_view')[1].click(timeout=5)1290 sleep(3)1291 u(resourceId='com.yoosee:id/root_view')[1].click(timeout=5)1292 sleep(3)1293 u(resourceId='com.yoosee:id/back_btn').click(timeout=5)1294 u(resourceId='com.yoosee:id/setting_more_iv').wait(timeout=5)1295 u.swipe_ext("down", scale=0.8)1296 u(resourceId='com.yoosee:id/ll_defence_state').wait(timeout=5)1297 assert u(resourceId="com.yoosee:id/tx_defence_state").get_text() == '不报警', '设备撤销布防不成功'1298 sleep(2)1299 SameOperation().quit_app(u)1300 @classmethod1301 def jwt_57(cls, u, video_camera_name): #监控界面--显示全屏按钮,无操作5秒后隐藏后1302 SameOperation().app_go(u)1303 if u(resourceId='com.yoosee:id/setting_more_iv').wait(timeout=5):1304 pass1305 else:1306 SameOperation().add_wired(u, video_camera_name)1307 u.press('back')1308 if u(resourceId="com.yoosee:id/ll_defence_state").wait_gone(timeout=3.0):1309 u.swipe_ext("down", scale=0.8)1310 u.xpath(1311 '//*[@resource-id="com.yoosee:id/lv_contact"]/android.widget.RelativeLayout[1]/android.widget.LinearLayout[1]/android.widget.RelativeLayout[2]/android.widget.LinearLayout[1]').click(1312 timeout=5)1313 u(resourceId="com.yoosee:id/iv_full_screen").wait(timeout=5)1314 sleep(5)1315 assert u(resourceId="com.yoosee:id/iv_full_screen").wait_gone(timeout=3.0),'无操作5秒后没隐藏'1316 SameOperation().quit_app(u)1317 @classmethod1318 def jwt_58(cls, u, video_camera_name): #监控界面--切换到横屏监控1319 SameOperation().app_go(u)1320 if u(resourceId='com.yoosee:id/setting_more_iv').wait(timeout=5):1321 pass1322 else:1323 SameOperation().add_wired(u, video_camera_name)1324 u.press('back')1325 if u(resourceId="com.yoosee:id/ll_defence_state").wait_gone(timeout=3.0):1326 u.swipe_ext("down", scale=0.8)1327 u.xpath(1328 '//*[@resource-id="com.yoosee:id/lv_contact"]/android.widget.RelativeLayout[1]/android.widget.LinearLayout[1]/android.widget.RelativeLayout[2]/android.widget.LinearLayout[1]').click(1329 timeout=5)1330 u(resourceId="com.yoosee:id/iv_full_screen").click(timeout=5)1331 assert u(resourceId='com.yoosee:id/iv_hangup').wait(timeout=5),'没有切换横屏'1332 SameOperation().quit_app(u)1333 @classmethod1334 def jwt_59(cls, u, video_camera_name): #监控界面--录像显示正在录像状态:REC1335 SameOperation().app_go(u)1336 if u(resourceId='com.yoosee:id/setting_more_iv').wait(timeout=5):1337 pass1338 else:1339 SameOperation().add_wired(u, video_camera_name)1340 u.press('back')1341 if u(resourceId="com.yoosee:id/ll_defence_state").wait_gone(timeout=3.0):1342 u.swipe_ext("down", scale=0.8)1343 u.xpath(1344 '//*[@resource-id="com.yoosee:id/lv_contact"]/android.widget.RelativeLayout[1]/android.widget.LinearLayout[1]/android.widget.RelativeLayout[2]/android.widget.LinearLayout[1]').click(1345 timeout=5)1346 u(resourceId="com.yoosee:id/iv_p_video").click(timeout=5)1347 sleep(2)1348 assert u(resourceId='com.yoosee:id/tx_rec').wait(timeout=5), '没有显示正在录像状态:REC'1349 SameOperation().quit_app(u)1350 @classmethod1351 def jwt_60(cls, u, video_camera_name): #监控界面--录像小于1秒时,再次点击录像1352 SameOperation().app_go(u)1353 if u(resourceId='com.yoosee:id/setting_more_iv').wait(timeout=5):1354 pass1355 else:1356 SameOperation().add_wired(u, video_camera_name)1357 u.press('back')1358 if u(resourceId="com.yoosee:id/ll_defence_state").wait_gone(timeout=3.0):1359 u.swipe_ext("down", scale=0.8)1360 u.xpath(1361 '//*[@resource-id="com.yoosee:id/lv_contact"]/android.widget.RelativeLayout[1]/android.widget.LinearLayout[1]/android.widget.RelativeLayout[2]/android.widget.LinearLayout[1]').click(1362 timeout=5)1363 sleep(3)1364 u(resourceId="com.yoosee:id/iv_p_video").click(timeout=5)1365 sleep(1)1366 u(resourceId="com.yoosee:id/iv_p_video").click(timeout=5)1367 # if "视频片段时间太短了" in u.toast.get_message(5.0, 10.0, "default message"):1368 # print ('success')1369 # break1370 # elif short_i == 4:1371 # print('fail')1372 # assert "视频片段时间太短了" in u.toast.get_message(5.0, 10.0, "default message"),'无视频太短提示'1373 # sleep(1)1374 assert u(resourceId='com.yoosee:id/tx_rec').wait_gone(timeout=5),'停止录像了,仍显示正在录像状态:REC'1375 SameOperation().quit_app(u)1376 @classmethod1377 def jwt_61(cls, u, video_camera_name): #监控界面--录像大于5秒时,再次点击录像1378 SameOperation().app_go(u)1379 if u(resourceId='com.yoosee:id/setting_more_iv').wait(timeout=5):1380 pass1381 else:1382 SameOperation().add_wired(u, video_camera_name)1383 u.press('back')1384 if u(resourceId="com.yoosee:id/ll_defence_state").wait_gone(timeout=3.0):1385 u.swipe_ext("down", scale=0.8)1386 u.xpath(1387 '//*[@resource-id="com.yoosee:id/lv_contact"]/android.widget.RelativeLayout[1]/android.widget.LinearLayout[1]/android.widget.RelativeLayout[2]/android.widget.LinearLayout[1]').click(1388 timeout=5)1389 sleep(3)1390 u(resourceId="com.yoosee:id/iv_p_video").click(timeout=5)1391 sleep(6)1392 u(resourceId="com.yoosee:id/iv_p_video").click(timeout=5)1393 assert u(resourceId='com.yoosee:id/tx_rec').wait_gone(timeout=5),'停止录像了,仍显示正在录像状态:REC'1394 SameOperation().quit_app(u)1395 @classmethod1396 def jwt_62(cls, u, video_camera_name): #监控界面--截图成功和保存1397 SameOperation().app_go(u)1398 if u(resourceId='com.yoosee:id/setting_more_iv').wait(timeout=5):1399 pass1400 else:1401 SameOperation().add_wired(u, video_camera_name)1402 u.press('back')1403 if u(resourceId="com.yoosee:id/ll_defence_state").wait_gone(timeout=3.0):1404 u.swipe_ext("down", scale=0.8)1405 u.xpath(1406 '//*[@resource-id="com.yoosee:id/lv_contact"]/android.widget.RelativeLayout[1]/android.widget.LinearLayout[1]/android.widget.RelativeLayout[2]/android.widget.LinearLayout[1]').click(1407 timeout=5)1408 sleep(3)1409 u(resourceId="com.yoosee:id/iv_p_screenshot").click(timeout=5)1410 sleep(1)1411 assert "截图成功" in u.toast.get_message(5.0, 10.0, "default message"),'没提示截图成功'1412 SameOperation().quit_app(u)1413 @classmethod1414 def jwt_63(cls, u, video_camera_name): #监控界面--左下角有截图缩略图1415 SameOperation().app_go(u)1416 if u(resourceId='com.yoosee:id/setting_more_iv').wait(timeout=5):1417 pass1418 else:1419 SameOperation().add_wired(u, video_camera_name)1420 u.press('back')1421 if u(resourceId="com.yoosee:id/ll_defence_state").wait_gone(timeout=3.0):1422 u.swipe_ext("down", scale=0.8)1423 u.xpath(1424 '//*[@resource-id="com.yoosee:id/lv_contact"]/android.widget.RelativeLayout[1]/android.widget.LinearLayout[1]/android.widget.RelativeLayout[2]/android.widget.LinearLayout[1]').click(1425 timeout=5)1426 sleep(3)1427 u(resourceId="com.yoosee:id/iv_p_screenshot").click(timeout=5)1428 assert u.xpath('//*[@resource-id="com.yoosee:id/layout_p2p"]/android.widget.ImageView[1]').wait(1429 timeout=8), '左下角没显示截图缩略图'1430 SameOperation().quit_app(u)1431 @classmethod1432 def jwt_64(cls, u, video_camera_name): #监控界面--点击可以查看截图大图1433 SameOperation().app_go(u)1434 if u(resourceId='com.yoosee:id/setting_more_iv').wait(timeout=5):1435 pass1436 else:1437 SameOperation().add_wired(u, video_camera_name)1438 u.press('back')1439 if u(resourceId="com.yoosee:id/ll_defence_state").wait_gone(timeout=3.0):1440 u.swipe_ext("down", scale=0.8)1441 u.xpath(1442 '//*[@resource-id="com.yoosee:id/lv_contact"]/android.widget.RelativeLayout[1]/android.widget.LinearLayout[1]/android.widget.RelativeLayout[2]/android.widget.LinearLayout[1]').click(1443 timeout=5)1444 sleep(3)1445 u(resourceId="com.yoosee:id/iv_p_screenshot").click(timeout=5)1446 u.xpath('//*[@resource-id="com.yoosee:id/layout_p2p"]/android.widget.ImageView[1]').click(timeout=5)1447 assert u(resourceId="com.yoosee:id/tv_imagegallay_filesize").wait(timeout=5), '点击没能打开查看截图大图'1448 SameOperation().quit_app(u)1449 @classmethod1450 def jwt_65(cls, u, video_camera_name): #监控界面--无点击操作3秒后隐藏截图1451 SameOperation().app_go(u)1452 if u(resourceId='com.yoosee:id/setting_more_iv').wait(timeout=5):1453 pass1454 else:1455 SameOperation().add_wired(u, video_camera_name)1456 u.press('back')1457 if u(resourceId="com.yoosee:id/ll_defence_state").wait_gone(timeout=3.0):1458 u.swipe_ext("down", scale=0.8)1459 u.xpath(1460 '//*[@resource-id="com.yoosee:id/lv_contact"]/android.widget.RelativeLayout[1]/android.widget.LinearLayout[1]/android.widget.RelativeLayout[2]/android.widget.LinearLayout[1]').click(1461 timeout=5)1462 sleep(3)1463 u(resourceId="com.yoosee:id/iv_p_screenshot").click(timeout=5)1464 sleep(3)1465 assert u.xpath('//*[@resource-id="com.yoosee:id/layout_p2p"]/android.widget.ImageView[1]').wait_gone(1466 timeout=3), '左下角没显示截图缩略图'1467 SameOperation().quit_app(u)1468 @classmethod1469 def jwt_66(cls, u, video_camera_name): #快捷入口--时间轴日期当前播放的录像切换到另一天的录像1470 SameOperation().app_go(u)1471 if u(resourceId='com.yoosee:id/setting_more_iv').wait(timeout=5):1472 pass1473 else:1474 SameOperation().add_wired(u, video_camera_name)1475 u.press('back')1476 if u(resourceId="com.yoosee:id/ll_defence_state").wait_gone(timeout=3.0):1477 u.swipe_ext("down", scale=0.8)1478 u(resourceId="com.yoosee:id/ll_playback").click(timeout=5)1479 u(resourceId="com.yoosee:id/tv_sdcard_playback").click(timeout=5)1480 u(resourceId="com.yoosee:id/fl_videoplayer_parent").wait(timeout=5)1481 u(resourceId='com.yoosee:id/date_tv')[2].click(timeout=5)1482 sleep(6)1483 if u(text="暂无录像").wait(timeout=5):1484 pass1485 else:1486 if u(resourceId="com.yoosee:id/rl_functin_bar").wait_gone(timeout=3.0):1487 u(resourceId="com.yoosee:id/rl_vedioplayer_area").click(timeout=5)1488 sleep(1)1489 play_status = u(resourceId="com.yoosee:id/iv_playback_fast").info1490 sleep(3)1491 assert play_status['enabled'] == True, '切换到另一天录像没有自动播放'1492 SameOperation().quit_app(u)1493 @classmethod1494 def jwt_67(cls, u, video_camera_name): #快捷入口--横屏 - 暂停键变成播放键1495 SameOperation().app_go(u)1496 if u(resourceId='com.yoosee:id/setting_more_iv').wait(timeout=5):1497 pass1498 else:1499 SameOperation().add_wired(u, video_camera_name)1500 u.press('back')1501 if u(resourceId="com.yoosee:id/ll_defence_state").wait_gone(timeout=3.0):1502 u.swipe_ext("down", scale=0.8)1503 u(resourceId="com.yoosee:id/ll_playback").click(timeout=5)1504 u(resourceId="com.yoosee:id/tv_sdcard_playback").click(timeout=5)1505 sleep(5)1506 if not u(resourceId="com.yoosee:id/iv_playback_fast").exists:1507 u(resourceId="com.yoosee:id/rl_vedioplayer_area").click(timeout=5)1508 sleep(1)1509 #竖屏时时间轴1510 timeline_icon_coordinates = u(resourceId='com.yoosee:id/fl_videoplayer_parent').center()1511 u(resourceId="com.yoosee:id/iv_half_screen").click(timeout=5)1512 if u(resourceId="com.yoosee:id/ll_landscape_timeline").wait_gone(timeout=3.0):1513 # u.xpath('//android.widget.FrameLayout[1]').click(timeout=5)1514 u.click(timeline_icon_coordinates[0], timeline_icon_coordinates[1])1515 sleep(1)1516 u(resourceId="com.yoosee:id/iv_playback_fast_landscape").wait(timeout=5)1517 play_status = u(resourceId="com.yoosee:id/iv_playback_fast_landscape").info1518 sleep(1)1519 if play_status['enabled'] == True:1520 u(resourceId="com.yoosee:id/play_land_iv").click(timeout=5)1521 sleep(1)1522 play_status = u(resourceId="com.yoosee:id/iv_playback_fast_landscape").info1523 assert play_status['enabled'] == False, '仍在播放'1524 SameOperation().quit_app(u)1525 @classmethod1526 def jwt_68(cls, u, video_camera_name): #快捷入口--横屏 - 录像暂停,时间轴不动1527 SameOperation().app_go(u)1528 if u(resourceId='com.yoosee:id/setting_more_iv').wait(timeout=5):1529 pass1530 else:1531 SameOperation().add_wired(u, video_camera_name)1532 u.press('back')1533 if u(resourceId="com.yoosee:id/ll_defence_state").wait_gone(timeout=3.0):1534 u.swipe_ext("down", scale=0.8)1535 u(resourceId="com.yoosee:id/ll_playback").click(timeout=5)1536 u(resourceId="com.yoosee:id/tv_sdcard_playback").click(timeout=5)1537 sleep(5)1538 if not u(resourceId="com.yoosee:id/iv_playback_fast").exists:1539 u(resourceId="com.yoosee:id/rl_vedioplayer_area").click(timeout=5)1540 sleep(1)1541 # 竖屏时时间轴1542 timeline_icon_coordinates = u(resourceId='com.yoosee:id/fl_videoplayer_parent').center()1543 u(resourceId="com.yoosee:id/iv_half_screen").click(timeout=5)1544 if u(resourceId="com.yoosee:id/ll_landscape_timeline").wait_gone(timeout=3.0):1545 # u.xpath('//android.widget.FrameLayout[1]').click(timeout=5)1546 u.click(timeline_icon_coordinates[0], timeline_icon_coordinates[1])1547 sleep(1)1548 u(resourceId="com.yoosee:id/iv_playback_fast_landscape").wait(timeout=5)1549 play_status = u(resourceId="com.yoosee:id/iv_playback_fast_landscape").info1550 sleep(1)1551 if play_status['enabled'] == True:1552 u(resourceId="com.yoosee:id/play_land_iv").click(timeout=5)1553 sleep(1)1554 im_1 = u(resourceId="com.yoosee:id/ll_landscape_timeline").screenshot()1555 im_1.save("timeline_1.jpg")1556 sleep(10)1557 im_2 = u(resourceId="com.yoosee:id/ll_landscape_timeline").screenshot()1558 im_2.save("timeline_2.jpg")1559 im_same = SameOperation().img_statuscheck("timeline_1.jpg","timeline_2.jpg")1560 # print (im_same)1561 assert im_same == 0.0,'录像暂停时间轴有动'1562 SameOperation().quit_app(u)1563 @classmethod1564 def jwt_69(cls, u, video_camera_name): #快捷入口--横屏 - 暂停键变成播放键1565 SameOperation().app_go(u)1566 if u(resourceId='com.yoosee:id/setting_more_iv').wait(timeout=5):1567 pass1568 else:1569 SameOperation().add_wired(u, video_camera_name)1570 u.press('back')1571 if u(resourceId="com.yoosee:id/ll_defence_state").wait_gone(timeout=3.0):1572 u.swipe_ext("down", scale=0.8)1573 u(resourceId="com.yoosee:id/ll_playback").click(timeout=5)1574 u(resourceId="com.yoosee:id/tv_sdcard_playback").click(timeout=5)1575 sleep(5)1576 if not u(resourceId="com.yoosee:id/iv_playback_fast").exists:1577 u(resourceId="com.yoosee:id/rl_vedioplayer_area").click(timeout=5)1578 sleep(1)1579 # 竖屏时时间轴1580 timeline_icon_coordinates = u(resourceId='com.yoosee:id/fl_videoplayer_parent').center()1581 u(resourceId="com.yoosee:id/iv_half_screen").click(timeout=5)1582 if u(resourceId="com.yoosee:id/ll_landscape_timeline").wait_gone(timeout=3.0):1583 # u.xpath('//android.widget.FrameLayout[1]').click(timeout=5)1584 u.click(timeline_icon_coordinates[0], timeline_icon_coordinates[1])1585 sleep(1)1586 u(resourceId="com.yoosee:id/iv_playback_fast_landscape").wait(timeout=5)1587 play_status = u(resourceId="com.yoosee:id/iv_playback_fast_landscape").info1588 sleep(1)1589 if play_status['enabled'] == True:1590 u(resourceId="com.yoosee:id/play_land_iv").click(timeout=5)1591 sleep(1)1592 u(resourceId="com.yoosee:id/play_land_iv").click(timeout=5)1593 sleep(1)1594 play_status = u(resourceId="com.yoosee:id/iv_playback_fast_landscape").info1595 assert play_status['enabled'] == True, '没有播放'1596 SameOperation().quit_app(u)1597 @classmethod1598 def jwt_70(cls, u, video_camera_name): #快捷入口--横屏 - 录像暂停,时间轴不动1599 SameOperation().app_go(u)1600 if u(resourceId='com.yoosee:id/setting_more_iv').wait(timeout=5):1601 pass1602 else:1603 SameOperation().add_wired(u, video_camera_name)1604 u.press('back')1605 if u(resourceId="com.yoosee:id/ll_defence_state").wait_gone(timeout=3.0):1606 u.swipe_ext("down", scale=0.8)1607 u(resourceId="com.yoosee:id/ll_playback").click(timeout=5)1608 u(resourceId="com.yoosee:id/tv_sdcard_playback").click(timeout=5)1609 sleep(5)1610 if not u(resourceId="com.yoosee:id/iv_playback_fast").exists:1611 u(resourceId="com.yoosee:id/rl_vedioplayer_area").click(timeout=5)1612 sleep(1)1613 # 竖屏时时间轴1614 timeline_icon_coordinates = u(resourceId='com.yoosee:id/fl_videoplayer_parent').center()1615 u(resourceId="com.yoosee:id/iv_half_screen").click(timeout=5)1616 if u(resourceId="com.yoosee:id/ll_landscape_timeline").wait_gone(timeout=3.0):1617 # u.xpath('//android.widget.FrameLayout[1]').click(timeout=5)1618 u.click(timeline_icon_coordinates[0], timeline_icon_coordinates[1])1619 sleep(1)1620 u(resourceId="com.yoosee:id/iv_playback_fast_landscape").wait(timeout=5)1621 play_status = u(resourceId="com.yoosee:id/iv_playback_fast_landscape").info1622 sleep(1)1623 if play_status['enabled'] == True:1624 u(resourceId="com.yoosee:id/play_land_iv").click(timeout=5)1625 sleep(1)1626 u(resourceId="com.yoosee:id/play_land_iv").click(timeout=5)1627 sleep(2)1628 im_1 = u(resourceId="com.yoosee:id/ll_landscape_timeline").screenshot()1629 im_1.save("timeline_1.jpg")1630 sleep(10)1631 im_2 = u(resourceId="com.yoosee:id/ll_landscape_timeline").screenshot()1632 im_2.save("timeline_2.jpg")1633 im_same = SameOperation().img_statuscheck("timeline_1.jpg","timeline_2.jpg")1634 # print (im_same)1635 assert im_same > 0.0,'录像时间轴有动'1636 SameOperation().quit_app(u)1637 @classmethod1638 def jwt_71(cls, u, video_camera_name): #快捷入口--竖屏 - 录屏点击录屏后控件上有小红点1639 SameOperation().app_go(u)1640 if u(resourceId='com.yoosee:id/setting_more_iv').wait(timeout=5):1641 pass1642 else:1643 SameOperation().add_wired(u, video_camera_name)1644 u.press('back')1645 if u(resourceId="com.yoosee:id/ll_defence_state").wait_gone(timeout=3.0):1646 u.swipe_ext("down", scale=0.8)1647 u(resourceId="com.yoosee:id/ll_playback").wait(timeout=5)1648 u(resourceId="com.yoosee:id/ll_playback").click(timeout=5)1649 u(resourceId="com.yoosee:id/tv_sdcard_playback").click(timeout=5)1650 sleep(10)1651 if not u(resourceId="com.yoosee:id/iv_playback_fast").exists:1652 u(resourceId="com.yoosee:id/rl_vedioplayer_area").click(timeout=5)1653 sleep(1)1654 u(resourceId="com.yoosee:id/iv_playback_to_dwonload").click(timeout=5)1655 sleep(2)1656 #控件上小红点1657 assert u(resourceId='com.yoosee:id/iv_state').wait(timeout=8), '控件没有小红点'1658 SameOperation().quit_app(u)1659 @classmethod1660 def jwt_72(cls, u, video_camera_name): #快捷入口--竖屏 - 录屏结束后可在我的相册中播放1661 SameOperation().app_go(u)1662 if u(resourceId='com.yoosee:id/setting_more_iv').wait(timeout=5):1663 pass1664 else:1665 SameOperation().add_wired(u, video_camera_name)1666 # print ('2')1667 if not u(resourceId='com.yoosee:id/setting_more_iv').wait(timeout=5):1668 u.press('back')1669 if u(resourceId="com.yoosee:id/ll_defence_state").wait_gone(timeout=3.0):1670 u.swipe_ext("down", scale=0.8)1671 SameOperation().photo_delete(u)1672 u(resourceId="com.yoosee:id/ll_playback").click(timeout=5)1673 u(resourceId="com.yoosee:id/tv_sdcard_playback").click(timeout=5)1674 sleep(10)1675 if not u(resourceId="com.yoosee:id/iv_playback_fast").exists:1676 u(resourceId="com.yoosee:id/rl_vedioplayer_area").click(timeout=5)1677 sleep(1)1678 u(resourceId="com.yoosee:id/iv_playback_to_dwonload").click(timeout=5)1679 sleep(10)1680 u(resourceId="com.yoosee:id/iv_playback_to_dwonload").click(timeout=5)1681 u.press('back')1682 u(resourceId='com.yoosee:id/icon_setting_img').click(timeout=5)1683 u(resourceId='com.yoosee:id/icon_setting_img').click(timeout=5)1684 u(resourceId='com.yoosee:id/rl_album_low').click(timeout=5)1685 u(resourceId='com.yoosee:id/iv_play').click(timeout=5)1686 u.xpath(1687 '//*[@resource-id="com.yoosee:id/viewer"]/android.widget.RelativeLayout[1]/android.widget.ImageView[2]').click(timeout=5)1688 sleep(2)1689 assert u(resourceId='com.yoosee:id/v_play').wait(timeout=5), '不能播放'1690 SameOperation().quit_app(u)1691 @classmethod1692 def jwt_73(cls, u, video_camera_name): #快捷入口账户分享显示访客用户的头像,昵称以及有看头账号1693 SameOperation().app_go(u)1694 # 先判断分享的账号是否已添加分享的设备1695 SameOperation().log_out(u)1696 sleep(3)1697 SameOperation().log_in(u, "gw_test01@sina.com", "abcd1234")1698 sleep(3)1699 if u(resourceId='com.yoosee:id/ll_device').wait(timeout=5):1700 u.press("back")1701 SameOperation().find_deldevices(u, '删除设备')1702 if u(text='删除设备').wait(timeout=5):1703 u(text='删除设备').click(timeout=5)1704 u(resourceId='com.yoosee:id/tv_yes').click(timeout=5)1705 SameOperation().log_out(u)1706 sleep(3)1707 SameOperation().log_in(u, phone_num, phone_pwd)1708 if u(resourceId='com.yoosee:id/setting_more_iv').wait(timeout=5):1709 pass1710 else:1711 SameOperation().add_wired(u, video_camera_name)1712 u.press('back')1713 if u(resourceId="com.yoosee:id/ll_defence_state").wait_gone(timeout=3.0):1714 u.swipe_ext("down", scale=0.8)1715 # u(resourceId='com.yoosee:id/setting_more_iv').wait(timeout=5)1716 # u(resourceId='com.yoosee:id/setting_more_iv').click(timeout=5)1717 # u(resourceId='com.yoosee:id/pop_share_ll').click(timeout=5)1718 # u(resourceId='com.yoosee:id/account_share_tv').click(timeout=5)1719 # u(resourceId='com.yoosee:id/tx_save').click(timeout=5)1720 # u.xpath("//android.widget.LinearLayout[1]/android.widget.LinearLayout[1]/android.widget.RelativeLayout[2]").set_text("gw_test01@sina.com")1721 # u(resourceId='com.yoosee:id/confirm_btn').click(timeout=5)1722 # u(resourceId='com.yoosee:id/share_confirm_ll').click(timeout=8)1723 # sleep(3)1724 SameOperation().account_sharing(u)1725 assert u(resourceId='com.yoosee:id/account_tv').get_text() == 'gw_test01@sina.com' and u(resourceId='com.yoosee:id/share_account_tv').get_text() == '有看头账号:025611668','昵称以及有看头账号不正确'1726 SameOperation().quit_app(u)1727 @classmethod1728 def jwt_74(cls, u, video_camera_name): #快捷入口账户分享提示已发送分享邀请1729 SameOperation().app_go(u)1730 # 先判断分享的账号是否已添加分享的设备1731 SameOperation().log_out(u)1732 sleep(3)1733 SameOperation().log_in(u, "gw_test01@sina.com", "abcd1234")1734 sleep(3)1735 if u(resourceId='com.yoosee:id/ll_device').wait(timeout=5):1736 u.press("back")1737 SameOperation().find_deldevices(u, '删除设备')1738 if u(text='删除设备').wait(timeout=5):1739 u(text='删除设备').click(timeout=5)1740 u(resourceId='com.yoosee:id/tv_yes').click(timeout=5)1741 SameOperation().log_out(u)1742 sleep(3)1743 SameOperation().log_in(u, phone_num, phone_pwd)1744 if u(resourceId='com.yoosee:id/setting_more_iv').wait(timeout=5):1745 pass1746 else:1747 SameOperation().add_wired(u, video_camera_name)1748 u.press('back')1749 if u(resourceId="com.yoosee:id/ll_defence_state").wait_gone(timeout=3.0):1750 u.swipe_ext("down", scale=0.8)1751 # u(resourceId='com.yoosee:id/setting_more_iv').click(timeout=5)1752 # u(resourceId='com.yoosee:id/pop_share_ll').click(timeout=5)1753 # u(resourceId='com.yoosee:id/account_share_tv').click(timeout=5)1754 # u(resourceId='com.yoosee:id/tx_save').click(timeout=5)1755 # u.xpath("//android.widget.LinearLayout[1]/android.widget.LinearLayout[1]/android.widget.RelativeLayout[2]").set_text("gw_test01@sina.com")1756 # u(resourceId='com.yoosee:id/confirm_btn').click(timeout=5)1757 # u(resourceId='com.yoosee:id/share_confirm_ll').click(timeout=8)1758 # sleep(3)1759 SameOperation().account_sharing(u)1760 assert u(text='已发送分享邀请').wait(timeout=5),'没有提示已发送分享邀请'1761 SameOperation().quit_app(u)1762 @classmethod1763 def jwt_75(cls, u, video_camera_name): #快捷入口账户分享访客账号可在设备列表中看到分享弹窗。1764 SameOperation().app_go(u)1765 # 先判断分享的账号是否已添加分享的设备1766 SameOperation().log_out(u)1767 sleep(3)1768 SameOperation().log_in(u, "gw_test01@sina.com", "abcd1234")1769 sleep(3)1770 if u(resourceId='com.yoosee:id/ll_device').wait(timeout=5):1771 u.press("back")1772 SameOperation().find_deldevices(u, '删除设备')1773 if u(text='删除设备').wait(timeout=5):1774 u(text='删除设备').click(timeout=5)1775 u(resourceId='com.yoosee:id/tv_yes').click(timeout=5)1776 SameOperation().log_out(u)1777 sleep(3)1778 SameOperation().log_in(u, phone_num, phone_pwd)1779 if u(resourceId='com.yoosee:id/setting_more_iv').wait(timeout=5):1780 pass1781 else:1782 SameOperation().add_wired(u, video_camera_name)1783 u.press('back')1784 if u(resourceId="com.yoosee:id/ll_defence_state").wait_gone(timeout=3.0):1785 u.swipe_ext("down", scale=0.8)1786 SameOperation().account_sharing(u)1787 SameOperation().log_out(u)1788 sleep(3)1789 SameOperation().log_in(u,"gw_test01@sina.com","abcd1234")1790 sleep(3)1791 assert u(resourceId='com.yoosee:id/ll_device').wait(timeout=8), '没有收到分享弹窗。'1792 SameOperation().quit_app(u)1793 @classmethod1794 def jwt_76(cls, u, video_camera_name): #快捷入口账户分享弹框提示“收到xxxx的分享”。1795 SameOperation().app_go(u)1796 # 先判断分享的账号是否已添加分享的设备1797 SameOperation().log_out(u)1798 sleep(3)1799 SameOperation().log_in(u, "gw_test01@sina.com", "abcd1234")1800 sleep(3)1801 if u(resourceId='com.yoosee:id/ll_device').wait(timeout=5):1802 u.press("back")1803 SameOperation().find_deldevices(u, '删除设备')1804 if u(text='删除设备').wait(timeout=5):1805 u(text='删除设备').click(timeout=5)1806 u(resourceId='com.yoosee:id/tv_yes').click(timeout=5)1807 SameOperation().log_out(u)1808 sleep(3)1809 SameOperation().log_in(u, phone_num, phone_pwd)1810 if u(resourceId='com.yoosee:id/setting_more_iv').wait(timeout=5):1811 pass1812 else:1813 SameOperation().add_wired(u, video_camera_name)1814 u.press('back')1815 if u(resourceId="com.yoosee:id/ll_defence_state").wait_gone(timeout=3.0):1816 u.swipe_ext("down", scale=0.8)1817 SameOperation().account_sharing(u)1818 SameOperation().log_out(u)1819 sleep(3)1820 SameOperation().log_in(u,"gw_test01@sina.com","abcd1234")1821 sleep(3)1822 assert '向你分享了一台摄像机' in u(resourceId='com.yoosee:id/content_tv').get_text(), '没有收到好友的分享'1823 SameOperation().quit_app(u)1824 @classmethod1825 def jwt_77(cls, u, video_camera_name): #快捷入口账户分享分享弹窗点击忽略弹框消失。1826 SameOperation().app_go(u)1827 # 先判断分享的账号是否已添加分享的设备1828 SameOperation().log_out(u)1829 sleep(3)1830 SameOperation().log_in(u, "gw_test01@sina.com", "abcd1234")1831 sleep(3)1832 if u(resourceId='com.yoosee:id/ll_device').wait(timeout=5):1833 u.press("back")1834 SameOperation().find_deldevices(u, '删除设备')1835 if u(text='删除设备').wait(timeout=5):1836 u(text='删除设备').click(timeout=5)1837 u(resourceId='com.yoosee:id/tv_yes').click(timeout=5)1838 SameOperation().log_out(u)1839 sleep(3)1840 SameOperation().log_in(u, phone_num, phone_pwd)1841 if u(resourceId='com.yoosee:id/setting_more_iv').wait(timeout=5):1842 pass1843 else:1844 SameOperation().add_wired(u, video_camera_name)1845 u.press('back')1846 if u(resourceId="com.yoosee:id/ll_defence_state").wait_gone(timeout=3.0):1847 u.swipe_ext("down", scale=0.8)1848 SameOperation().account_sharing(u)1849 SameOperation().log_out(u)1850 sleep(3)1851 SameOperation().log_in(u,"gw_test01@sina.com","abcd1234")1852 sleep(6)1853 u(text='忽略').click(timeout=5)1854 assert u(resourceId="com.yoosee:id/ll_defence_state").wait_gone(timeout=3.0), '点击忽略弹框未消失'1855 SameOperation().quit_app(u)1856 @classmethod1857 def jwt_78(cls, u, video_camera_name): #快捷入口账户分享跳转到“添加设备界面”1858 SameOperation().app_go(u)1859 #先判断分享的账号是否已添加分享的设备1860 SameOperation().log_out(u)1861 sleep(3)1862 SameOperation().log_in(u, "gw_test01@sina.com", "abcd1234")1863 sleep(3)1864 if u(resourceId='com.yoosee:id/ll_device').wait(timeout=5):1865 u.press("back")1866 SameOperation().find_deldevices(u,'删除设备')1867 if u(text='删除设备').wait(timeout=5):1868 u(text='删除设备').click(timeout=5)1869 u(resourceId='com.yoosee:id/tv_yes').click(timeout=5)1870 SameOperation().log_out(u)1871 sleep(3)1872 SameOperation().log_in(u, phone_num, phone_pwd)1873 if u(resourceId='com.yoosee:id/setting_more_iv').wait(timeout=5):1874 pass1875 else:1876 SameOperation().add_wired(u, video_camera_name)1877 u.press('back')1878 if u(resourceId="com.yoosee:id/ll_defence_state").wait_gone(timeout=3.0):1879 u.swipe_ext("down", scale=0.8)1880 SameOperation().account_sharing(u)1881 SameOperation().log_out(u)1882 sleep(3)1883 SameOperation().log_in(u,"gw_test01@sina.com","abcd1234")1884 sleep(3)1885 u(text='接受').click(timeout=5)1886 assert u(text='添加成功').wait(timeout=5), '没有跳转到“添加设备界面”'1887 SameOperation().quit_app(u)1888 @classmethod1889 def jwt_79(cls, u,video_camera_name): # 设备升级弹框,弹出升级设备的弹框1890 u.app_clear('com.yoosee') # 清除应用数据1891 SameOperation().app_go(u)1892 SameOperation().log_in(u, phone_num, phone_pwd)1893 assert u(text='发现新固件').wait(timeout=10),'没有升级设备的弹框'1894 u.press("back")1895 sleep(6)1896 SameOperation().quit_app(u)1897 @classmethod1898 def jwt_80(cls, u, video_camera_name): # 设备升级弹框,点击立即更新,升级设备1899 u.app_clear('com.yoosee') # 清除应用数据1900 SameOperation().app_go(u)1901 SameOperation().log_in(u, phone_num, phone_pwd)1902 u(text='立即更新').wait(timeout=10)1903 u(text='立即更新').click()1904 assert u(text='摄像机升级中…').wait(timeout=10), '没有升级中'1905 sleep(180)1906 SameOperation().quit_app(u)1907 @classmethod1908 def jwt_81(cls, u, video_camera_name): # 设备升级弹框,点击后台升级1909 u.app_clear('com.yoosee') # 清除应用数据1910 SameOperation().app_go(u)1911 SameOperation().log_in(u, phone_num, phone_pwd)1912 u(text='立即更新').wait(timeout=10)1913 u(text='立即更新').click()1914 sleep(2)1915 u(resourceId='com.yoosee:id/tv_know').click(timeout=5)1916 u(resourceId='com.yoosee:id/tv_background').click(timeout=5)1917 sleep(1)1918 u(resourceId='com.yoosee:id/icon_contact').click(timeout=5)1919 sleep(20)1920 for offline_1 in range(10):1921 u.swipe_ext("down", scale=0.8)1922 sleep(6)1923 if u(resourceId="com.yoosee:id/tv_offline").wait(timeout=8.0):1924 break1925 for offline_2 in range(20):1926 u.swipe_ext("down", scale=0.8)1927 sleep(6)1928 if not u(resourceId="com.yoosee:id/tv_offline").exists:1929 break1930 assert not u(resourceId="com.yoosee:id/tv_offline").exists,'(等了3分钟)设备还是离线'1931 SameOperation().quit_app(u)1932 @classmethod1933 def jwt_82(cls, u, video_camera_name): # 设备升级弹框,点击弹框右上角“×”1934 u.app_clear('com.yoosee') # 清除应用数据1935 SameOperation().app_go(u)1936 SameOperation().log_in(u, phone_num, phone_pwd)1937 u(text='立即更新').wait(timeout=10)1938 u(resourceId='com.yoosee:id/iv_close_device_update').click(timeout=5)1939 sleep(2)1940 assert not u(text="发现新固件").exists, '点击弹框右上角“×”,弹框没消失'1941 SameOperation().quit_app(u)1942 @classmethod1943 def jwt_83(cls, u,video_camera_name): # 设备列表测到有新的设备固件且设备列表有弹窗提示1944 u.app_clear('com.yoosee') # 清除应用数据1945 SameOperation().app_go(u)1946 SameOperation().log_in(u, phone_num, phone_pwd)1947 assert u(text='发现新固件').wait(timeout=10),'设备列表没有升级设备的弹框'1948 u.press("back")1949 sleep(6)1950 SameOperation().quit_app(u)1951 @classmethod1952 def jwt_84(cls, u, video_camera_name): # 设备列表可以正常升级设备固件1953 u.app_clear('com.yoosee') # 清除应用数据1954 SameOperation().app_go(u)1955 SameOperation().log_in(u, phone_num, phone_pwd)1956 u(text='立即更新').wait(timeout=10)1957 u(text='立即更新').click()1958 sleep(2)1959 u(resourceId='com.yoosee:id/tv_know').click(timeout=5)1960 u(resourceId='com.yoosee:id/tv_background').click(timeout=5)1961 sleep(1)1962 u(resourceId='com.yoosee:id/icon_contact').click(timeout=5)1963 sleep(20)1964 for offline_1 in range(10):1965 u.swipe_ext("down", scale=0.8)1966 sleep(6)1967 if u(resourceId="com.yoosee:id/tv_offline").wait(timeout=8.0):1968 break1969 for offline_2 in range(20):1970 u.swipe_ext("down", scale=0.8)1971 sleep(6)1972 if not u(resourceId="com.yoosee:id/tv_offline").exists:1973 break1974 assert not u(resourceId="com.yoosee:id/tv_offline").exists,'(等了3分钟)设备还是离线'1975 SameOperation().quit_app(u)1976 @classmethod1977 def jwt_85(cls, u, video_camera_name): #设置-网络设备设置页面,点击“固件更新”弹出弹窗1978 SameOperation().app_go(u)1979 if u(resourceId='com.yoosee:id/setting_more_iv').wait(timeout=5):1980 pass1981 else:1982 SameOperation().add_wired(u, video_camera_name)1983 u.press('back')1984 if u(resourceId="com.yoosee:id/ll_defence_state").wait_gone(timeout=3.0):1985 u.swipe_ext("down", scale=0.8)1986 SameOperation().find_deldevices(u, '固件更新')1987 u(resourceId='com.yoosee:id/check_device_update').click(timeout=5)1988 assert u(text='发现新固件').wait(timeout=6),'没有升级设备的弹框'1989 SameOperation().quit_app(u)1990 @classmethod1991 def jwt_86(cls, u, video_camera_name): #设置-网络设备设置页面正常升级设备固件1992 SameOperation().app_go(u)1993 if u(resourceId='com.yoosee:id/setting_more_iv').wait(timeout=5):1994 pass1995 else:1996 SameOperation().add_wired(u, video_camera_name)1997 u.press('back')1998 if u(resourceId="com.yoosee:id/ll_defence_state").wait_gone(timeout=3.0):1999 u.swipe_ext("down", scale=0.8)2000 SameOperation().find_deldevices(u, '固件更新')2001 u(resourceId='com.yoosee:id/check_device_update').click(timeout=5)2002 u(text='立即更新').click()2003 sleep(2)2004 u(resourceId='com.yoosee:id/tv_know').click(timeout=5)2005 u(resourceId='com.yoosee:id/tv_background').click(timeout=5)2006 sleep(2)2007 u.press('back')2008 sleep(20)2009 for offline_1 in range(10):2010 u.swipe_ext("down", scale=0.8)2011 sleep(6)2012 if u(resourceId="com.yoosee:id/tv_offline").wait(timeout=8.0):2013 break2014 for offline_2 in range(20):2015 u.swipe_ext("down", scale=0.8)2016 sleep(6)2017 if not u(resourceId="com.yoosee:id/tv_offline").exists:2018 break2019 assert not u(resourceId="com.yoosee:id/tv_offline").exists, '(等了1分钟)设备还是离线'2020 SameOperation().quit_app(u)2021 @classmethod2022 def jwt_87(cls, u, video_camera_name): #打开帮助与反馈H5页面2023 SameOperation().app_go(u)2024 if u(resourceId='com.yoosee:id/setting_more_iv').wait(timeout=5):2025 pass2026 else:2027 SameOperation().add_wired(u, video_camera_name)2028 u.press('back')2029 if u(resourceId="com.yoosee:id/ll_defence_state").wait_gone(timeout=3.0):2030 u.swipe_ext("down", scale=0.8)2031 u(resourceId="com.yoosee:id/icon_setting").click(timeout=5)2032 sleep(1)2033 u(resourceId="com.yoosee:id/icon_setting").click(timeout=5)2034 u(resourceId="com.yoosee:id/r_online_problem").click(timeout=5)2035 assert u(text="帮助中心").wait(timeout=5), '没有打开帮助与反馈H5页面'2036 SameOperation().quit_app(u)2037 @classmethod2038 def jwt_88(cls, u, video_camera_name): #全屏展示选中的图片2039 SameOperation().app_go(u)2040 if u(resourceId='com.yoosee:id/setting_more_iv').wait(timeout=5):2041 pass2042 else:2043 SameOperation().add_wired(u, video_camera_name)2044 u.press('back')2045 if u(resourceId="com.yoosee:id/ll_defence_state").wait_gone(timeout=3.0):2046 u.swipe_ext("down", scale=0.8)2047 u.xpath(2048 '//*[@resource-id="com.yoosee:id/lv_contact"]/android.widget.RelativeLayout[1]/android.widget.LinearLayout[1]/android.widget.RelativeLayout[2]/android.widget.LinearLayout[1]').click(2049 timeout=5)2050 sleep(3)2051 for screenshot_i in range(0,3):2052 u(resourceId="com.yoosee:id/iv_p_screenshot").click(timeout=5)2053 sleep(1)2054 u(resourceId="com.yoosee:id/back_btn").click(timeout=5)2055 u(resourceId="com.yoosee:id/icon_setting").click(timeout=5)2056 sleep(1)2057 u(resourceId="com.yoosee:id/icon_setting").click(timeout=5)2058 u(resourceId="com.yoosee:id/rl_album_low").click(timeout=5)2059 u.xpath('//android.widget.GridView/android.widget.RelativeLayout[1]').click(timeout=5)2060 assert u(resourceId="com.yoosee:id/iv_delete").wait(timeout=5), '没有全屏展示'2061 SameOperation().quit_app(u)2062 @classmethod2063 def jwt_89(cls, u, video_camera_name): #左滑动可以查看下一个图片/视频2064 SameOperation().app_go(u)2065 if u(resourceId='com.yoosee:id/setting_more_iv').wait(timeout=5):2066 pass2067 else:2068 SameOperation().add_wired(u, video_camera_name)2069 u.press('back')2070 if u(resourceId="com.yoosee:id/ll_defence_state").wait_gone(timeout=3.0):2071 u.swipe_ext("down", scale=0.8)2072 u.xpath(2073 '//*[@resource-id="com.yoosee:id/lv_contact"]/android.widget.RelativeLayout[1]/android.widget.LinearLayout[1]/android.widget.RelativeLayout[2]/android.widget.LinearLayout[1]').click(2074 timeout=5)2075 sleep(3)2076 for screenshot_i in range(0,3):2077 u(resourceId="com.yoosee:id/iv_p_screenshot").click(timeout=5)2078 sleep(1)2079 u(resourceId="com.yoosee:id/back_btn").click(timeout=5)2080 u(resourceId="com.yoosee:id/icon_setting").click(timeout=5)2081 sleep(1)2082 u(resourceId="com.yoosee:id/icon_setting").click(timeout=5)2083 u(resourceId="com.yoosee:id/rl_album_low").click(timeout=5)2084 u.xpath('//android.widget.GridView/android.widget.RelativeLayout[1]').click(timeout=5)2085 sleep(1)2086 u.swipe_ext("left", scale=0.8)2087 sleep(2)2088 u(resourceId="com.yoosee:id/tv_imagegallay_curprogress").wait(timeout=5)2089 assert '2/' in u(resourceId="com.yoosee:id/tv_imagegallay_curprogress").get_text(), '没有切换下一张图片/视频'2090 SameOperation().quit_app(u)2091 @classmethod2092 def jwt_90(cls, u, video_camera_name): #右滑动可以查看上一个图片/视频2093 SameOperation().app_go(u)2094 if u(resourceId='com.yoosee:id/setting_more_iv').wait(timeout=5):2095 pass2096 else:2097 SameOperation().add_wired(u, video_camera_name)2098 u.press('back')2099 if u(resourceId="com.yoosee:id/ll_defence_state").wait_gone(timeout=3.0):2100 u.swipe_ext("down", scale=0.8)2101 u.xpath(2102 '//*[@resource-id="com.yoosee:id/lv_contact"]/android.widget.RelativeLayout[1]/android.widget.LinearLayout[1]/android.widget.RelativeLayout[2]/android.widget.LinearLayout[1]').click(2103 timeout=5)2104 sleep(3)2105 for screenshot_i in range(0,3):2106 u(resourceId="com.yoosee:id/iv_p_screenshot").click(timeout=5)2107 sleep(1)2108 u(resourceId="com.yoosee:id/back_btn").click(timeout=5)2109 u(resourceId="com.yoosee:id/icon_setting").click(timeout=5)2110 sleep(1)2111 u(resourceId="com.yoosee:id/icon_setting").click(timeout=5)2112 u(resourceId="com.yoosee:id/rl_album_low").click(timeout=5)2113 u.xpath('//android.widget.GridView/android.widget.RelativeLayout[2]').click(timeout=5)2114 sleep(1)2115 u(resourceId="com.yoosee:id/tv_imagegallay_curprogress").wait(timeout=5)2116 u.swipe_ext("right", scale=0.8)2117 sleep(2)2118 u(resourceId="com.yoosee:id/tv_imagegallay_curprogress").wait(timeout=5)2119 assert '1/' in u(resourceId="com.yoosee:id/tv_imagegallay_curprogress").get_text(), '没有切换上一张图片/视频'2120 SameOperation().quit_app(u)2121 @classmethod2122 def jwt_91(cls, u, video_camera_name): #我的相册单个删除弹出二次确认弹框2123 SameOperation().app_go(u)2124 if u(resourceId='com.yoosee:id/setting_more_iv').wait(timeout=5):2125 pass2126 else:2127 SameOperation().add_wired(u, video_camera_name)2128 u.press('back')2129 if u(resourceId="com.yoosee:id/ll_defence_state").wait_gone(timeout=3.0):2130 u.swipe_ext("down", scale=0.8)2131 sleep(2)2132 u.xpath(2133 '//*[@resource-id="com.yoosee:id/lv_contact"]/android.widget.RelativeLayout[1]/android.widget.LinearLayout[1]/android.widget.RelativeLayout[2]/android.widget.LinearLayout[1]').click(2134 timeout=5)2135 sleep(3)2136 for screenshot_i in range(0,3):2137 u(resourceId="com.yoosee:id/iv_p_screenshot").click(timeout=5)2138 sleep(1)2139 u(resourceId="com.yoosee:id/back_btn").click(timeout=5)2140 u(resourceId="com.yoosee:id/icon_setting").click(timeout=5)2141 sleep(1)2142 u(resourceId="com.yoosee:id/icon_setting").click(timeout=5)2143 u(resourceId="com.yoosee:id/rl_album_low").click(timeout=5)2144 u.xpath('//android.widget.GridView/android.widget.RelativeLayout[2]').click(timeout=5)2145 u(resourceId="com.yoosee:id/iv_delete").click(timeout=5)2146 assert u(text="确定删除?").wait(timeout=5), '没有弹出二次确认弹框'2147 SameOperation().quit_app(u)2148 @classmethod2149 def jwt_92(cls, u, video_camera_name): #我的相册单个删除弹出二次确认弹框,点击否2150 SameOperation().app_go(u)2151 if u(resourceId='com.yoosee:id/setting_more_iv').wait(timeout=5):2152 pass2153 else:2154 SameOperation().add_wired(u, video_camera_name)2155 u.press('back')2156 if u(resourceId="com.yoosee:id/ll_defence_state").wait_gone(timeout=3.0):2157 u.swipe_ext("down", scale=0.8)2158 sleep(2)2159 u.xpath(2160 '//*[@resource-id="com.yoosee:id/lv_contact"]/android.widget.RelativeLayout[1]/android.widget.LinearLayout[1]/android.widget.RelativeLayout[2]/android.widget.LinearLayout[1]').click(2161 timeout=5)2162 sleep(3)2163 for screenshot_i in range(0,3):2164 u(resourceId="com.yoosee:id/iv_p_screenshot").click(timeout=5)2165 sleep(1)2166 u(resourceId="com.yoosee:id/back_btn").click(timeout=5)2167 u(resourceId="com.yoosee:id/icon_setting").click(timeout=5)2168 sleep(1)2169 u(resourceId="com.yoosee:id/icon_setting").click(timeout=5)2170 u(resourceId="com.yoosee:id/rl_album_low").click(timeout=5)2171 u.xpath('//android.widget.GridView/android.widget.RelativeLayout[2]').click(timeout=5)2172 u(resourceId="com.yoosee:id/iv_delete").click(timeout=5)2173 u(resourceId="com.yoosee:id/tv_no").click(timeout=5)2174 assert not u(text="确定删除?").exists, '点击否二次确认弹框消失'2175 SameOperation().quit_app(u)2176 @classmethod2177 def jwt_93(cls, u, video_camera_name): # 我的相册单个删除弹出二次确认弹框,点击是2178 SameOperation().app_go(u)2179 if u(resourceId='com.yoosee:id/setting_more_iv').wait(timeout=5):2180 pass2181 else:2182 SameOperation().add_wired(u, video_camera_name)2183 u.press('back')2184 if u(resourceId="com.yoosee:id/ll_defence_state").wait_gone(timeout=3.0):2185 u.swipe_ext("down", scale=0.8)2186 sleep(2)2187 u.xpath(2188 '//*[@resource-id="com.yoosee:id/lv_contact"]/android.widget.RelativeLayout[1]/android.widget.LinearLayout[1]/android.widget.RelativeLayout[2]/android.widget.LinearLayout[1]').click(2189 timeout=5)2190 sleep(3)2191 for screenshot_i in range(0, 3):2192 u(resourceId="com.yoosee:id/iv_p_screenshot").click(timeout=5)2193 sleep(1)2194 u(resourceId="com.yoosee:id/back_btn").click(timeout=5)2195 u(resourceId="com.yoosee:id/icon_setting").click(timeout=5)2196 sleep(1)2197 u(resourceId="com.yoosee:id/icon_setting").click(timeout=5)2198 u(resourceId="com.yoosee:id/rl_album_low").click(timeout=5)2199 u.xpath('//android.widget.GridView/android.widget.RelativeLayout[2]').click(timeout=5)2200 sleep(2)2201 total_img_1 = u(resourceId="com.yoosee:id/tv_imagegallay_curprogress").get_text().strip().split('/')2202 u(resourceId="com.yoosee:id/iv_delete").click(timeout=5)2203 u(resourceId="com.yoosee:id/tv_yes").click(timeout=5)2204 sleep(2)2205 total_img_2 = u(resourceId="com.yoosee:id/tv_imagegallay_curprogress").get_text().strip().split('/')2206 assert int(total_img_1[1]) > int(total_img_2[1]),'没有删除成功'2207 SameOperation().quit_app(u)2208 @classmethod2209 def jwt_94(cls, u, video_camera_name): # 设置图像翻转2210 SameOperation().app_go(u)2211 if u(resourceId='com.yoosee:id/setting_more_iv').wait(timeout=5):2212 pass2213 else:2214 SameOperation().add_wired(u, video_camera_name)2215 u.press('back')2216 if u(resourceId="com.yoosee:id/ll_defence_state").wait_gone(timeout=3.0):2217 u.swipe_ext("down", scale=0.8)2218 sleep(2)2219 # SameOperation().find_deldevices(u,'画面与声音')2220 u.xpath(2221 '//*[@resource-id="com.yoosee:id/lv_contact"]/android.widget.RelativeLayout[1]/android.widget.LinearLayout[1]/android.widget.RelativeLayout[2]/android.widget.LinearLayout[1]').click(2222 timeout=5)2223 sleep(3)2224 u(resourceId='com.yoosee:id/bottom_control_rl').wait_gone(timeout=5.0)2225 u.screenshot('image_flipping_1.png')2226 u(resourceId="com.yoosee:id/iv_set").click(timeout=5)2227 u(resourceId="com.yoosee:id/video_control").click(timeout=5)2228 u(resourceId="com.yoosee:id/sv_reverse_img").click(timeout=5)2229 u(resourceId="com.yoosee:id/back_btn").click(timeout=5)2230 u(resourceId="com.yoosee:id/back_btn").click(timeout=5)2231 u(resourceId='com.yoosee:id/center_direction_view').wait(timeout=5)2232 u.screenshot('image_flipping_2.png')2233 fl = SameOperation().img_statuscheck('image_flipping_1.png','image_flipping_2.png')2234 print (fl)2235 assert fl >500,'图像没翻转'2236 SameOperation().quit_app(u)2237 @classmethod2238 def jwt_95(cls, u, video_camera_name): # 触发报警,验证在线报警弹窗页面2239 SameOperation().app_go(u)2240 if u(resourceId='com.yoosee:id/setting_more_iv').wait(timeout=5):2241 pass2242 else:2243 SameOperation().add_wired(u, video_camera_name)2244 u.press('back')2245 if u(resourceId="com.yoosee:id/ll_defence_state").wait_gone(timeout=3.0):2246 u.swipe_ext("down", scale=0.8)2247 sleep(2)2248 if u(text="不报警").exists:2249 u(resourceId="com.yoosee:id/ll_defence_state").click(timeout=5)2250 sleep(3)2251 alarm = 02252 if u(resourceId='com.yoosee:id/alarming').wait(timeout=10):2253 u(resourceId="com.yoosee:id/iv_alarm_close").click(timeout=5)2254 alarm = 12255 u(resourceId="com.yoosee:id/ll_defence_state").click(timeout=5)2256 else:2257 u(resourceId="com.yoosee:id/ll_defence_state").click(timeout=5)2258 sleep(3)2259 if alarm == 0:2260 assert 1 == 0,'没有报警弹框页面'2261 SameOperation().quit_app(u)2262 @classmethod2263 def jwt_96(cls, u, video_camera_name): # 在线接收的报警消息在智能守护本地消息中有记录2264 SameOperation().app_go(u)2265 if u(resourceId='com.yoosee:id/setting_more_iv').wait(timeout=5):2266 pass2267 else:2268 SameOperation().add_wired(u, video_camera_name)2269 u.press('back')2270 if u(resourceId="com.yoosee:id/ll_defence_state").wait_gone(timeout=3.0):2271 u.swipe_ext("down", scale=0.8)2272 sleep(2)2273 u(resourceId="com.yoosee:id/icon_keyboard").click(timeout=5)2274 if u(resourceId='com.yoosee:id/item_ll').wait(timeout=5):2275 u(resourceId="com.yoosee:id/item_ll").long_click()2276 u(resourceId="com.yoosee:id/tv_select").click(timeout=5)2277 sleep(2)2278 if len(u(resourceId="com.yoosee:id/img_choose")) > 1:2279 u(resourceId="com.yoosee:id/cl_select_all").click(timeout=5)2280 u(resourceId="com.yoosee:id/cl_delete").click(timeout=5)2281 u.xpath('//*[@resource-id="android:id/content"]/android.widget.LinearLayout[1]/android.widget.LinearLayout[1]/android.widget.RelativeLayout[2]').click()2282 u(resourceId="com.yoosee:id/iv_close").click(timeout=5)2283 sleep(190)2284 u(resourceId="com.yoosee:id/icon_contact").click(timeout=5)2285 # if u(text="不报警").exists:2286 # u(resourceId="com.yoosee:id/ll_defence_state").click(timeout=5)2287 # sleep(3)2288 # if u(resourceId='com.yoosee:id/alarming').wait(timeout=10):2289 # u(resourceId="com.yoosee:id/iv_alarm_close").click(timeout=5)2290 # u(resourceId="com.yoosee:id/ll_defence_state").click(timeout=5)2291 # else:2292 # u(resourceId="com.yoosee:id/ll_defence_state").click(timeout=5)2293 # sleep(3)2294 u(resourceId="com.yoosee:id/icon_keyboard").click(timeout=5)2295 assert u(resourceId='com.yoosee:id/item_ll').wait(timeout=5),'在智能守护本地消息中没有记录'2296 SameOperation().quit_app(u)2297 @classmethod2298 def jwt_97(cls, u, video_camera_name): # 报警推送弹窗忽略本次返回原页面2299 SameOperation().app_go(u)2300 if u(resourceId='com.yoosee:id/setting_more_iv').wait(timeout=5):2301 pass2302 else:2303 SameOperation().add_wired(u, video_camera_name)2304 u.press('back')2305 if u(resourceId="com.yoosee:id/ll_defence_state").wait_gone(timeout=3.0):2306 u.swipe_ext("down", scale=0.8)2307 sleep(2)2308 if u(text="不报警").exists:2309 u(resourceId="com.yoosee:id/ll_defence_state").click(timeout=5)2310 sleep(3)2311 u(resourceId='com.yoosee:id/alarming').wait(timeout=10)2312 u(resourceId="com.yoosee:id/iv_alarm_close").click(timeout=5)2313 u(resourceId="com.yoosee:id/ll_defence_state").click(timeout=5)2314 sleep(2)2315 assert u(resourceId='com.yoosee:id/setting_more_iv').wait(timeout=5),'忽略本次返回原页面'2316 SameOperation().quit_app(u)2317 @classmethod2318 def jwt_98(cls, u, video_camera_name): # 报警推送弹窗测试出现弹窗页面2319 SameOperation().app_go(u)2320 if u(resourceId='com.yoosee:id/setting_more_iv').wait(timeout=5):2321 pass2322 else:2323 SameOperation().add_wired(u, video_camera_name)2324 u.press('back')2325 if u(resourceId="com.yoosee:id/ll_defence_state").wait_gone(timeout=3.0):2326 u.swipe_ext("down", scale=0.8)2327 sleep(2)2328 if u(text="不报警").exists:2329 u(resourceId="com.yoosee:id/ll_defence_state").click(timeout=5)2330 sleep(3)2331 alarm = 02332 if u(resourceId='com.yoosee:id/alarming').wait(timeout=10):2333 u(resourceId="com.yoosee:id/iv_alarm_close").click(timeout=5)2334 alarm = 12335 u(resourceId="com.yoosee:id/ll_defence_state").click(timeout=5)2336 else:2337 u(resourceId="com.yoosee:id/ll_defence_state").click(timeout=5)2338 sleep(3)2339 if alarm == 0:2340 assert 1 == 0, '没有报警推送弹窗测试出现弹窗页面'2341 SameOperation().quit_app(u)2342 @classmethod2343 def jwt_99(cls, u, video_camera_name): # 报警推送弹窗进入到设备监控页面2344 SameOperation().app_go(u)2345 if u(resourceId='com.yoosee:id/setting_more_iv').wait(timeout=5):2346 pass2347 else:2348 SameOperation().add_wired(u, video_camera_name)2349 u.press('back')2350 if u(resourceId="com.yoosee:id/ll_defence_state").wait_gone(timeout=3.0):2351 u.swipe_ext("down", scale=0.8)2352 sleep(2)2353 if u(text="不报警").exists:2354 u(resourceId="com.yoosee:id/ll_defence_state").click(timeout=5)2355 sleep(3)2356 u(resourceId='com.yoosee:id/alarming').wait(timeout=10)2357 u(resourceId="com.yoosee:id/iv_alarm_check").click(timeout=5)2358 assert u(resourceId='com.yoosee:id/bottom_control_rl').wait(timeout=5),'没有进入设备监控页面'2359 u(resourceId="com.yoosee:id/back_btn").click(timeout=5)2360 u(resourceId="com.yoosee:id/ll_defence_state").click(timeout=5)2361 SameOperation().quit_app(u)2362 @classmethod2363 def jwt_100(cls, u, video_camera_name): # 报警快捷键收到在线报警推送2364 SameOperation().app_go(u)2365 if u(resourceId='com.yoosee:id/setting_more_iv').wait(timeout=5):2366 pass2367 else:2368 SameOperation().add_wired(u, video_camera_name)2369 u.press('back')2370 if u(resourceId="com.yoosee:id/ll_defence_state").wait_gone(timeout=3.0):2371 u.swipe_ext("down", scale=0.8)2372 sleep(2)2373 if u(text="不报警").exists:2374 u(resourceId="com.yoosee:id/ll_defence_state").click(timeout=5)2375 sleep(3)2376 alarm = 02377 if u(resourceId='com.yoosee:id/alarming').wait(timeout=10):2378 u(resourceId="com.yoosee:id/iv_alarm_close").click(timeout=5)2379 alarm = 12380 u(resourceId="com.yoosee:id/ll_defence_state").click(timeout=5)2381 else:2382 u(resourceId="com.yoosee:id/ll_defence_state").click(timeout=5)2383 sleep(3)2384 if alarm == 0:2385 assert 1 == 0, '没有收到在线报警推送'2386 SameOperation().quit_app(u)2387 @classmethod2388 def jwt_101(cls, u, video_camera_name): # 设备主人点击智能气泡消息跳到智能守护页2389 u.app_clear('com.yoosee') # 清除应用数据2390 SameOperation().app_go(u)2391 SameOperation().log_in(u, phone_num, phone_pwd)2392 sleep(5)2393 u(resourceId='com.yoosee:id/tv_contact').click(timeout=5)2394 u(text="推送消息提醒").wait(timeout=10)2395 try:2396 u(text="消息通知说明").wait(timeout=10)2397 except:2398 u(resourceId="com.yoosee:id/iv_back").click(timeout=5)2399 if u(resourceId='com.yoosee:id/setting_more_iv').wait(timeout=5):2400 pass2401 else:2402 SameOperation().add_wired(u, video_camera_name)2403 u.press('back')2404 if u(resourceId="com.yoosee:id/ll_defence_state").wait_gone(timeout=3.0):2405 u.swipe_ext("down", scale=0.8)2406 #sleep(190)2407 u.swipe_ext("down", scale=0.8)2408 sleep(2)2409 u(resourceId="com.yoosee:id/msgLayout").wait(timeout=5)2410 u(resourceId="com.yoosee:id/msgLayout").click(timeout=5)2411 assert u(resourceId='com.yoosee:id/view_img_video').wait(timeout=5),'没有跳到智能守护页'2412 SameOperation().quit_app(u)2413 @classmethod2414 def jwt_102(cls, u, video_camera_name): # 跳到智能守护页,关闭卡片显示2415 u.app_clear('com.yoosee') # 清除应用数据2416 SameOperation().app_go(u)2417 SameOperation().log_in(u, phone_num, phone_pwd)2418 sleep(5)2419 u(resourceId='com.yoosee:id/tv_contact').click(timeout=5)2420 u(text="推送消息提醒").wait(timeout=10)2421 try:2422 u(text="消息通知说明").wait(timeout=10)2423 except:2424 u(resourceId="com.yoosee:id/iv_back").click(timeout=5)2425 if u(resourceId='com.yoosee:id/setting_more_iv').wait(timeout=5):2426 pass2427 else:2428 SameOperation().add_wired(u, video_camera_name)2429 u.press('back')2430 if u(resourceId="com.yoosee:id/ll_defence_state").wait_gone(timeout=3.0):2431 u.swipe_ext("down", scale=0.8)2432 #sleep(190)2433 u.swipe_ext("down", scale=0.8)2434 sleep(2)2435 u(resourceId="com.yoosee:id/msgLayout").wait(timeout=5)2436 u(resourceId="com.yoosee:id/msgLayout").click(timeout=5)2437 u(resourceId='com.yoosee:id/view_img_video').wait(timeout=5)2438 u(resourceId='com.yoosee:id/icon_contact').click(timeout=5)2439 assert not u(resourceId="com.yoosee:id/msgLayout").wait(timeout=5), '仍存在卡片消息'...

Full Screen

Full Screen

user_center.py

Source:user_center.py Github

copy

Full Screen

...30 self.d(resourceId="com.vova.android:id/tv_user_name").exists(timeout=3)31 log.i('刷新登录成功状态')32 @teststep33 def wait_get_it_gone(self):34 self.d(resourceId="com.vova.android:id/tv_get_it").wait_gone(timeout=10.0)35 @teststep36 def is_page(self):37 if self.d(resourceId="com.vova.android:id/tv_my_orders").wait(timeout=1):38 return True39 else:40 return False41 @teststep42 def click_GetIt_button(self):43 log.i("点击Get it按钮")44 self.d(resourceId="com.vova.android:id/tv_get_it").click()45 @teststep46 def click_signin_button(self):47 if BasePage.element_is_exists(self.d(resourceId="com.vova.android:id/tv_sign_in"), timeout=0) is False:48 self.find_element_by_swipe_down(self.d(resourceId="com.vova.android:id/tv_sign_in"))49 self.d(resourceId="com.vova.android:id/tv_sign_in").click()50 log.i("点击SIGN IN按钮")51 self.d(resourceId="com.vova.android:id/tv_sign_in").wait_gone(timeout=1.0)52 if self.d(resourceId="com.vova.android:id/tv_sign_in").click_exists(timeout=1.0):53 log.i("二次点击SIGN IN按钮") # 兼容低概率点不上的bug54 @teststep55 def clear_GetIt(self):56 while self.d(resourceId="com.vova.android:id/tv_get_it").wait(timeout=3):57 self.click_GetIt_button()58 @teststep59 def click_setting_button(self):60 if BasePage.element_is_exists(self.d(text="YOU MIGHT LIKE"), timeout=0) is False:61 self.find_element_by_swipe_up(self.d(text="YOU MIGHT LIKE")) # 往下拉一拉再点,兼容点不上的情况62 log.i("经上滑已发现setting位置")63 self.d(resourceId="com.vova.android:id/tv_setting", text='Settings').click()64 log.i("点击Setting按钮")65 self.d(resourceId="com.vova.android:id/tv_setting", text='Settings').wait_gone(timeout=1.0)66 if self.d(resourceId="com.vova.android:id/tv_setting", text='Settings').click_exists(timeout=1.0):67 log.i("二次点击Setting按钮") # 兼容低概率点不上的bug68 @teststep69 def click_my_orders_button(self):70 if BasePage.element_is_exists(71 self.d(resourceId="com.vova.android:id/tv_my_orders_view_all"), timeout=1) is False:72 self.find_element_by_swipe_down(self.d(resourceId="com.vova.android:id/tv_my_orders_view_all"))73 time.sleep(.5)74 self.d(resourceId="com.vova.android:id/tv_my_orders_view_all").click()75 log.i("点击orders列表按钮")76 self.d(resourceId="com.vova.android:id/tv_my_orders_view_all").wait_gone(timeout=1.0)77 if self.d(resourceId="com.vova.android:id/tv_my_orders_view_all").click_exists(timeout=1.0):...

Full Screen

Full Screen

test_session.py

Source:test_session.py Github

copy

Full Screen

...40 assert s(name="Settings").displayed41 s.swipe_up()42 assert s(name="Airplane Mode").wait(2.0, raise_error=False)43 s.swipe_down()44 assert s(name="Airplane Mode").wait_gone(2.0, raise_error=False)45@mark.skip("wda bug")46def test_session_set_text():47 with c.session('com.apple.mobilesafari') as s:48 s(name='URL', className='Button').set_text("status.github.com")49 url = s(name='URL', className='TextField').get()50 assert url.value == 'status.github.com'51@mark.skip("TODO")52def test_session_window_size():53 s = c.session()54 wsize = s.window_size()55 assert wsize.width == 32056 assert wsize.height == 56857@mark.skip("wda bug")58def test_session_send_keys():59 with c.session('com.apple.mobilesafari') as s:60 u = s(label='Address', className='Button')61 u.clear_text()62 s.send_keys('www.github.com')63 assert 'www.github.com' == s(label='Address', className='TextField').get().value64@mark.skip("wait for WDA fix")65def test_session_keyboard_dismiss():66 with c.session('com.apple.mobilesafari') as s:67 u = s(label='Address', className='Button')68 u.clear_text()69 s.send_keys('www.github.com')70 assert s(className='Keyboard').exists71 s.keyboard_dismiss()72 assert not s(className='Keyboard').exists73def test_session_orientation(c: wda.Client):74 c.orientation = wda.PORTRAIT75 with c.session('com.apple.mobilesafari') as s:76 assert s.orientation == wda.PORTRAIT77 s.orientation = wda.LANDSCAPE78 time.sleep(1.0)79 assert s.orientation == wda.LANDSCAPE80 # recover orientation81 s.orientation = wda.PORTRAIT82def test_session_invalid_with_autofix(c: wda.Client):83 c.session("com.apple.Preferences")84 c.session_id = "123"85 assert c.app_current().bundleId == "com.apple.Preferences"86 assert isinstance(c.info, dict)87 assert c.session_id != "123"88@mark.skip("TODO")89def test_session_wait_gone():90 s = c.session()91 elem = s(name="Settings", visible=True)92 with pytest.raises(wda.WDAElementNotDisappearError) as e_info:93 elem.wait_gone(1.0)94 assert not elem.wait_gone(1.0, raise_error=False)95 s.swipe_left()96 assert elem.wait_gone(1.0)97@mark.skip("Require English")98def test_text_contains_matches(c: wda.Client):99 with c.session('com.apple.Preferences') as s:100 s(text='Bluetooth').get()101 assert s(textContains="Blue").exists102 assert not s(text="Blue").exists103 assert s(text="Bluetooth").exists104 assert s(textMatches="Blue?").exists105 assert s(nameMatches="Blue?").exists106 assert not s(textMatches="^lue?").exists107 assert not s(textMatches="^Blue$").exists108 assert s(textMatches=r"^(Blue|Red).*").exists109@pytest.mark.skip("not passed on IRMA")110def test_app_operation(c: wda.Client):...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run ATX automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful