Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/alexal1/Insomniac
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander Mishchenko committed Sep 27, 2020
2 parents 8f5ce6f + 59493e5 commit d10d0a6
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/device_facade.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,16 @@ def screenshot(self, path):
self.deviceV1.screenshot(path)
else:
self.deviceV2.screenshot(path)

def dump_hierarchy(self, path):
xml_dump = ''
if self.deviceV1 is not None:
xml_dump = self.deviceV1.dump()
else:
xml_dump = self.deviceV2.dump_hierarchy()

with open(path, 'w') as outfile:
outfile.write(xml_dump)

class View:
deviceV1 = None # uiautomator
Expand Down
6 changes: 6 additions & 0 deletions src/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,12 @@ def save_crash(device):
except RuntimeError:
print(COLOR_FAIL + "Cannot save screenshot." + COLOR_ENDC)

view_hierarchy_format = ".xml"
try:
device.dump_hierarchy("crashes/" + directory_name + "/view_hierarchy" + view_hierarchy_format)
except RuntimeError:
print(COLOR_FAIL + "Cannot save view hierarchy." + COLOR_ENDC)

with open("crashes/" + directory_name + "/logs.txt", 'w') as outfile:
outfile.write(print_log)

Expand Down

0 comments on commit d10d0a6

Please sign in to comment.