Skip to content

Commit 9d955f9

Browse files
author
Sakari Pesonen
committed
added method for getting test run files with possibility to filter files based on tags
1 parent e771b61 commit 9d955f9

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

testdroid/__init__.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -549,6 +549,14 @@ def get_device_runs(self, project_id, test_run_id, limit=0):
549549
def get_device_run_screenshots_list(self, project_id, test_run_id, device_run_id, limit=0):
550550
return self.get("me/projects/%s/runs/%s/device-runs/%s/screenshots" % (project_id, test_run_id, device_run_id), payload = {'limit': limit})
551551

552+
""" Get list of files for device run
553+
"""
554+
def get_device_run_files(self, project_id, test_run_id, device_session_id, tags=None):
555+
if tags is None:
556+
return self.get("me/projects/%s/runs/%s/device-sessions/%s/output-file-set/files" % (project_id, test_run_id, device_session_id))
557+
else:
558+
return self.get("me/projects/%s/runs/%s/device-sessions/%s/output-file-set/files?tag[]=%s" % (project_id, test_run_id, device_session_id, tags))
559+
552560
""" Downloads test run files to a directory hierarchy
553561
"""
554562
def download_test_run(self, project_id, test_run_id):
@@ -566,7 +574,7 @@ def download_test_run(self, project_id, test_run_id):
566574
if run_status in ("SUCCEEDED", "FAILED", "EXCLUDED"):
567575
directory = "%s-%s/%d-%s" % (test_run_id, test_run['displayName'], device_run['id'], device_run['device']['displayName'])
568576
session_id = device_run['deviceSessionId']
569-
files = self.get("me/projects/%s/runs/%s/device-sessions/%s/output-file-set/files" % (project_id, test_run_id, session_id))
577+
files = get_device_run_files(project_id, test_run_id, session_id)
570578
for file in files['data']:
571579
if file['state'] == "READY":
572580
full_path = "%s/%s" % (directory, file['name'])

0 commit comments

Comments
 (0)