From 3c2d5e4b10b6b93937137ab67f688602834721f9 Mon Sep 17 00:00:00 2001 From: rongzhus Date: Wed, 6 Sep 2023 20:34:09 +0800 Subject: [PATCH] fix record video --- synctl | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/synctl b/synctl index b7cfee4..20b9439 100755 --- a/synctl +++ b/synctl @@ -598,6 +598,7 @@ class SyntheticConfiguration(Base): "script": "", "syntheticType": "WebpageScript", "browser": "chrome", + "recordVideo": False } # syntheticType WebpageAction @@ -1875,6 +1876,12 @@ class PatchSyntheticTest(SyntheticTest): payload["description"] = description self.__patch_a_synthetic_test(self.test_id, json.dumps(payload)) + def patch_record_video(self, record_video=False): + payload = {"configuration": {"recordVideo": False}} + if record_video is not None and record_video.upper() in ("TRUE", "FALSE"): + payload["configuration"]["recordVideo"] = record_video + self.__patch_a_synthetic_test(self.test_id, json.dumps(payload)) + def patch_active(self, active): """active""" if active is None: @@ -2651,6 +2658,8 @@ class ParseParameter: '--operation', type=str, metavar="", help="HTTP request methods, GET, POST, HEAD, PUT, etc.") patch_exclusive_group.add_argument( '--mark-synthetic-call', type=str, metavar="", help='set markSyntheticCall') + patch_exclusive_group.add_argument( + '--record-video', type=str, choices=['true', 'false'], metavar="", help='set true to record video') # timeout Expected (ms|s|m) patch_exclusive_group.add_argument( @@ -2999,13 +3008,15 @@ def main(): if get_args.type in (2, 3, 4): payload.set_browser_type(get_args.browser) + if get_args.record_video is not None: + payload.set_record_video(get_args.record_video) + + if get_args.type == 4: if get_args.url is not None: payload.set_ping_url(get_args.url) else: print("url is required") - if get_args.record_video is not None: - payload.set_record_video(get_args.record_video) # global operation, add label, location, description, frequency, etc. if get_args.label is not None: @@ -3061,6 +3072,8 @@ def main(): patch_instance.patch_config_script_file(get_args.script_file) elif get_args.description is not None: patch_instance.patch_description(get_args.description) + elif get_args.record_video is not None: + patch_instance.patch_record_video(get_args.record_video) elif get_args.label is not None: patch_instance.patch_label(get_args.label) elif get_args.location is not None: