diff --git a/cases/smoke/basic/screenshot32/resource/app_capture_screen_test_config.json b/cases/smoke/basic/screenshot32/resource/app_capture_screen_test_config.json index 9a34c27a3c267b63d5bc0c0e5db1c670b780f760..b65dfabc40ed36449f9d63ad9c762fc16f979a65 100644 --- a/cases/smoke/basic/screenshot32/resource/app_capture_screen_test_config.json +++ b/cases/smoke/basic/screenshot32/resource/app_capture_screen_test_config.json @@ -1,7 +1,26 @@ [ { "DEVICE_1":[], - "DEVICE_2":[1] + "DEVICE_2":[1], + "DEVICE_3":[6, 7, 8, 9 ,10, 11], + "DEVICE_4":[1, 2, 3, 4, 5], + "recent-x-y":[515, 1240], + "recent_del-x-y":[360, 1170], + "permisson_ok-x-y":[500, 1130], + "note_content-x-y":[500, 310], + "kill_keyboard-x-y":[690, 690], + "take_photos-x-y":[360, 1095], + "convert_to_video-x-y":[430, 980], + "convert_to_photos-x-y":[200, 1095], + "last_photos-x-y":[100, 220], + "stop_video-x-y":[320, 1095], + "phone-x-y":[645, 1060], + "screenshot-x-y":[115,480], + "remount":["mount -o rw,remount"], + "stop_hilog":["hilog -w stop"], + "cmp_cmd-level":["", 80], + "get_file_from_dev":[""], + "send_file_to_dev":["", ""] }, { "app_name": "wifi_connect", @@ -10,5 +29,106 @@ "all_actions": [ [2, "connect_wifi"], [1, "check_ping_baidu"] ] + }, + { + "app_name": "crash_check", + "entry": "", + "compress_file_recv":["cd /data/log/faultlog/temp && tar -cf crash_log.tar cppcrash*"], + "all_actions": [ + [1, "remount"], [1, "process_crash_check", "foundation"], [1, "process_crash_check", "render_service"], [1, "process_crash_check", "appspawn"], [1, "compress_file_recv"], + [1, "get_file_from_dev", "/data/log/faultlog/temp/crash_log.tar"] + ] + }, + { + "app_name": "notification_bar", + "entry": "", + "pull_down_cmd":["uinput -T -m 500 0 500 80"], + "swipe_up_cmd":["uinput -T -m 500 500 500 300"], + "all_actions": [ + [2, "pull_down_cmd"], [2, "pull_down_cmd"], [2, "shot_cmd", "notification_bar"], [1, "cmp_cmd-level", "notification_bar", 70], [1, "swipe_up_cmd"], [1, "swipe_up_cmd"] + ] + }, + { + "app_name": "camera", + "entry": "", + "check_result":["cd /data/log/hilog && grep -nr PreviewOutputCallback", "OnFrameStarted"], + "compress_log":["cd /data/log/hilog && tar -cf camera_log.tar *"], + "open_camera_log":["rm /data/log/hilog/* && hilog -b X;hilog -b D -T CAMERA;hilog -r"], + "start_camera":["aa start -a com.ohos.camera.MainAbility -b com.ohos.camera"], + "recover_log":["cd data/log/hilog/;hilog -x > camera_log.txt;hilog -b D"], + "check_photos":["aa dump -a | grep com.ohos.photos.MainAbility", "com.ohos.photos"], + "kill_camera": ["killall com.ohos.camera"], + "kill_photos": ["killall com.ohos.photos"], + "all_actions": [ + [1, "open_camera_log"], [5, "start_camera"], [3, "take_photos-x-y"], [2, "convert_to_video-x-y"], [3, "take_photos-x-y"], [2, "stop_video-x-y"], [6, "convert_to_photos-x-y"], + [1, "recover_log"], [1, "check_result"], [1, "shot_cmd", "camera"], [1, "compress_log"], [1, "check_photos"], [1, "get_file_from_dev", "/data/log/hilog/camera_log.tar"], + [1, "kill_camera"], [1, "kill_photos"] + ] + }, + { + "app_name": "photos", + "entry": "", + "pull_down_cmd":["uinput -T -m 500 0 550 30"], + "start_screenshot": ["aa start -a com.ohos.screenshot.ServiceExtAbility -b com.ohos.screenshot"], + "start_photos": ["aa start -a com.ohos.photos.MainAbility -b com.ohos.photos"], + "kill_photos": ["killall com.ohos.photos"], + "all_actions": [ + [2, "pull_down_cmd"], [5, "screenshot-x-y"], [5, "start_photos"], [2, "last_photos-x-y"], [2, "shot_cmd", "photos"], [1, "cmp_cmd-level", "photos", 70], + [1, "process_check", "com.ohos.medialibrary.medialibrarydata"], [2, "sandbox_path_check"], [1, "kill_photos"] + ] + }, + { + "app_name": "video_test", + "entry": "", + "mk_test_dir":["mkdir -p /data/app/el2/100/base/ohos.acts.multimedia.video.videoplayer/haps/entry/files"], + "start_video_log":["rm /data/log/hilog/* && hilog -r && hilog -Q pidoff;hilog -G 512M;hilog -w start -l 400000000 -m none"], + "start_test":["aa test -p ohos.acts.multimedia.video.videoplayer -b ohos.acts.multimedia.video.videoplayer -s unittest OpenHarmonyTestRunner -w 2000000 -s timeout 60000", "Failure: 0, Error: 0, Pass: 1"], + "compress_log":["cd /data/log/hilog && tar -cf video_log.tar *"], + "kill_video": ["killall ohos.acts.multimedia.video.videoplayer"], + "all_actions": [ + [1,"start_video_log"], [2, "install_hap", "vediotest/ActsVideoPlayerJsTest.hap"], [1, "mk_test_dir"], [1, "remount"], + [1, "send_file_to_dev", "vediotest/H264_AAC.mp4", "/data/app/el2/100/base/ohos.acts.multimedia.video.videoplayer/haps/entry/files/"], + [5, "start_test"], [1, "stop_hilog"], [1, "compress_log"], [1, "get_file_from_dev", "/data/log/hilog/video_log.tar"], [1, "kill_video"] + ] + }, + { + "app_name": "settings", + "entry": "aa start -a com.ohos.settings.MainAbility -b com.ohos.settings", + "kill_settings": ["killall com.ohos.settings"], + "all_actions": [ + [2, "shot_cmd", "settings"], [1, "cmp_cmd-level", "settings"], [1, "kill_settings"] + ] + }, + { + "app_name": "note", + "entry": "aa start -a MainAbility -b com.ohos.note", + "kill_note": ["killall com.ohos.note"], + "all_actions": [ + [2, "kill_keyboard-x-y"], [2, "permisson_ok-x-y"], [2, "permisson_ok-x-y"], [5, "note_content-x-y"], [2, "note_content-x-y"], [2, "shot_cmd", "note"], [1, "cmp_cmd-level", "note", 70], [2, "recent-x-y"], [1, "recent_del-x-y"] + ] + }, + { + "app_name": "contacts", + "entry": "aa start -a com.ohos.contacts.MainAbility -b com.ohos.contacts", + "kill_contacts": ["killall com.ohos.contacts"], + "all_actions": [ + [2, "phone-x-y"], [2, "phone-x-y"], [2, "shot_cmd", "contacts"], [1, "cmp_cmd-level", "contacts", 75], [1, "kill_contacts"] + ] + }, + { + "app_name": "mms", + "entry": "aa start -a com.ohos.mms.MainAbility -b com.ohos.mms", + "kill_mms": ["killall com.ohos.mms"], + "all_actions": [ + [2, "shot_cmd", "mms"], [1, "cmp_cmd-level", "mms", 75], [1, "kill_mms"] + ] + }, + { + "app_name": "distributedmusicplayer", + "entry": "aa start -a ohos.samples.distributedmusicplayer.MainAbility -b ohos.samples.distributedmusicplayer", + "kill_distributedmusicplayer": ["killall ohos.samples.distributedmusicplayer"], + "all_actions": [ + [2, "permisson_ok-x-y"], [2, "permisson_ok-x-y"], [2, "permisson_ok-x-y"], [2, "shot_cmd", "distributedmusicplayer"], [1, "cmp_cmd-level", "distributedmusicplayer", 70], [1, "kill_distributedmusicplayer"] + ] } ] diff --git a/cases/smoke/basic/screenshot32/resource/capturescreentest.py b/cases/smoke/basic/screenshot32/resource/capturescreentest.py index 3a12e19161ca91ed1683001908a7104bf367a143..dc48ef6e876375d199bb884085d5942cd5de9fd9 100644 --- a/cases/smoke/basic/screenshot32/resource/capturescreentest.py +++ b/cases/smoke/basic/screenshot32/resource/capturescreentest.py @@ -111,41 +111,6 @@ def file_from_dev(src, dst): return enter_cmd(cmd, 1, 1) -def image_check(str, testnum=1): - conn = sqlite3.connect(str) - cursor_image = conn.cursor() - cursor_video = conn.cursor() - print_to_log("SmokeTest:: start to check media library path") - try: - print_to_log("SmokeTest:: select * from files where mime_type = image/*") - cursor_image.execute("""select * from files where mime_type = "image/*" """) - except: - print_to_log("SmokeTest:: error: media_library.db cannot be found, please check media library path") - return -1 - if testnum == 2: - try: - print_to_log("SmokeTest:: select * from files where mime_type = video/mp4") - cursor_video.execute("""select * from files where mime_type = "video/mp4" """) - except: - print_to_log("SmokeTest:: error: media_library.db cannot be found, please check media library path") - return -1 - print_to_log("SmokeTest:: media library is ok") - image_result = cursor_image.fetchone() - video_result = cursor_video.fetchone() - print_to_log("SmokeTest:: image: {}".format(image_result)) - print_to_log("SmokeTest:: video: {}".format(video_result)) - print_to_log("SmokeTest:: start to check photos and videos in the album") - if image_result is not None and testnum == 1: - print_to_log("SmokeTest:: success: There are some photos in the album!!") - return 1 - elif image_result is not None and video_result is not None and testnum == 2: - print_to_log("SmokeTest:: success: There are some photos and videos in the album!!") - return 1 - else: - print_to_log("SmokeTest:: error: There are no photos or videos in the album!!") - return -1 - - def connect_check(): connection_status = enter_cmd("hdc_std list targets", 2) connection_cnt = 0 @@ -257,6 +222,14 @@ def classify_hist_with_split(image1, image2, size=(256, 256)): return sub_data +def crop_picture(prefix, pic): + pic_path = "{}/{}_{}".format(args.save_path, prefix, pic) + save_path = "{}/{}_{}".format(args.save_path, prefix, pic) + im = cv2.imread(pic_path) + im = im[80:1200, 0:720] + cv2.imwrite(save_path, im) + + def cmp_picture(prefix, pic, num=1): if num == 1: img1_path = "{}/{}".format(args.anwser_path, pic) @@ -288,7 +261,7 @@ if __name__ == "__main__": parser.add_argument('--anwser_path', type=str, default = 'D:\\DeviceTestTools\\screenshot\\resource') parser.add_argument('--save_path', type=str, default = 'D:\\DeviceTestTools\\screenshot') parser.add_argument('--device_num', type=str, default = 'null') - parser.add_argument('--pr_url', type=str, default = 'https://gitee.com/openharmony/applications_sample_wifi_iot/') + parser.add_argument('--pr_url', type=str, default = 'https://gitee.com/openharmony/developtools_integration_verification') args = parser.parse_args() if args.device_num == 'null': @@ -410,8 +383,17 @@ if __name__ == "__main__": else: picture_save(picture_path) print_to_log("SmokeTest:: error:testcase 0, distributed failed!") + sys_exit() enter_shell_cmd("ifconfig eth0 down", 1) + if "arkui_ace_engine" in args.pr_url or "developtools_integration_verification" in args.pr_url: + if args.test_num == "1/2": + args.test_num = "3/2" + elif args.test_num == "2/2": + args.test_num = "4/2" + else: + args.test_num = "1/1" + print(args.pr_url) try: args.test_num.index('/') idx_total = args.test_num.split('/') @@ -475,6 +457,7 @@ if __name__ == "__main__": similarity = global_pos['cmp_cmd-level'][1] print_to_log("SmokeTest:: start to contrast screenshot") pic = "{}{}".format(single_action[2], ".jpeg") + crop_picture(prefix, pic) pic_similarity = cmp_picture(prefix, pic) print_to_log("SmokeTest:: picture similarity is {}%".format(pic_similarity)) if len(single_action) == 3 or len(single_action) == 4: @@ -508,14 +491,6 @@ if __name__ == "__main__": testok = 1 else: testok = -1 - elif type(single_action[1]) == str and single_action[1] == 'photo_check': - next_cmd = "" - pic_value = image_check("{}\\media_library.db".format(os.path.normpath(args.save_path)), 1) - video_value = image_check("{}\\media_library.db".format(os.path.normpath(args.save_path)), 2) - if pic_value == 1 and video_value == 1 and testok == 1: - testok = 1 - else: - testok = -1 elif type(single_action[1]) == str and single_action[1] == 'process_check': next_cmd = "" if len(single_action) == 3: diff --git a/cases/smoke/basic/screenshot32/resource/contacts.jpeg b/cases/smoke/basic/screenshot32/resource/contacts.jpeg new file mode 100644 index 0000000000000000000000000000000000000000..5903b54bf7d6b88151a4e59942b9379b0360a7dd Binary files /dev/null and b/cases/smoke/basic/screenshot32/resource/contacts.jpeg differ diff --git a/cases/smoke/basic/screenshot32/resource/distributedmusicplayer.jpeg b/cases/smoke/basic/screenshot32/resource/distributedmusicplayer.jpeg new file mode 100644 index 0000000000000000000000000000000000000000..7053239010419f6b03c819868801792a0941cacc Binary files /dev/null and b/cases/smoke/basic/screenshot32/resource/distributedmusicplayer.jpeg differ diff --git a/cases/smoke/basic/screenshot32/resource/launcher.jpeg b/cases/smoke/basic/screenshot32/resource/launcher.jpeg index 3d688bd366d84a44579f02670f09b2185fbd3603..3ebdcd145e634c8fdba25a06e8605ad691a03f88 100644 Binary files a/cases/smoke/basic/screenshot32/resource/launcher.jpeg and b/cases/smoke/basic/screenshot32/resource/launcher.jpeg differ diff --git a/cases/smoke/basic/screenshot32/resource/mms.jpeg b/cases/smoke/basic/screenshot32/resource/mms.jpeg new file mode 100644 index 0000000000000000000000000000000000000000..80d5ceeffddf406441fea01b3109742a30a7ed54 Binary files /dev/null and b/cases/smoke/basic/screenshot32/resource/mms.jpeg differ diff --git a/cases/smoke/basic/screenshot32/resource/note.jpeg b/cases/smoke/basic/screenshot32/resource/note.jpeg new file mode 100644 index 0000000000000000000000000000000000000000..ca261cf9d5b74918186cacbae9686aca47021947 Binary files /dev/null and b/cases/smoke/basic/screenshot32/resource/note.jpeg differ diff --git a/cases/smoke/basic/screenshot32/resource/notification_bar.jpeg b/cases/smoke/basic/screenshot32/resource/notification_bar.jpeg new file mode 100644 index 0000000000000000000000000000000000000000..3df52e44d3ea6026c0ebdb4b5c23b36942002ee8 Binary files /dev/null and b/cases/smoke/basic/screenshot32/resource/notification_bar.jpeg differ diff --git a/cases/smoke/basic/screenshot32/resource/photos.jpeg b/cases/smoke/basic/screenshot32/resource/photos.jpeg new file mode 100644 index 0000000000000000000000000000000000000000..faccdff55629484ed30f8e18adec2bc07d1cc41d Binary files /dev/null and b/cases/smoke/basic/screenshot32/resource/photos.jpeg differ diff --git a/cases/smoke/basic/screenshot32/resource/settings.jpeg b/cases/smoke/basic/screenshot32/resource/settings.jpeg new file mode 100644 index 0000000000000000000000000000000000000000..bc8f8b8ee3ebf3d2e93688dd708e43747bf16c3e Binary files /dev/null and b/cases/smoke/basic/screenshot32/resource/settings.jpeg differ