From 031760448115f4f486d620ada7c5290bad8f15ba Mon Sep 17 00:00:00 2001 From: Marc Bonnici Date: Wed, 28 Jun 2017 10:57:28 +0100 Subject: [PATCH] Workload: Moved uiauto command initialization to setup In order to be able to pass the package name of the app under test to the instrumented test, the generation of the uiautomator commands needed to be postponed until after the apk resolution had been performed. --- wa/framework/workload.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/wa/framework/workload.py b/wa/framework/workload.py index de6f9976..e20a0c26 100644 --- a/wa/framework/workload.py +++ b/wa/framework/workload.py @@ -191,7 +191,6 @@ class ApkUIWorkload(ApkWorkload): def init_resources(self, context): super(ApkUIWorkload, self).init_resources(context) self.gui.init_resources(context.resolver) - self.gui.init_commands() def initialize(self, context): super(ApkUIWorkload, self).initialize(context) @@ -227,6 +226,11 @@ class ApkUiautoWorkload(ApkUIWorkload): super(ApkUiautoWorkload, self).__init__(target, **kwargs) self.gui = UiAutomatorGUI(self) + def setup(self, context): + self.gui.uiauto_params['package_name'] = self.apk.apk_info.package + self.gui.init_commands() + super(ApkUiautoWorkload, self).setup(context) + class ReventWorkload(ApkUIWorkload): @@ -396,9 +400,6 @@ class ReventGUI(object): def remove(self): self.revent_recorder.remove() - def init_commands(self): - pass - def _check_revent_files(self): if not self.revent_run_file: # pylint: disable=too-few-format-args