Skip to content

Commit df330ef

Browse files
author
Sakari Rautiainen
authored
Merge pull request #53 from sagge/master
Added method for getting test run files with possibility to filter files based on tags
2 parents e503ce5 + f363da5 commit df330ef

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,3 +71,11 @@ Troubleshooting
7171

7272
If you see Pillow error messages on Linux you are most likely missing python-dev, see dependencies.
7373

74+
Contributing
75+
------------
76+
77+
1. **Fork** the repository and clone it locally.
78+
2. **Create a branch** from Bitbar devel branch for your edits.
79+
3. **Commit and push** to your own branch in Github
80+
4. **Open pull request** for your changes for Bitbar devel branch.
81+

testdroid/__init__.py

Lines changed: 10 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'])
@@ -713,6 +721,7 @@ def get_commands(self):
713721
"test-run": self.get_test_run,
714722
"test-runs": self.print_project_test_runs,
715723
"device-runs": self.get_device_runs,
724+
"device-run-files": self.get_device_run_files,
716725
"download-test-run": self.download_test_run,
717726
"download-test-screenshots": self.download_test_screenshots
718727
}

0 commit comments

Comments
 (0)