Example #1
0
    def write_email(self, to_address, subject, content):
        '''
        write an email ,only text

        @type to_address: string
        @param to_address: destination address.
        @type subject: string
        @param subject: email subject.
        @type content: string
        @param content: email content.
        '''
        ime = IME()

        #input to_address
        clear_edittext_by_id("to", 1, 0)
        ime.IME_input(1, to_address, input_type="b")

        #input subject
        click_textview_by_id("subject")
        ime.IME_input(1, subject)

        #input content
        ime.IME_input(1, content)
        #entertext_edittext_by_id("body_text",content)
        click_imageview_by_id("send")
Example #2
0
 def __init__(self):
     '''
     init function.
     '''
     self.mode_name = "mms"
     self.ime = IME()
     Base.__init__(self, self.mode_name)
     self.debug_print('Mms init:%f' % (time.time()))
 def __init__(self):
     '''
     init function.
     '''
     self.mode_name = "playstore"
     Base.__init__(self, self.mode_name)
     self.ime = IME()
     self.debug_print('PlayStore init:%f' % (time.time()))
Example #4
0
 def __init__(self):
     '''
     init method.
     '''
     self.mode_name = "settings"
     Base.__init__(self, self.mode_name)
     self.ime = IME()
     self.email = Email()
     self.debug_print('Settings init:%f' % (time.time()))
 def __init__(self):
     '''
     init function.
     '''
     self.mode_name = "cmcc_mtbf"
     self.ime = IME()
     self.launcher = Launcher()
     Base.__init__(self, self.mode_name)
     self.debug_print('cmcc_mtbf init:%f' % (time.time()))
Example #6
0
    def test_case_main(self, case_results):
        """
        main function ,entry add feature
        @return:  none
        """
        self.ime = IME()

        click_imageview_by_index(0)
        click_imageview_by_index(2)
        click_imageview_by_index(1)

        # 1 -delete all
        #self.del_contact_all()

        # 2 -add some contact
        for i in range(1, 3):
            click_imageview_by_id('menu_add_contact')

            self.IsfirstAddContact()

            if i % 2:
                self.add_contact_to_phone(i)
            else:
                self.add_contact_to_SIM_Card(i)

            #click btn done
            #click_imageview_by_index(0)
            click_imageview_by_id('icon')
            sleep(1)

            # add favorite
            #click_textview_by_id('menu_star')
            #for ux
            click_textview_by_id('star')
            sleep(1)

            # goback
            click_imageview_by_index(0)
            sleep(3)

            if not can_continue():
                break
    def test_case_main(self, case_results):
        """
        main function ,entry search and show contact record
        @return:  none
        """

        log_test_case(self.name, 'drag up and down')
        drag_by_param(95, 50, 95, 85, 1)
        drag_by_param(95, 85, 95, 50, 1)
        sleep(1)
        drag_by_param(95, 50, 95, 85, 1)
        drag_by_param(95, 85, 95, 50, 1)
        sleep(1)
        self.ime = IME()
        click_imageview_by_id('menu_search')
        #entertext_edittext_on_focused('Mi')
        #clear_edittext_by_index(0)
        '''
        PRIVATE_del = ['del']
        self.ime.IME_input(1, PRIVATE_del)
        self.ime.IME_input(1, PRIVATE_del)
        self.ime.IME_input(1, PRIVATE_del)
        '''

        self.ime.IME_input_english(1, 'tes')
        sleep(2)
        if search_text(SC.PRIVATE_CONTACT_NAME):
            log_test_case(self.name, 'search name ok...')
            click_textview_by_text(SC.PRIVATE_CONTACT_NAME)
            #click_in_list_by_index(1)
        else:
            log_test_case(self.name, 'search failed...')
            return

        self.call_from_contact()

        #send sms to mike
        click_textview_by_id('secondary_action_button')
        self.ime.IME_input_english(1, 'send')
        #click_imageview_by_desc("send")
        click_button_by_id('send_button_sms')
        sleep(3)
        goback()

        #click_textview_by_text('binz')
        # show a moment
        sleep(1)

        #send EMAIL
        if search_text('*****@*****.**'):
            click_textview_by_text('*****@*****.**')

            #
            if search_text('Complete action using'):
                click_textview_by_text('Email')
                click_button_by_id('button_always')
            entertext_edittext_on_focused('email title')

            click_imageview_by_id("send")

        else:
            goback()

        # go address map
        scroll_to_bottom()
        if search_text('ADDRESS'):
            click_textview_by_text('pudong,shanghai,china')
        else:
            goback()
Example #8
0
    def access_browser(self,
                       url_address,
                       check_value,
                       wait_time,
                       is_checked=True):
        '''
        check whether access url successfully

        @type url_address: string
        @param url_address: url address.
        @type check_value: string
        @param check_value: when need check whether access successfully, this is the check value.
        @type wait_time: number
        @param wait_time: when check access , the wait time.
        @type is_checked: boolean
        @param is_checked: whether check to access successfully.
        @return: True: access successful; False: no.
        '''
        search_result = False
        ime = IME()

        if is_checked == True:
            #clear the browser cache
            self.clear_cache()
        #click_imageview_by_id('tab_switcher')
        #addressing config web address
        #entertext_edittext_by_id('url', url_address)
        sleep(1)
        click_textview_by_id('url', clickType=LONG_CLICK)  #this can
        #send_key(KEY_DEL)
        #modified by c_yazli
        sleep(1)
        click_button_by_id('clear', isVerticalList=0, isScrollable=1)
        #entertext_edittext_by_index(0, url_address)
        entertext_edittext_on_focused(url_address)
        send_key(KEY_ENTER)
        '''click_textview_by_id("url")
        send_key(KEY_DEL)
        #input address url
        ime.IME_input(1,url_address)'''

        #make sure whether access successful
        if is_checked == True:
            scroll_down()
            wait_fun = lambda: search_view_by_id("favicon")
            wait_result = wait_for_fun(wait_fun, True, wait_time)

            if wait_result == True:

                start_time = int(time.time())
                while int(time.time()) - start_time < int(wait_time):
                    click_button_by_id("favicon")
                    if search_text(unicode(check_value),
                                   searchFlag=TEXT_CONTAINS):
                        search_result = True
                        break
                    elif search_text(self.get_value("webpage_not_available")):
                        search_result = False
                        break
                    else:
                        sleep(1)
                    goback()
            else:
                search_result = False
        else:
            if search_text(url_address):
                search_result = True
            else:
                search_result = False

        return search_result
Example #9
0
# init a instance of the mode
notificationBar = NotificationBar()
camera = Camera()
weibo = Weibo()
renren = Renren()
settings = Settings()
playstore = PlayStore()
launcher = Launcher()
phone = Phone()
browser = Browser()
email = Email()
doubanfm = Doubanfm()
mms = Mms()
gmail = Gmail()
ime = IME()
contact = Contact()
gallery = Gallery()
cmccMTBF = CmccMTBF()
sample = Sample()
incommon = InCommon()

if is_serial_enabled():
    shieldbox = ShieldBox()

LOG_TAG = 'qrd_share_case'


#create a instance
def createInstance(class_name, *args, **kwargs):
    (module_name, class_name) = class_name.rsplit('.', 1)
Example #10
0
 def __init__(self):
     self.mode_name = "weibo"
     Base.__init__(self, self.mode_name)
     self.ime = IME()
     self.debug_print('Base init:%f' % (time.time()))
Example #11
0
    def add_email_account(self, user_name, user_pwd):
        '''
        add an email account

        @type user_name: string
        @param user_name: email user name.
        @type user_pwd: string
        @param user_pwd: email user password.
        @return: True: login successful; False: no.
        '''
        #Add Email Account
        ime = IME()
        start_activity('com.android.settings', '.Settings')

        scroll_to_bottom()
        click_textview_by_text(self.get_value("add_account_label"), 1, 0)
        click_textview_by_text(self.get_value("app_email"), 1, 0)

        #input account
        click_textview_by_id("account_email", 1, 0)
        ime.IME_input(1, user_name)

        #input password
        ime.IME_input(1, user_pwd)
        #entertext_edittext_by_id("account_password",SC.PRIVATE_EMAIL_EMAIL_PASSWORD,1,0)

        sleep(1)
        click_button_by_id("next", 1, 0)
        click_button_by_id("pop", 1, 0)

        scroll_to_bottom()
        click_button_by_id("next", 1, 0)

        if not search_text(self.get_value("account_duplicate_dlg_title"), 1,
                           0):
            time = 0

            while (search_text(
                    self.get_value(
                        "account_setup_check_settings_check_incoming_msg"), 1,
                    0)
                   or search_text(self.get_value("could_not_open_connection"),
                                  1, 0)) and time < 3:
                sleep(2)
                if search_text(self.get_value("could_not_open_connection"), 1,
                               0):
                    goback()
                    time = time + 1
                    click_button_by_id("next", 1, 0)

            if time == 3:
                return False
            else:
                click_imageview_by_id("account_security_type", 1, 0)
                click_textview_by_text(self.get_value("ssl_tls"), 1, 0)
                scroll_to_bottom()
                click_button_by_id("next", 1, 0)

                time = 0
                while (search_text(
                        self.get_value(
                            "account_setup_check_settings_check_outgoing_msg"),
                        1, 0) or search_text(
                            self.get_value("could_not_open_connection"), 1,
                            0)) and time < 3:
                    sleep(3)
                    if search_text(self.get_value("could_not_open_connection"),
                                   1, 0):
                        goback()
                        time = time + 1
                        click_button_by_id("next", 1, 0)
                if time == 3:
                    return False

            fun = lambda: search_view_by_id("next")
            wait_for_fun(fun, True, 10)

            click_button_by_id("next", 1, 0)
            sleep(3)

            click_textview_by_id("account_name", 1, 0)
            clear_edittext_by_id("account_name", 1, 0)
            sleep(1)
            ime.IME_input_english(1, "autotest")
            #entertext_edittext_by_id("account_name",SC.PRIVATE_EMAIL_ACCOUNT_NAME,1,0)

            click_button_by_id("next", 1, 0)
            sleep(1)
            goback()
            goback()
            return True
        else:
            goback()
            goback()
            goback()
            goback()
            goback()
            return False