Ejemplo n.º 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
 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)
class LinuxWearablesBaseClass(LETest):
    def __init__(self, testId=None, context=None, arguments=None):
        super().__init__(testId, context, arguments)
        self.testName = self.__class__.__name__
        self.skipBTCheck = False

    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)

    def checkBTPaired(self):
        '''
        Check if the device is paired
        :return: True : If Paired
                 False : If Not Paired
        '''
        try:
            config = JsonUtility.readJsonFile(PATH.JSON_FILE_PATH.value)
            if not config["BTPaired"]["StatusChecked"]:
                config["BTPaired"]["StatusChecked"] = True
                config["BTPaired"]["Status"] = self.iotLibObj.checkUiUp(
                    UI_ACTIVITY.HOMEACTIVITY.value, 50)
                JsonUtility.writeJsonFile(config, PATH.JSON_FILE_PATH.value)
            return config["BTPaired"]["Status"]
        except FileNotFoundError:
            return self.iotLibObj.checkUiUp(UI_ACTIVITY.HOMEACTIVITY.value, 50)

    def cleanUp(self):
        if self.passCtr != self.iteration:
            log.info("Collecting Bug Reports as test failed")
            self.device.removeResource(FILE.BUG_REPORT.value + '/*')
            self.device.getBugReport()
            self.device.pullResource(
                FILE.BUG_REPORT.value,
                os.path.join(self.logFolder,
                             'BugReport_' + self.device.getDeviceId()))
        super().cleanUp()
Ejemplo n.º 4
0
class AmbientCompanionTest(LinuxWearablesBaseClass):


    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


    def execute(self):
        for itrCnt in range(self.iteration):
            itrCnt += 1
            self.dataSource.updateIteration(self.testId, itrCnt)
            initialAmbientMode = self.libObj.isAmbientModeSet()
            log.info('Ambient Mode : ' + WEARABLE_CONSTANTS.STATUS.value[initialAmbientMode] + ' Turning it : ' + WEARABLE_CONSTANTS.STATUS.value[initialAmbientMode ^ True])
            initialAmbientMode ^= True
            if self.toggleAmbientMode(initialAmbientMode, itrCnt):
                initialAmbientMode ^= True
                if self.toggleAmbientMode(initialAmbientMode, itrCnt):
                    self.passCtr += 1
                    log.info('Ambient Mode : ' + WEARABLE_CONSTANTS.STATUS.value[initialAmbientMode ^ True] + "/" + WEARABLE_CONSTANTS.STATUS.value[initialAmbientMode] + ' Successful for Iteration ' + str(itrCnt))
        self.campDevice.executeAmCommand(AM_SUB_COMMANDS.FORCE_STOP.value, ' ' + SYSTEM_FILE.PACKAGE.value['WEAR_OS'])
        self.compIotLibObj.pullScreenshots(self.logFolder)
        self.checkResult(self.passCtr, self.iteration)


    def toggleAmbientMode(self, initialAmbientMode, itrCnt):
        options = "-w -r -e debug false " + '-e DeviceId ' + self.device.getDeviceId() + ' -e Mode ' + WEARABLE_CONSTANTS.STATUS.value[initialAmbientMode] + " -e class " + self.libObj.getInstrumentationCommand(self.testName)
        output = self.campDevice.executeAmCommand(AM_SUB_COMMANDS.INSTRUMENT.value, options)
        log.info(output)
        self.device.inputKeyEvent(ADB_KEYEVENT_KEYCODES.BACK.value)
        self.device.inputKeyEvent(ADB_KEYEVENT_KEYCODES.BACK.value)
        time.sleep(SLEEP.SLEEP_10.value)
        if self.libObj.isAmbientModeSet() == initialAmbientMode:
            log.info('Ambient Mode : ' + WEARABLE_CONSTANTS.STATUS.value[initialAmbientMode] + ' Successful, Turning It : ' + WEARABLE_CONSTANTS.STATUS.value[initialAmbientMode ^ True])
            return True
        else:
            self.comments += 'Ambient Mode : ' + WEARABLE_CONSTANTS.STATUS.value[initialAmbientMode] + ' Unsuccessful for Iteration ' + str(itrCnt)
            log.info('Ambient Mode : ' + WEARABLE_CONSTANTS.STATUS.value[initialAmbientMode] + ' Unsuccessful for Iteration ' + str(itrCnt))
            return False


    def cleanUp(self):
        if self.setUpSuccessful:
            self.libObj.toggleAmbientMode(True)
        super().cleanUp()
Ejemplo n.º 5
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
Ejemplo n.º 6
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)
Ejemplo n.º 7
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)
Ejemplo n.º 8
0
class ConnectAP(LinuxWearablesBaseClass):


    def __init__(self, testId=None, context=None, arguments=None):
        super().__init__(testId, context, arguments)
        self.apId = self.arguments.get('--ApId','APT-Sanity')
        self.password = self.arguments.get('--Password', 'donotask')


    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)


    def execute(self):
        for itrCnt in range(self.iteration):
            itrCnt += 1
            self.dataSource.updateIteration(self.testId, itrCnt)
            log.info('Selecting the AP on LW')
            options = "-w -r -e debug false -e APID " + self.apId + " -e class " + self.libObj.getInstrumentationCommand('ConnectWifi')
            self.campDevice.inputKeyEvent(ADB_KEYEVENT_KEYCODES.BACK.value)
            output = self.device.executeAmCommand(AM_SUB_COMMANDS.INSTRUMENT.value, options)
            log.info(output)
            if 'Successful' in output:
                log.info(self.testName + 'APId Does not require password, Passed for iteration: ' + str(itrCnt))
                self.passCtr += 1
                continue
            elif 'Fail' in output:
                self.comments += 'ApId not found for iteration ' + str(itrCnt)
                log.info('ApId not found ' + self.testName + ' Failed for iteration: ' + str(itrCnt))
                continue
            log.info('Waiting for Password to be entered from Companion')
            options = "-w -r -e debug false -e Password " + self.password + " -e class " + self.libObj.getInstrumentationCommand('CompWifi')
            output = self.campDevice.executeAmCommand(AM_SUB_COMMANDS.INSTRUMENT.value, options)
            log.info(output)
            if 'Successful' not in output:
                self.comments += 'Wrong Password, Failed for iteration ' + str(itrCnt)
                log.info(self.testName + 'Wrong Password, Failed for iteration ' + str(itrCnt))
                continue
            log.info('Password Entered Successful, Checking again in LW')
            options = "-w -r -e debug false -e APID " + self.apId + " -e class " + self.libObj.getInstrumentationCommand('CheckWifi')
            output = self.device.executeAmCommand(AM_SUB_COMMANDS.INSTRUMENT.value, options)
            log.info(output)
            if 'Successful' in output:
                log.info(self.testName + ' and check AP in saved Networks, Passed for iteration: ' + str(itrCnt))
                self.passCtr += 1
            elif 'Connected' in output:
                self.comments += 'Connected to AP but not found in saved networks, Failed for iteration ' + str(itrCnt)
                log.info(self.testName + 'Connected to AP but not found in saved networks, Failed for iteration ' + str(itrCnt))
            else:
                self.comments += 'Failed both Connect and Remember AP'
                log.info(self.testName + 'Failed for iteration ' + str(itrCnt))
        self.compIotLibObj.pullScreenshots(self.logFolder)
        self.iotLibObj.pullScreenshots(self.logFolder)
        self.checkResult(self.passCtr, self.iteration)
Ejemplo n.º 9
0
class ReconnectLW(LinuxWearablesBaseClass):
    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')
        log.info('Turning on Bluetooth')
        self.libObj.toggleBluetooth(True)
        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)
        log.info('Sleeping 10 seconds')
        time.sleep(SLEEP.SLEEP_10.value)

    def execute(self):
        for itrCnt in range(self.iteration):
            itrCnt += 1
            self.dataSource.updateIteration(self.testId, itrCnt)
            log.info('Checking If Connected Before Reboot')
            if not self.checkComp('Connected'):
                self.comments += "Not Connected before Reboot"
                log.info(self.testName + ' Failed for iteration ' +
                         str(itrCnt))
                continue
            log.info('Connected Before reboot')
            self.device.reboot()
            if not self.iotLibObj.checkUiUp(UI_ACTIVITY.HOMEACTIVITY.value,
                                            50):
                self.comments += 'UI not up after reboot ' + self.testName + ' Failed for iteration ' + str(
                    itrCnt)
                log.info('UI not up after reboot ' + self.testName +
                         ' Failed for iteration ' + str(itrCnt))
                continue
            log.info('Checking If Disconnected After Reboot')
            if self.checkComp(''):
                log.info('Disconnected after Reboot for Iteration ' +
                         str(itrCnt))
            log.info('Device Up, Waiting for Auto Reconnect')
            log.info('Sleeping 40 seconds')
            time.sleep(SLEEP.SLEEP_60.value)
            if self.checkComp('Connected'):
                log.info('Device Connected After Reboot ' + self.testName +
                         ' Passed for iteration ' + str(itrCnt))
                self.passCtr += 1
            else:
                self.comments += 'Device not Connected After Reboot ' + self.testName + 'Failed for iteration ' + str(
                    itrCnt)
                log.info('Device not Connected After Reboot ' + self.testName +
                         'Failed for iteration ' + str(itrCnt))
        self.campDevice.executeAmCommand(
            AM_SUB_COMMANDS.FORCE_STOP.value,
            ' ' + SYSTEM_FILE.PACKAGE.value['WEAR_OS'])
        self.compIotLibObj.pullScreenshots(self.logFolder)
        self.checkResult(self.passCtr, self.iteration)

    def checkComp(self, checkString=""):
        if checkString == "Connected":
            checkString = "-e Check " + checkString
        options = "-w -r -e debug false " + checkString + " -e class " + self.libObj.getInstrumentationCommand(
            'CompReconnect')
        output = self.campDevice.executeAmCommand(
            AM_SUB_COMMANDS.INSTRUMENT.value, options)
        log.info(output)
        if 'Successful' in output:
            return True
        return False
Ejemplo n.º 10
0
class AudioTest(LinuxWearablesBaseClass):
    def __init__(self, testId=None, context=None, arguments=None):
        super().__init__(testId, context, arguments)
        self.codec = self.arguments['--codec']
        self.testName = 'AudioPlayback_' + self.codec
        self.audioFile = 'Test_Audio.' + self.codec

    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

    def execute(self):
        for itrCnt in range(self.iteration):
            itrCnt += 1
            self.dataSource.updateIteration(self.testId, itrCnt)
            log.info('Now Playing The song ' + self.audioFile)
            options = "-w -r -e debug false -e Filename " + self.audioFile + " -e class " + self.libObj.getInstrumentationCommand(
                'AudioLWPlay')
            output = self.device.executeAmCommand(
                AM_SUB_COMMANDS.INSTRUMENT.value, options)
            log.info(output)
            if 'AudioPlayedSuccessfully' in output:
                self.passCtr += 1
                log.info(self.testName + ' Passed for iteration: ' +
                         str(itrCnt))
            else:
                self.comments += 'Failed for iteration ' + str(itrCnt)
                log.info(self.testName + 'Failed for iteration ' + str(itrCnt))
        self.iotLibObj.pullScreenshots(self.logFolder)
        self.compIotLibObj.pullScreenshots(self.logFolder)
        self.checkResult(self.passCtr, self.iteration)

    def installAudioAPK(self, libObj, audioAPK, device):
        log.info('Installing APK on ' + device.getDeviceId())
        installAPK = libObj.buildPath(PATH.WEARABLE_APK_PATH.value, audioAPK)
        device.installApp(installAPK)

    def cleanUp(self):
        if self.setUpSuccessful:
            self.campDevice.unInstallApp(
                SYSTEM_FILE.PACKAGE.value['MUSIC_PLAYER'])
            self.device.unInstallApp(SYSTEM_FILE.PACKAGE.value['MUSIC_PLAYER'])
            self.campDevice.removeResource(SYSTEM_FILE.COMP_MUSIC_FOLDER.value)
        super().cleanUp()
Ejemplo n.º 11
0
class BTPairing(LinuxWearablesBaseClass):
    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)

    def execute(self):
        for itrCnt in range(self.iteration):
            itrCnt += 1
            self.dataSource.updateIteration(self.testId, itrCnt)
            if self.iotLibObj.checkUiUp(UI_ACTIVITY.HOMEACTIVITY.value, 2):
                self.passCtr += 1
                log.info("Already BT Paired")
                continue
            self.campDevice.executeAmCommand(
                AM_SUB_COMMANDS.FORCE_STOP.value,
                ' ' + SYSTEM_FILE.PACKAGE.value['WEAR_OS'])
            output = self.pairScreenLW()
            if 'FactoryDataReset' in output:
                log.info('LW Pairing after FDR')
                if self.libObj.doFDR(self.iotLibObj):
                    log.info('FDR Successful')
                    log.info(
                        'Installing the Automation APK  both LW after FDR')
                    self.libObj.checkAndInstallAPK(APK.AUTOMATION_APK.value,
                                                   'LW', True)
                    output = self.pairScreenLW()
            if "Successfully" not in output:
                log.info("LW did not go to Pairing Screen : Test Failed")
                break
            match = re.search("BTID = (.*)", output)
            btID = ((match.group(1))[:-1]).replace(" ", "_")
            log.info("LW in pairing screen with BTID : " + btID)
            self.iotLibObj.pullScreenshots(self.logFolder)
            self.startTime = 0
            output = self.pairCompanion(btID)
            if "BTID Found" not in output:
                self.campDevice.reboot()
                output = self.pairCompanion(btID)
            if self.iotLibObj.checkUiUp(UI_ACTIVITY.HOMEACTIVITY.value, 50):
                pairTime = (time.time() - self.startTime) / 60
                if pairTime <= 10:
                    self.passCtr += 1
                    log.info(self.testName + ' Passed for iteration: ' +
                             str(itrCnt) + 'in ' + str(pairTime) + ' minutes')
                    if 'Without Account Sync' in output:
                        self.comments += 'BT Pairing done without account sync'
                else:
                    self.comments += "Pairing Done in " + str(
                        pairTime) + " minutes"
                    self.comments += 'Failed for Iteration ' + str(itrCnt)
                    log.info(self.testName + 'Failed for iteration ' +
                             str(itrCnt))
            else:
                self.comments += 'Failed for Iteration ' + str(itrCnt)
                log.info(self.testName + 'Failed for iteration ' + str(itrCnt))
        self.campDevice.executeAmCommand(
            AM_SUB_COMMANDS.FORCE_STOP.value,
            ' ' + SYSTEM_FILE.PACKAGE.value['WEAR_OS'])
        self.compIotLibObj.pullScreenshots(self.logFolder)
        self.checkResult(self.passCtr, self.iteration)

    def pairScreenLW(self):
        options = "-w -r -e debug false -e class " + self.libObj.getInstrumentationCommand(
            'BTPairingLW')
        log.info('Doing SetUp on LW for Pairing')
        output = self.device.executeAmCommand(AM_SUB_COMMANDS.INSTRUMENT.value,
                                              options)
        log.info(output)
        return output

    def pairCompanion(self, btid):
        changeTimeout = ExecutionProperties()
        log.info('Changing timeout of command to 15 minutes')
        changeTimeout.setTimeout(900)
        options = "-w -r -e debug false -e BTID " + btid + " -e class " + self.libObj.getInstrumentationCommand(
            self.testName)
        log.info('Now starting pairing in Companion')
        self.startTime = time.time()
        output = self.campDevice.executeAmCommand(
            AM_SUB_COMMANDS.INSTRUMENT.value, options, changeTimeout)
        log.info(output)
        return output