diff --git a/wlauto/workloads/gmail/__init__.py b/wlauto/workloads/gmail/__init__.py index 8e002e43..4d58674f 100755 --- a/wlauto/workloads/gmail/__init__.py +++ b/wlauto/workloads/gmail/__init__.py @@ -19,6 +19,7 @@ import re import time from wlauto import AndroidUiAutoBenchmark, Parameter +from wlauto.exceptions import DeviceError class Gmail(AndroidUiAutoBenchmark): @@ -77,6 +78,9 @@ class Gmail(AndroidUiAutoBenchmark): def initialize(self, context): super(Gmail, self).initialize(context) + if not self.device.is_wifi_connected(): + raise DeviceError('Wifi is not connected for device {}'.format(self.device.name)) + self.storage_dir = self.device.path.join(self.device.working_directory) for file in os.listdir(self.dependencies_directory): diff --git a/wlauto/workloads/googlephotos/__init__.py b/wlauto/workloads/googlephotos/__init__.py index e4b91462..fff5d6b8 100755 --- a/wlauto/workloads/googlephotos/__init__.py +++ b/wlauto/workloads/googlephotos/__init__.py @@ -17,6 +17,7 @@ import os import re from wlauto import AndroidUiAutoBenchmark, Parameter +from wlauto.exceptions import DeviceError class Googlephotos(AndroidUiAutoBenchmark): @@ -78,6 +79,9 @@ class Googlephotos(AndroidUiAutoBenchmark): def initialize(self, context): super(Googlephotos, self).initialize(context) + if not self.device.is_wifi_connected(): + raise DeviceError('Wifi is not connected for device {}'.format(self.device.name)) + for entry in os.listdir(self.dependencies_directory): wa_file = ''.join([self.file_prefix, entry]) if entry.endswith(".jpg"): diff --git a/wlauto/workloads/reader/__init__.py b/wlauto/workloads/reader/__init__.py index c53f7be8..85975607 100755 --- a/wlauto/workloads/reader/__init__.py +++ b/wlauto/workloads/reader/__init__.py @@ -19,6 +19,7 @@ import re import time from wlauto import AndroidUiAutoBenchmark, Parameter +from wlauto.exceptions import DeviceError class Reader(AndroidUiAutoBenchmark): @@ -77,6 +78,12 @@ class Reader(AndroidUiAutoBenchmark): self.uiauto_params['password'] = self.password self.uiauto_params['dumpsys_enabled'] = self.dumpsys_enabled + def initialize(self, context): + super(Reader, self).initialize(context) + + if not self.device.is_wifi_connected(): + raise DeviceError('Wifi is not connected for device {}'.format(self.device.name)) + def setup(self, context): super(Reader, self).setup(context) diff --git a/wlauto/workloads/skype/__init__.py b/wlauto/workloads/skype/__init__.py index 53bb6671..69f43a83 100755 --- a/wlauto/workloads/skype/__init__.py +++ b/wlauto/workloads/skype/__init__.py @@ -18,6 +18,7 @@ import re import time from wlauto import AndroidUiAutoBenchmark, Parameter +from wlauto.exceptions import DeviceError SKYPE_ACTION_URIS = { @@ -94,6 +95,12 @@ class Skype(AndroidUiAutoBenchmark): self.uiauto_params['duration'] = self.duration self.uiauto_params['action'] = self.action + def initialize(self, context): + super(Skype, self).initialize(context) + + if not self.device.is_wifi_connected(): + raise DeviceError('Wifi is not connected for device {}'.format(self.device.name)) + def setup(self, context): self.logger.info('===== setup() ======') super(Skype, self).setup(context)