Exemplo n.º 1
0
 def __init__(self, device, mod):
     self.device = connect_device(device)
     self.logger = createlogger(mod)
     self.log_path = create_folder()
     self.camera = Camera(self.device, "task_camera")
     self.product = Configs("common").get("product", "Info")
     if self.product == "Sprints":
         from common.chrome import Chrome
         self.browser = Chrome(self.device, "task_browser")
     else:
         self.browser = Browser(self.device, "Browser")
     self.tel = Telephony(self.device, "task_tel")
     self.message = Message(self.device, "task_message")
     self.settings = Settings(self.device, "switch_nw")
     self.suc_times = 0
     self.mod_cfg = GetConfigs(mod)
     self.test_times = 0
     self.dicttesttimes = self.mod_cfg.get_test_times()
     for test_time in self.dicttesttimes:
         self.test_times += int(self.dicttesttimes[test_time])
     self.test_times = self.test_times * 2 + 4
     self.logger.info("Trace Total Times " + str(self.test_times))
Exemplo n.º 2
0
 def __init__(self,device,mod):
     self.device = connect_device(device)
     self.logger = createlogger(mod)
     self.log_path = create_folder()
     self.camera = Camera(self.device,"task_camera")
     self.product = Configs("common").get("product","Info") 
     if self.product == "Sprints":
         from common.chrome import Chrome
         self.browser = Chrome(self.device,"task_browser")
     else:
         self.browser = Browser(self.device,"Browser")
     self.tel = Telephony(self.device,"task_tel")
     self.message = Message(self.device,"task_message")
     self.settings = Settings(self.device,"switch_nw")
     self.suc_times = 0
     self.mod_cfg = GetConfigs(mod)
     self.test_times = 0
     self.dicttesttimes = self.mod_cfg.get_test_times()
     for test_time in self.dicttesttimes: self.test_times += int(self.dicttesttimes[test_time]) 
     self.test_times =  self.test_times*2 + 4
     self.logger.info("Trace Total Times " + str(self.test_times))  
Exemplo n.º 3
0
class MultiTask(Common):
    def __init__(self, device, mod):
        self.device = connect_device(device)
        self.logger = createlogger(mod)
        self.log_path = create_folder()
        self.camera = Camera(self.device, "task_camera")
        self.product = Configs("common").get("product", "Info")
        if self.product == "Sprints":
            from common.chrome import Chrome
            self.browser = Chrome(self.device, "task_browser")
        else:
            self.browser = Browser(self.device, "Browser")
        self.tel = Telephony(self.device, "task_tel")
        self.message = Message(self.device, "task_message")
        self.settings = Settings(self.device, "switch_nw")
        self.suc_times = 0
        self.mod_cfg = GetConfigs(mod)
        self.test_times = 0
        self.dicttesttimes = self.mod_cfg.get_test_times()
        for test_time in self.dicttesttimes:
            self.test_times += int(self.dicttesttimes[test_time])
        self.test_times = self.test_times * 2 + 4
        self.logger.info("Trace Total Times " + str(self.test_times))

    def remove(self):
        self.logger.debug("remove all opened activities")
        self.device.press.menu()
        if self.device(description="Clear all").wait.exists(timeout=2000):
            self.device(description="Clear all").click()
            self.device.delay(5)
            return True
        return False

    def start(self):
        self.logger.debug("Start Some activities")
        self.logger.debug("Launch Contacts")
        #self.tel.start_app("Contacts")
        self.tel.enter_contacts()
        self.device.delay(3)
        self.logger.debug("Launch Message")
        self.message.start_app("Messaging")
        self.device.delay(3)
        self.logger.debug("Launch Dialer")
        #self.tel.start_app("Call")
        self.tel.enter_dialer()
        self.device.delay(3)
        self.logger.debug("Launch Camera")
        self.camera.start_app("Camera")
        self.device.delay(3)
        self.logger.debug("Launch Browser")
        #self.browser.start_app("Browser")
        self.browser.enter()

    def make_call(self, number):
        if self.tel.enter_dialer():
            try:
                if self.tel.call_from_dialer(number):
                    self.suc_times += 1
                    self.logger.info("Trace Success Make Call")
                    return True
                else:
                    self.save_fail_img()
                    return False
            except Exception, e:
                self.save_fail_img()
                #                 common.common.log_traceback(traceback.format_exc())
                return False
Exemplo n.º 4
0
class MultiTask(Common):
    def __init__(self,device,mod):
        self.device = connect_device(device)
        self.logger = createlogger(mod)
        self.log_path = create_folder()
        self.camera = Camera(self.device,"task_camera")
        self.product = Configs("common").get("product","Info") 
        if self.product == "Sprints":
            from common.chrome import Chrome
            self.browser = Chrome(self.device,"task_browser")
        else:
            self.browser = Browser(self.device,"Browser")
        self.tel = Telephony(self.device,"task_tel")
        self.message = Message(self.device,"task_message")
        self.settings = Settings(self.device,"switch_nw")
        self.suc_times = 0
        self.mod_cfg = GetConfigs(mod)
        self.test_times = 0
        self.dicttesttimes = self.mod_cfg.get_test_times()
        for test_time in self.dicttesttimes: self.test_times += int(self.dicttesttimes[test_time]) 
        self.test_times =  self.test_times*2 + 4
        self.logger.info("Trace Total Times " + str(self.test_times))  
                  
    def remove(self):
        self.logger.debug("remove all opened activities")
        self.device.press.menu()
        if self.device(description= "Clear all").wait.exists(timeout = 2000):
            self.device(description= "Clear all").click()
            self.device.delay(5)
            return True
        return False
        
    def start(self):
        self.logger.debug("Start Some activities")
        self.logger.debug("Launch Contacts")
        #self.tel.start_app("Contacts")
        self.tel.enter_contacts()
        self.device.delay(3)
        self.logger.debug("Launch Message")
        self.message.start_app("Messaging")
        self.device.delay(3)
        self.logger.debug("Launch Dialer")         
        #self.tel.start_app("Call")
        self.tel.enter_dialer()
        self.device.delay(3)
        self.logger.debug("Launch Camera")           
        self.camera.start_app("Camera")
        self.device.delay(3)
        self.logger.debug("Launch Browser")        
        #self.browser.start_app("Browser")
        self.browser.enter()
    def make_call(self,number):
        if self.tel.enter_dialer():
            try:
                if self.tel.call_from_dialer(number):
                    self.suc_times += 1
                    self.logger.info("Trace Success Make Call")
                    return True
                else:
                    self.save_fail_img()
                    return False
            except Exception,e:
                self.save_fail_img()
#                 common.common.log_traceback(traceback.format_exc())
                return False