コード例 #1
0
 def setup(self):
     self.setUpSuccessful = False
     super().setup()
     log.info(self.audioFile)
     compLibObj = LinuxWearablesLibrary(self.campDevice)
     log.info('Checking/Installing the Automation APK')
     self.libObj.checkAndInstallAPK(APK.AUTOMATION_APK.value)
     compLibObj.checkAndInstallAPK(APK.AUTOMATION_APK.value, 'comp')
     self.installAudioAPK(self.libObj, APK.LW_AUDIO.value, self.device)
     self.installAudioAPK(compLibObj, APK.COMPANION_AUDIO.value,
                          self.campDevice)
     self.compIotLibObj = IOTLibrary(self.campDevice)
     log.info(
         'Creating Screenshot folder in Companion and Wearable To Collect Logs'
     )
     self.campDevice.makeDirectoryOnDevice(FILE.SCREENSHOT.value)
     log.info('Pushing audio Files to companion')
     audioFilePath = self.libObj.buildPath(IOT_CLIPS_AUDIO, self.audioFile)
     self.campDevice.makeDirectoryOnDevice(
         SYSTEM_FILE.COMP_MUSIC_FOLDER.value)
     self.campDevice.pushResource(audioFilePath,
                                  SYSTEM_FILE.COMP_MUSIC_FOLDER.value)
     log.info('Syncying The Audio File from Companion to Wearable Device')
     options = "-w -r -e debug false -e class " + self.libObj.getInstrumentationCommand(
         'AudioCompSync')
     output = self.campDevice.executeAmCommand(
         AM_SUB_COMMANDS.INSTRUMENT.value, options)
     self.libObj.toggleBluetooth(True)
     log.info('Sleeping 10 seconds')
     time.sleep(SLEEP.SLEEP_10.value)
     if 'Fail' in output:
         log.info(output)
         self.comments += 'Sync from companion to wearable did not occur'
         raise Exception('Sync from companion to wearable did not occur')
     self.setUpSuccessful = True
コード例 #2
0
 def setup(self):
     super().setup()
     log.info('Turning On Bluetooth')
     self.libObj.toggleBluetooth(True)
     log.info('Sleeping 10 seconds')
     time.sleep(SLEEP.SLEEP_10.value)
     self.compLibObj = LinuxWearablesLibrary(self.campDevice)
コード例 #3
0
 def setup(self):
     self.setUpSuccessful = False
     super().setup()
     log.info('Checking/Installing the Automation APK on companion')
     compLibObj = LinuxWearablesLibrary(self.campDevice)
     compLibObj.checkAndInstallAPK(APK.AUTOMATION_APK.value, 'comp')
     log.info('Turning On Bluetooth in Wearable')
     self.compIotLibObj = IOTLibrary(self.campDevice)
     log.info('Creating Screenshot folder in Companion and Wearable To Collect Logs')
     self.campDevice.makeDirectoryOnDevice(FILE.SCREENSHOT.value)
     self.device.makeDirectoryOnDevice(FILE.SCREENSHOT.value)
     self.libObj.toggleBluetooth(True)
     self.setUpSuccessful = True
コード例 #4
0
 def setup(self):
     super().setup()
     log.info('Checking/Installing the Automation APK on both LW and Companion')
     self.libObj.checkAndInstallAPK(APK.AUTOMATION_APK.value, 'LW')
     compLibObj = LinuxWearablesLibrary(self.campDevice)
     compLibObj.checkAndInstallAPK(APK.AUTOMATION_APK.value, 'comp')
     self.compIotLibObj = IOTLibrary(self.campDevice)
     log.info('Creating Screenshot folder in Companion and Wearable To Collect Logs')
     self.campDevice.makeDirectoryOnDevice(FILE.SCREENSHOT.value)
     log.info('Turning On Bluetooth')
     self.libObj.toggleBluetooth(True)
     log.info('Sleeping 10 seconds')
     time.sleep(SLEEP.SLEEP_10.value)
コード例 #5
0
 def setup(self):
     self.skipBTCheck = True
     super().setup()
     log.info(
         'Checking/Installing the Automation APK on both LW and Companion')
     self.libObj.checkAndInstallAPK(APK.AUTOMATION_APK.value, 'LW', True)
     compLibObj = LinuxWearablesLibrary(self.campDevice)
     compLibObj.checkAndInstallAPK(APK.AUTOMATION_APK.value, 'comp')
     self.compIotLibObj = IOTLibrary(self.campDevice)
     log.info(
         'Creating Screenshot folder in Companion and Wearable To Collect Logs'
     )
     self.campDevice.makeDirectoryOnDevice(FILE.SCREENSHOT.value)
     self.device.makeDirectoryOnDevice(FILE.SCREENSHOT.value)
コード例 #6
0
 def setup(self):
     super().setup()
     if not self.deviceConnectors:
         log.error(
             "Either spiderboard or device not connected at the start of the run. Can't proceed"
         )
         raise Exception('Device Not Connected')
     getDevObj = AssignDeviceObject(self.device)
     self.device, otherDevices = getDevObj.AssignDeviceObject(
         self.deviceIdDeviceMap, IOTSEGMENTS.LW.value['DevIdPattern'], 2)
     self.iotLibObj = IOTLibrary(self.device)
     if len(otherDevices) == 0:
         raise Exception('Only One Device Present and Companion Missing')
     self.campDevice = otherDevices[0]
     self.LWPort = self.device.deviceConnectorPort
     self.campPort = self.campDevice.deviceConnectorPort
     log.info('Creating Screenshot folder in Wearable To Collect Logs')
     self.device.makeDirectoryOnDevice(FILE.SCREENSHOT.value)
     self.libObj = LinuxWearablesLibrary(self.device)
     log.info('Checking If Device is Paired')
     if not self.skipBTCheck and not self.checkBTPaired():
         log.info('Device is Not Paired So Not Executing the Test')
         raise Exception('BT Not Paired')
     else:
         output = 'BTPair not required for this testcase' if self.skipBTCheck else 'Device is Paired Executing the Test'
         log.info(output)
コード例 #7
0
class DateAndTimeSync(LinuxWearablesBaseClass):
    def setup(self):
        super().setup()
        log.info('Turning On Bluetooth')
        self.libObj.toggleBluetooth(True)
        log.info('Sleeping 10 seconds')
        time.sleep(SLEEP.SLEEP_10.value)
        self.compLibObj = LinuxWearablesLibrary(self.campDevice)

    def execute(self):
        for itrCnt in range(self.iteration):
            itrCnt += 1
            self.dataSource.updateIteration(self.testId, itrCnt)
            self.compLibObj.setTime(datetime.datetime.now().strftime(
                WEARABLE_CONSTANTS.DATE_TIME_FORMAT.value))
            log.info("Time Before Resetting")
            self.compLibObj.getDateAndTime()
            self.libObj.getDateAndTime()
            log.info(
                'Resetting the Date And Time of Companion Device to Sun Jan  1 00:00:00 IST 2017'
            )
            self.compLibObj.setTime(WEARABLE_CONSTANTS.RESET_DATETIME.value)
            log.info("Time After Resetting")
            self.verifyResults(itrCnt)
        self.checkResult(self.passCtr, self.iteration)

    def verifyResults(self, itrCnt):
        lwTime = self.libObj.getDateAndTime()
        compTime = self.compLibObj.getDateAndTime()
        if lwTime == compTime:
            log.info(self.testName + ' Passed for iteration: ' + str(itrCnt))
            self.passCtr += 1
        else:
            self.comments += 'Failed for iteration ' + str(itrCnt)
            log.info(self.testName + 'Failed for iteration ' + str(itrCnt))

    def cleanUp(self):
        try:
            log.info('Resetting the time to Current time')
            self.compLibObj.setTime(datetime.datetime.now().strftime(
                WEARABLE_CONSTANTS.DATE_TIME_FORMAT.value))
            self.compLibObj.getDateAndTime()
            self.libObj.getDateAndTime()
        except Exception as e:
            logging.error("Unexpected error while cleaning up test:" +
                          e.__str__())
        finally:
            super().cleanUp()