Exemplo n.º 1
0
 def por_input(self):
     top_y = self.M.select_user(
         'com.emoji.ikeyboard/com.android.inputmethod.latin.LatinIME')
     keyboard = Keyboard_Operation(self.d, top_y)
     # 切换输入法至葡萄牙语
     while True:
         location = keyboard.keyboard_reader(' ')
         orc = keyboard.orc_location(location['x'], location['y'],
                                     location['width'], location['height'])
         print(orc)
         if 'Po' in orc:
             break
         else:
             keyboard.swip_location(location['x'], location['y'],
                                    location['width'], location['height'])
     keyboard.send_input('portug')
     orc_select = keyboard.orc_location(0,
                                        top_y,
                                        keyboard.phone_width,
                                        40 * keyboard.density()['density'],
                                        set_lang='por')
     print(orc_select)
     if 'Português' in orc_select:
         orc_result = True
     else:
         orc_result = False
     self.BF.check_assertTrue(orc_result, '没有纠正')
Exemplo n.º 2
0
 def es_input(self):
     top_y = self.M.select_user(
         'com.qisiemoji.inputmethod/com.android.inputmethod.latin.LatinIME')
     keyboard = Keyboard_Operation(self.d, top_y)
     # 切换输入法至西班牙语
     while True:
         location = keyboard.keyboard_reader(' ')
         orc = keyboard.orc_location_text(location['x'], location['y'],
                                          location['width'],
                                          location['height'])
         print(orc)
         if 'Es' in orc:
             break
         else:
             keyboard.swip_location(location['x'], location['y'],
                                    location['width'], location['height'])
     keyboard.send_input('espa')
     orc_select = keyboard.orc_location_text(0,
                                             top_y,
                                             keyboard.phone_width,
                                             40 *
                                             keyboard.density()['density'],
                                             set_lang='epo')
     # print(orc_select)
     if 'Espaĥol' in orc_select:
         orc_result = True
     else:
         orc_result = False
     self.BF.check_assertTrue(orc_result, '没有纠正')
Exemplo n.º 3
0
 def number_password(self):
     top_y = self.BF.keyboard_get_ready(
         'com.emoji.ikeyboard/com.android.inputmethod.latin.LatinIME',
         'class', 'android.widget.ScrollView')
     keyboard = Keyboard_Operation(self.d, top_y)
     self.BF.reach_element_click(200, 'xpath', '//*[@index="24"]')
     keyboard.send_input('1234567890', keyboard_type='number_password')
     # location = keyboard.keyboard_reader('1', keyboard_type='number_password')
     # keyboard.get_keyboard_picture(location['x'], location['y'], location['width'], location['height'], '1')
     # location = keyboard.keyboard_reader('2', keyboard_type='number_password')
     # keyboard.get_keyboard_picture(location['x'], location['y'], location['width'], location['height'], '2')
     # location = keyboard.keyboard_reader('3', keyboard_type='number_password')
     # keyboard.get_keyboard_picture(location['x'], location['y'], location['width'], location['height'], '3')
     self.BF.result_picture('number_passworf')
Exemplo n.º 4
0
 def normal_symbol(self):
     top_y = self.BF.keyboard_get_ready(
         'com.emoji.ikeyboard/com.android.inputmethod.latin.LatinIME',
         'class', 'android.widget.ScrollView')
     keyboard = Keyboard_Operation(self.d, top_y)
     self.BF.click('name', '02-search')
     # self.BF.click('name', '01-textAutoComplete')
     time.sleep(2)
     keyboard.send_input('number')
     keyboard.send_input('symbol', keyboard_type='normal_number')
     keyboard.send_input('•√Π÷׶∆£¢€¥^°©®™℅', keyboard_type='normal_symbol')
     keyboard.send_input('number', keyboard_type='normal_symbol')
     # keyboard.send_input('qwertyuiopasdfghjklzxcvbnm')
     self.BF.result_picture('normal_symbol')
Exemplo n.º 5
0
 def sticker2(self):
     top_y = self.W.select_user('com.emoji.ikeyboard/com.android.inputmethod.latin.LatinIME')
     keyboard = Keyboard_Operation(self.d, top_y)
     keyboard.send_input('test', 'normal')
     keyboard.send_input(' ', 'normal')
     keyboard.send_input(' ', 'normal')
     send = self.BF.attribute_name('id', 'com.whatsapp:id/entry', 'Test. ')
     self.BF.check_assertTrue(send, '输入内容错误')
     # keyboard.get_keyboard_picture(location['x'], location['y'], location['width'], location['height'], 'test')
     keyboard.send_input('stop', 'normal')
     keyboard.sticker2_click('sitcker2', 3, 2)
     # self.BF.checkpoint('sticker2', 'id', 'com.whatsapp:id/color_picker_container', 'sticker2')
     sticker2 = self.BF.existence('id', 'com.whatsapp:id/color_picker_container')
     self.BF.check_assertTrue(sticker2, 'sticker2选择失败')
     self.BF.click('id', 'com.whatsapp:id/send')
     time.sleep(5)
     self.BF.result_picture('sticker2')
Exemplo n.º 6
0
 def emoji(self):
     top_y = self.BF.keyboard_get_ready(
         'com.emoji.ikeyboard/com.android.inputmethod.latin.LatinIME',
         'class', 'android.widget.ScrollView')
     keyboard = Keyboard_Operation(self.d, top_y)
     self.BF.click('name', '02-search')
     search = self.BF.element_picture(
         'id', 'yuside.cn.numbersonly:id/search_btn', 'search')
     keyboard.send_input('emoji')
     time.sleep(2)
     keyboard.send_input('emoji', keyboard_type='emoji')
     keyboard.select_emoji_class('emoji', 3)
     keyboard.select_emoji('emoji', 3, 5)
     emoji = self.BF.cintrast_element_picture(
         'id', 'yuside.cn.numbersonly:id/search_btn', search)
     self.BF.check_assertFalse(emoji, 'emoji未上屏')
     self.BF.result_picture('emoji')
Exemplo n.º 7
0
 def test(self):
     top_y = self.BF.keyboard_get_ready('com.emoji.ikeyboard/com.android.inputmethod.latin.LatinIME', 'class',
                                        'android.widget.ScrollView')
     keyboard = Keyboard_Operation(self.d, top_y)
     keyboard.send_input('system')
     location = keyboard.main_menu_select('settings')
     # location = keyboard.main_menu_select('theme')
     keyboard.get_keyboard_picture(location['x'], location['y'], location['width'], location['height'], 'theme')
Exemplo n.º 8
0
 def theme_change(self):
     self.kika.change_theme(5)
     self.d.start_activity('yuside.cn.numbersonly', 'yuside.cn.numbersonly.MainActivity')
     # 键盘输入检查
     top_y = self.BF.keyboard_get_ready('com.qisiemoji.inputmethod/com.android.inputmethod.latin.LatinIME', 'class',
                                        'android.widget.ScrollView')
     keyboard = Keyboard_Operation(self.d, top_y)
     keyboard.send_input('qwertyuiopasdfghjklzxcvbnm')
     keyboard.send_input('shift')
     keyboard.send_input('g')
     s_input = self.BF.attribute_name('classes', 'android.widget.EditText[0]', 'qwertyuiopasdfghjklzxcvbnmG')
     self.BF.check_assertTrue(s_input, '键盘输入内容错误')
Exemplo n.º 9
0
 def nubmer_decimal(self):
     top_y = self.BF.keyboard_get_ready(
         'com.emoji.ikeyboard/com.android.inputmethod.latin.LatinIME',
         'class', 'android.widget.ScrollView')
     keyboard = Keyboard_Operation(self.d, top_y)
     self.BF.reach_element_click(200, 'name', '24-numberDecimal')
     keyboard.send_input('1234567890', keyboard_type='number_decimal')
     input = self.BF.attribute_name('xpath', '//*[@index="23"]',
                                    '1234567890')
     self.BF.check_assertTrue(input, '输入内容正确显示正确')
     # location = keyboard.keyboard_reader('1', keyboard_type='number_decimal')
     # keyboard.get_keyboard_picture(location['x'], location['y'], location['width'], location['height'], '1')
     # location = keyboard.keyboard_reader('2', keyboard_type='number_decimal')
     # keyboard.get_keyboard_picture(location['x'], location['y'], location['width'], location['height'], '2')
     # location = keyboard.keyboard_reader('3', keyboard_type='number_decimal')
     # keyboard.get_keyboard_picture(location['x'], location['y'], location['width'], location['height'], '3')
     # location = keyboard.keyboard_reader('-', keyboard_type='number_decimal')
     # keyboard.get_keyboard_picture(location['x'], location['y'], location['width'], location['height'], '-')
     # location = keyboard.keyboard_reader(' ', keyboard_type='number_decimal')
     # keyboard.get_keyboard_picture(location['x'], location['y'], location['width'], location['height'], 'space')
     self.BF.result_picture('nubmer_decimal')
Exemplo n.º 10
0
 def keyboard_layout(self):
     default_top_y = self.BF.keyboard_get_ready(
         'com.emoji.ikeyboard/com.android.inputmethod.latin.LatinIME',
         'class', 'android.widget.ScrollView')
     # 开启数字和select
     self.Ik.app_settings()
     self.BF.click('name', 'Keyboard Settings')
     self.BF.click_change(
         'xpath',
         '//*[@text="Number Row"]/../../android.widget.LinearLayout')
     self.BF.click_change(
         'xpath',
         '//*[@text="Selector Row"]/../../android.widget.LinearLayout')
     # 打开input
     self.d.start_activity('yuside.cn.numbersonly',
                           'yuside.cn.numbersonly.MainActivity')
     top_y = self.BF.keyboard_get_ready(
         'com.emoji.ikeyboard/com.android.inputmethod.latin.LatinIME',
         'class', 'android.widget.ScrollView')
     keyboard = Keyboard_Operation(self.d, top_y)
     keyboard.send_input('1234567890', number=True, select=True)
     number = self.BF.attribute_name(
         'xpath', '//android.widget.EditText[@index="0"]', '1234567890')
     self.BF.check_assertTrue(number, '输入错误,数字键有问题')
     self.BF.check_find_element(
         'xpath', '//android.widget.EditText[@index="0"]').clear()
     self.BF.click('xpath', '//android.widget.EditText[@index="0"]')
     keyboard.send_input('asdfghj',
                         inputtype='long_pass',
                         number=True,
                         select=True)
     symbol = self.BF.attribute_name(
         'xpath', '//android.widget.EditText[@index="0"]', '@#$%&-+')
     self.BF.check_assertTrue(symbol, '输入错误,pop_key有问题')
     # 关闭Number和Select
     self.Ik.app_settings()
     self.BF.click('name', 'Keyboard Settings')
     self.BF.click_change(
         'xpath',
         '//*[@text="Number Row"]/../../android.widget.LinearLayout')
     self.BF.click_change(
         'xpath',
         '//*[@text="Selector Row"]/../../android.widget.LinearLayout')
     # 检查键盘是否高度变化
     self.d.start_activity('yuside.cn.numbersonly',
                           'yuside.cn.numbersonly.MainActivity')
     new_top_y = self.BF.keyboard_get_ready(
         'com.emoji.ikeyboard/com.android.inputmethod.latin.LatinIME',
         'class', 'android.widget.ScrollView')
     if default_top_y == new_top_y:
         cancel_result = True
     else:
         cancel_result = False
     self.BF.check_assertTrue(cancel_result, '取消Number和Select后键盘高度变化了')
Exemplo n.º 11
0
 def input_io(self):
     top_y = self.BF.keyboard_get_ready(
         'com.qisiemoji.inputmethod/com.android.inputmethod.latin.LatinIME',
         'class', 'android.widget.ScrollView')
     keyboard = Keyboard_Operation(self.d, top_y)
     # default = keyboard.get_keyboard_picture(0, top_y, keyboard.phone_width, 40 * keyboard.density()['density'],
     #                                         'indian_default')
     self.BF.click('xpath', '//android.widget.EditText[@index="1"]')
     wrong = []
     with open('./hinglish_hindi_pair', 'r') as word_list:
         for line in word_list:
             i = line.split('\t')[0].lower()
             o = line.split('\t')[1].split('\n')[0]
             # i = 'kya'
             # o = 'क्या'
             print(i, o)
             keyboard.send_input(i, number=True)
             # keyboard.send_input(' ', number=True)
             self.d.tap([(keyboard.phone_width / 4,
                          top_y + 20 * keyboard.density()['density'])])
             # same = keyboard.orc_location_text(0, top_y, keyboard.phone_width, 40 * keyboard.density()['density'],
             #                                   set_lang='eng')
             same = self.BF.attribute_name(
                 'xpath', '//android.widget.EditText[@index="1"]')
             print(same)
             if o in same:
                 same = True
             else:
                 same = False
             # print(same)
             # key = self.BF.attribute_name('xpath', '//android.widget.EditText[@index="1"]')
             # if i in key:
             #     key = True
             # else:
             #     key = False
             # print(key)
             # self.BF.check_find_element('xpath', '//android.widget.EditText[@index="1"]').clear()
             count = 0
             while True:
                 keyboard.send_input('delete')
                 count += 1
                 if count > 8:
                     break
             if same is True:
                 pass
             else:
                 wrong.append(line.split('\n')[0])
             print(wrong)
     print(wrong)
Exemplo n.º 12
0
 def eninput(self):
     top_y = self.BF.keyboard_get_ready(
         'com.emoji.ikeyboard/com.android.inputmethod.latin.LatinIME',
         'class', 'android.widget.ScrollView')
     keyboard = Keyboard_Operation(self.d, top_y)
     # 用例内容
     self.BF.click('xpath', '//*[@index="3"]')
     # self.BF.click('name', '01-textAutoComplete')
     time.sleep(2)
     keyboard.send_input('cppy')
     keyboard.send_input(' ')
     text = self.BF.attribute_name('xpath', '//*[@index="3"]', 'copy ')
     self.BF.check_assertTrue(text, 'fail')
Exemplo n.º 13
0
 def input(self):
     top_y = self.BF.keyboard_get_ready(
         'com.qisiemoji.inputmethod/com.android.inputmethod.latin.LatinIME',
         'class', 'android.widget.ScrollView')
     keyboard = Keyboard_Operation(self.d, top_y)
     default = keyboard.get_keyboard_picture(
         0, top_y, keyboard.phone_width, 40 * keyboard.density()['density'],
         'indian_default')
     self.BF.click('xpath', '//android.widget.EditText[@index="1"]')
     wrong = []
     with open('./vocab_hinglish', 'r') as word_list:
         for line in word_list:
             print(line)
             print(line.split('\n')[0])
             keyboard.send_input(line.split('\n')[0].lower(), number=True)
             keyboard.send_input(' ', number=True)
             same = keyboard.keyboard_same(0,
                                           top_y,
                                           keyboard.phone_width,
                                           40 *
                                           keyboard.density()['density'],
                                           default,
                                           diff=2)
             print(same)
             key = self.BF.attribute_name(
                 'xpath', '//android.widget.EditText[@index="1"]')
             if line.split('\n')[0] in key:
                 key = True
             else:
                 key = False
             print(key)
             # self.BF.check_find_element('xpath', '//android.widget.EditText[@index="1"]').clear()
             count = 0
             while True:
                 keyboard.send_input('delete')
                 count += 1
                 if count > 8:
                     break
             if key is True and same is False:
                 pass
             else:
                 wrong.append(line.split('\n')[0])
             print(wrong)
     print(wrong)
Exemplo n.º 14
0
 def en_input(self):
     top_y = self.M.select_user(
         'com.emoji.ikeyboard/com.android.inputmethod.latin.LatinIME')
     keyboard = Keyboard_Operation(self.d, top_y)
     keyboard.send_input('copy')
     keyboard.send_input(' ')
     copy = self.BF.attribute_name('id',
                                   'com.facebook.orca:id/text_input_bar',
                                   'Copy ')
     self.BF.check_assertTrue(copy, '上屏内容错误')
     self.BF.check_find_element(
         'id', 'com.facebook.orca:id/text_input_bar').clear()
     keyboard.sliding_input('about')
     # 这个滑动输入的检查点需要重新明确
     # about = self.BF.attribute_name('id', 'com.facebook.orca:id/text_input_bar', 'About')
     # self.BF.check_assertTrue(about, '上屏内容错误')
     self.BF.check_find_element(
         'id', 'com.facebook.orca:id/text_input_bar').clear()
     keyboard.send_input('emoji')
     Messenger_emoji = self.BF.element_picture(
         'id', 'com.facebook.orca:id/text_input_bar', 'Messenger_emoji')
     keyboard.send_input('emoji', 'emoji')
     keyboard.select_emoji('emoji', 1, 3)
     sendout = self.BF.attribute_name(
         'id', 'com.facebook.orca:id/text_input_bar', '😂')
     self.BF.check_assertTrue(sendout, '表情选择错误')
     emoji = self.BF.cintrast_element_picture(
         'id', 'com.facebook.orca:id/text_input_bar', Messenger_emoji)
     self.BF.check_assertFalse(emoji, '选择的emoji未上屏')
     # 检查点表格'Messenger_emoji'
     self.BF.checkpoint('Messenger_emoji', 'id',
                        'com.facebook.orca:id/text_input_bar',
                        'Messenger_emoji')
     self.BF.check_find_element(
         'id', 'com.facebook.orca:id/text_input_bar').clear()
     keyboard.send_input('emoji')
     keyboard.send_input('sticker', 'emoji')
     keyboard.select_emoji('sticker', 1, 2)
     time.sleep(5)
     # self.BF.click('name', '确定')
     self.BF.checkpoint('Messenger_sticker', 'id',
                        'com.facebook.orca:id/message_container',
                        'Messenger_sticker')
     keyboard.send_input('gif', 'emoji')
     time.sleep(10)
     keyboard.select_emoji('gif', 1, 2)
     time.sleep(5)
     # self.BF.click('name', '确定')
     self.BF.checkpoint('Messenger_gif', 'id',
                        'com.facebook.orca:id/message_container',
                        'Messenger_gif')
     keyboard.send_input('emoticon', 'emoji')
     keyboard.select_emoji('gif', 1, 2)
     emoticon = self.BF.attribute_name(
         'id', 'com.facebook.orca:id/text_input_bar', '(^~^)')
     self.BF.check_assertTrue(emoticon, 'emoticon选择错误')
     self.BF.checkpoint('Messenger_emoticon', 'id',
                        'com.facebook.orca:id/text_input_bar',
                        'Messenger_emoticon')
Exemplo n.º 15
0
    def test_add_language(self):
        print('Test add language, swipe and screenshot keyboard: ')
        new = '/Users/yanqing.xu/Downloads/app-kika-215101-release-ef36305.apk'
        old = '/Users/yanqing.xu/Downloads/app-kika-214801-release-60bf8dd.apk'
        package = 'com.qisiemoji.inputmethod'
        Typewriting = package + '/com.android.inputmethod.latin.LatinIME'
        activity = package + '/com.qisi.ikeyboarduirestruct.NavigationActivity'
        # 添加和截取键盘个数
        num = 50
        # 滑动添加时滑动次数
        rd = 20
        for i in range(0, 11):
            if self.kika.device_config == 'none':
                try:
                    unin_result = os.popen('adb uninstall %s' % package)
                except Exception as e:
                    print(e)
                    print('没有对应应用')
            else:
                try:
                    unin_result = os.popen('adb -s %s uninstall %s' %
                                           (self.device_config, package))
                except Exception as e:
                    print(e)
                    print('没有对应应用')
        os.system('adb install -r %s' % old)

        # 安装测试包并设置默认输入法
        #   del_package = 'com.qisiemoji.inputmethod'
        self.BF.keyboard_select(Typewriting)
        time.sleep(2)
        self.BF.open_app_atcivity(activity)
        time.sleep(3)
        self.BF.click('name', 'Settings')
        time.sleep(1)
        self.BF.click('name', 'Language')
        #   获取手机分辨率,计算右下角add大概坐标
        # adb shell dumpsys window displays |head -n 3计算x y
        dis = os.popen('adb shell dumpsys window displays |head -3').read()
        x = re.findall(r'init\=(.*?)x', dis)[0]
        y = re.findall(r'x(.*?)\s', dis)[0]
        swipex = int(x) * 1 / 2
        swipey1 = int(y) * 3 / 4
        swipey2 = int(y) * 1 / 4
        addx = int(x) - 30
        addy = int(y) - 100
        swipe = 'adb shell input swipe '
        add = 'adb shell input tap '
        # 向上滑
        for i in range(rd):
            print("swipe time:", i)
            ret = os.popen(swipe + str(int(swipex)) + ' ' + str(int(swipey1)) +
                           ' ' + str(int(swipex)) + ' ' + str(int(swipey2)))
            ret.close()

        # 点击add添加所有language
        for j in range(num):
            print('Add language time:', j)
            try:
                self.BF.check_find_element('name', 'Yes')
                time.sleep(0.5)
                self.BF.click('name', 'Yes')
            except:
                pass
            os.system(add + str(addx) + ' ' + str(addy))

        os.system('adb shell am start -n yuside.cn.numbersonly/.MainActivity')
        time.sleep(1)

        top_y = self.BF.keyboard_get_ready(Typewriting, 'class',
                                           'android.widget.ScrollView')
        keyboard = Keyboard_Operation(self.d, top_y)
        width = keyboard.phone_width
        # 获取空格键位置
        sp = keyboard.keyboard_reader(' ')
        height = (keyboard.phone_height - top_y)
        time.sleep(1)

        picinfo = dict()
        for k in range(num):
            keyboard.swip_location(sp['x'], sp['y'], sp['width'], sp['height'])
            time.sleep(1)
            picinfo[k] = keyboard.get_keyboard_picture(0, top_y, width, height,
                                                       'lang')
        # ******************分割线*********
        # 等待几秒,安装新版包,做截图对比
        time.sleep(2)
        os.system('adb uninstall %s' % package)
        os.system('adb install -r %s' % new)
        self.BF.keyboard_select(Typewriting)
        self.BF.open_app_atcivity(activity)
        time.sleep(3)
        self.BF.click('name', 'Settings')
        time.sleep(1)
        self.BF.click('name', 'Language')

        for i in range(rd):
            print("swipe time:", i)
            ret = os.popen(swipe + str(int(swipex)) + ' ' + str(int(swipey1)) +
                           ' ' + str(int(swipex)) + ' ' + str(int(swipey2)))
            ret.close()

        # 点击add添加所有language
        for j in range(num):
            print('Add language time:', j)
            try:
                self.BF.check_find_element('name', 'Yes')
                time.sleep(0.5)
                self.BF.click('name', 'Yes')
            except:
                pass
            os.system(add + str(addx) + ' ' + str(addy))
        os.system('adb shell am start -n yuside.cn.numbersonly/.MainActivity')
        self.BF.keyboard_get_ready(Typewriting, 'class',
                                   'android.widget.ScrollView')
        for k in range(num):
            keyboard.swip_location(sp['x'], sp['y'], sp['width'], sp['height'])
            time.sleep(1)
            keyboard.keyboard_same(0, top_y, width, height, picinfo[k])
        time.sleep(1)
Exemplo n.º 16
0
    def old_new_app_theme(self, i, package, typewriting, old, new):
        if self.device == 'none':
            try:
                unin_result = os.popen('adb uninstall %s' % package)
            except Exception as e:
                print(e)
                print('没有对应应用')
        else:
            try:
                unin_result = os.popen('adb -s %s uninstall %s' %
                                       (self.device, package))
            except Exception as e:
                print(e)
                print('没有对应应用')
        # 安装老应用
        # self.driver.install_app(old)
        o = os.popen('adb install -r %s' % old)
        print(o.read())
        self.BF.keyboard_select(typewriting)
        self.change_theme(i)
        self.BF.open_app_atcivity(
            'com.emoji.ikeyboard/com.qisi.ikeyboarduirestruct.NavigationActivity',
            self.device)
        top_y = self.BF.keyboard_get_ready(typewriting, 'class',
                                           'android.widget.ScrollView')
        keyboard = Keyboard_Operation(self.driver, top_y)
        old_keyboard = keyboard.get_keyboard_picture(
            0, top_y + 40 * keyboard.density()['density'],
            keyboard.phone_width, (keyboard.density()['app'] - top_y -
                                   40 * keyboard.density()['density']) * 3 / 4,
            'keyboard_old')
        self.driver.back()
        self.driver.back()
        # 强制安装
        self.BF.adb_install(new, self.device)
        # 对比
        # 以防键盘不弹起来
        self.BF.keyboard_select(typewriting)
        self.BF.open_app_atcivity(
            'com.emoji.ikeyboard/com.qisi.ikeyboarduirestruct.NavigationActivity',
            self.device)
        time.sleep(5)
        top_y = self.BF.keyboard_get_ready(typewriting, 'class',
                                           'android.widget.ScrollView')

        keyboard = Keyboard_Operation(self.driver, top_y)
        k = keyboard.keyboard_same(
            0, top_y + 40 * keyboard.density()['density'],
            keyboard.phone_width, (keyboard.density()['app'] - top_y -
                                   40 * keyboard.density()['density']) * 3 / 4,
            old_keyboard)
        # self.BF.check_assertTrue(k, '第%s个默认主题出现问题' % (no + 1))
        return {'%s' % (i + 1): k}
Exemplo n.º 17
0
    def old_new_app_custom_keyboard(self, package, typewriting, old, new):
        if self.device == 'none':
            try:
                unin_result = os.popen('adb uninstall %s' % package)
            except Exception as e:
                print(e)
                print('没有对应应用')
        else:
            try:
                unin_result = os.popen('adb -s %s uninstall %s' %
                                       (self.device, package))
            except Exception as e:
                print(e)
                print('没有对应应用')
        # 安装老应用
        o = os.popen('adb install -r %s' % old)
        print(o.read())
        self.BF.keyboard_select(typewriting)
        self.custom_keyboard()
        self.driver.tap([(200, 200)])
        self.driver.back()
        self.BF.open_app_atcivity(
            'com.emoji.ikeyboard/com.qisi.ikeyboarduirestruct.NavigationActivity',
            self.device)
        # 截图
        top_y = self.BF.keyboard_get_ready(typewriting, 'class',
                                           'android.widget.ScrollView')
        keyboard = Keyboard_Operation(self.driver, top_y)
        old_keyboard = keyboard.get_keyboard_picture(
            0, top_y + 40 * keyboard.density()['density'],
            keyboard.phone_width, (keyboard.density()['app'] - top_y -
                                   40 * keyboard.density()['density']) * 3 / 4,
            'keyboard_old')
        self.driver.back()
        self.driver.back()
        # 强制安装
        self.BF.adb_install(new, self.device)
        # 对比
        self.BF.keyboard_select(typewriting)
        self.BF.open_app_atcivity(
            'com.emoji.ikeyboard/com.qisi.ikeyboarduirestruct.NavigationActivity',
            self.device)
        time.sleep(5)
        top_y = self.BF.keyboard_get_ready(typewriting, 'class',
                                           'android.widget.ScrollView')

        keyboard = Keyboard_Operation(self.driver, top_y)
        k = keyboard.keyboard_same(
            0, top_y + 40 * keyboard.density()['density'],
            keyboard.phone_width, (keyboard.density()['app'] - top_y -
                                   40 * keyboard.density()['density']) * 3 / 4,
            old_keyboard)
        self.BF.check_assertTrue(k, '自定义主题消失了')
Exemplo n.º 18
0
 def layout(self):
     top_y = self.W.select_user('com.emoji.ikeyboard/com.android.inputmethod.latin.LatinIME')
     keyboard = Keyboard_Operation(self.d, top_y)
Exemplo n.º 19
0
 def chang_theme(self):
     top_y = self.BF.keyboard_get_ready(
         'com.emoji.ikeyboard/com.android.inputmethod.latin.LatinIME',
         'class', 'android.widget.ScrollView')
     keyboard = Keyboard_Operation(self.d, top_y)
     height = (keyboard.phone_height - top_y)
     width = keyboard.phone_width
     load = keyboard.get_keyboard_picture(
         0, top_y, width, height - 40 * int(keyboard.density()['density']),
         'keyboard')
     keyboard.send_input('system')
     keyboard.main_menu_click('theme')
     keyboard.select_theme(1, 2)
     # 判断是否回到了键盘主页
     text = keyboard.word_in_pic(
         0, top_y + int(keyboard.density()['density']) * 40,
         keyboard.phone_width,
         (int(keyboard.density()['app']) - top_y -
          int(keyboard.density()['density']) * 40) / 4, 'q')
     self.BF.check_assertTrue(text, '返回qwerty键盘失败,可能没有选择主题')
     time.sleep(5)
     same = keyboard.keyboard_same(
         0, top_y, width, height - 40 * int(keyboard.density()['density']),
         load)
     self.BF.check_assertFalse(same, '主题风格更换失败')
     self.BF.result_picture('emoji_style')
Exemplo n.º 20
0
 def emoji_style(self):
     top_y = self.BF.keyboard_get_ready(
         'com.emoji.ikeyboard/com.android.inputmethod.latin.LatinIME',
         'class', 'android.widget.ScrollView')
     keyboard = Keyboard_Operation(self.d, top_y)
     keyboard.send_input('emoji')
     keyboard.send_input('emoji', keyboard_type='emoji')
     height = (keyboard.phone_height - top_y)
     width = keyboard.phone_width
     load = keyboard.get_keyboard_picture(
         0, top_y, width, height - 40 * int(keyboard.density()['density']),
         'emojy')
     keyboard.send_input('normal_key', keyboard_type='emoji')
     keyboard.send_input('system')
     keyboard.main_menu_click('style')
     keyboard.select_theme(1, 2)
     time.sleep(5)
     keyboard.send_input('emoji')
     same = keyboard.keyboard_same(
         0, top_y, width, height - 40 * int(keyboard.density()['density']),
         load)
     self.BF.check_assertFalse(same, '表情风格更换失败')
     self.BF.result_picture('emoji_style')
 def precast_condition(self, del_package, install_package_path, Typewriting):
     # 删除应用
     if self.device_config == 'none':
         try:
             unin_result = os.popen('adb uninstall %s' % del_package)
         except Exception as e:
             print(e)
             print('没有对应应用')
     else:
         try:
             unin_result = os.popen('adb -s %s uninstall %s' % (self.device_config, del_package))
         except Exception as e:
             print(e)
             print('没有对应应用')
     # 安装应用
     self.BF.adb_install(install_package_path, self.device_config)
     self.BF.keyboard_select(Typewriting, self.device_config)
     self.BF.open_app_atcivity('com.qisiemoji.inputmethod/com.qisi.ikeyboarduirestruct.NavigationActivity')
     theme = self.BF.existence('name', 'Settings')
     if theme == False:
         count = 0
         while True:
             try:
                 self.BF.click('name', 'Allow')
                 count += 1
             except:
                 time.sleep(3)
             if count == 3:
                 break
             if count == 6:
                 break
     self.BF.keyboard_select('com.qisiemoji.inputmethod/com.android.inputmethod.latin.LatinIME')
     # 点击设定
     self.BF.click('id', 'com.qisiemoji.inputmethod:id/item_settigns')
     # 点击语言
     self.BF.click('name', 'Language')
     # time.sleep(10)
     # 选择语言的时候最好根据自上而下的顺序这样就很快的都能加上
     # self.reach_language_add('Español (US)')
     # self.reach_language_add('Português (Brasil)')
     # self.driver.back()
     # self.BF.click('name', 'Language')
     # if self.BF.existence('name', 'Español (US)') and self.BF.existence('name',
     #                                                                    'English (US)') and self.BF.existence('name',
     #                                                                                                          'Português (Brasil)'):
     #     pass
     # else:
     #     assert 1 + 1 > 2, '语言添加失败'
     self.driver.start_activity('yuside.cn.numbersonly', 'yuside.cn.numbersonly.MainActivity')
     # 获取的高度不是默认的高度
     top_y = self.BF.keyboard_get_ready(Typewriting, 'class', 'android.widget.ScrollView')
     keyboard = Keyboard_Operation(self.driver, top_y)
     self.driver.back()
     self.BF.click('xpath', '//android.widget.EditText[@index="0"]')
     # 重新获取键盘高度
     top_y = self.BF.keyboard_get_ready(Typewriting, 'class', 'android.widget.ScrollView')
     keyboard = Keyboard_Operation(self.driver, top_y)
     keyboard.send_input('emoji')
     self.driver.back()
     self.BF.click('xpath', '//android.widget.EditText[@index="0"]')
     keyboard.send_input('emoji')
     keyboard.send_input('emoji', 'emoji')
     keyboard.select_emoji('emoji', 1, 3)
     emoji = self.BF.attribute_name('xpath', '//android.widget.EditText[@index="0"]', '😂')
     self.BF.check_assertTrue(emoji, 'emoji默认设置取消失败')
Exemplo n.º 22
0
 def theme(self):
     top_y = self.BF.keyboard_get_ready(
         'com.emoji.ikeyboard/com.android.inputmethod.latin.LatinIME',
         'class', 'android.widget.ScrollView')
     keyboard = Keyboard_Operation(self.d, top_y)
     k = keyboard.get_keyboard_picture(0, top_y, keyboard.phone_width,
                                       (keyboard.density()['app'] - top_y),
                                       'keyboard')
     keyboard.send_input('system')
     keyboard.main_menu_click('theme')
     keyboard.select_theme(2, 1)
     pic_text = keyboard.get_keyboard_picture(
         0, top_y, keyboard.phone_width,
         (keyboard.density()['app'] - top_y), 'keyboard_back')
     keyboard.send_input('q')
     click = self.BF.attribute_name('classes', 'android.widget.EditText[0]')
     # pic_text = keyboard.pic_text(pic_text)
     # if 'q' in pic_text:
     if click == 'q' or 'Q':
         pass
     else:
         assert 1 + 1 > 2, '没有回到键盘'
     k_s = keyboard.keyboard_same(0, top_y, keyboard.phone_width,
                                  (keyboard.density()['app'] - top_y), k)
     self.BF.check_assertFalse(k_s, '主题更换失败')
     # 回选到默认主题
     keyboard.send_input('system')
     keyboard.main_menu_click('theme')
     keyboard.select_theme(1, 2)
     pic_text = keyboard.get_keyboard_picture(
         0, top_y, keyboard.phone_width,
         (keyboard.density()['app'] - top_y), 'keyboard_back')
     pic_text = keyboard.pic_text(pic_text)
     if 'q' or 'Q' in pic_text:
         pass
     else:
         assert 1 + 1 > 2, '没有回到键盘'
     k_s = keyboard.keyboard_same(0, top_y, keyboard.phone_width,
                                  (keyboard.density()['app'] - top_y), k)
     self.BF.check_assertTrue(k_s, '主题更换失败')
    def old_new_app_custom_keyboard(self, package, Typewriting, old, new):
        if self.device_config == 'none':
            try:
                unin_result = os.popen('adb uninstall %s' % package)
            except Exception as e:
                print(e)
                print('没有对应应用')
        else:
            try:
                unin_result = os.popen('adb -s %s uninstall %s' % (self.device_config, package))
            except Exception as e:
                print(e)
                print('没有对应应用')
        # 安装老应用
        o = os.popen('adb install -r %s' % old)
        print(o.read())
        self.BF.keyboard_select(Typewriting)
        self.custom_keyboard()
        self.driver.tap([(200, 200)])
        self.driver.back()
        self.driver.start_activity('yuside.cn.numbersonly', 'yuside.cn.numbersonly.MainActivity')
        # 截图
        top_y = self.BF.keyboard_get_ready(Typewriting, 'class', 'android.widget.ScrollView')
        keyboard = Keyboard_Operation(self.driver, top_y)
        old_keyboard = keyboard.get_keyboard_picture(0, top_y + 40 * keyboard.density()['density'],
                                                     keyboard.phone_width,
                                                     (keyboard.density()['app'] - top_y - 40 * keyboard.density()[
                                                         'density']) * 3 / 4,
                                                     'keyboard_old')
        self.driver.back()
        self.driver.back()
        # 强制安装
        self.BF.adb_install(new, self.device_config)
        # 对比
        self.BF.keyboard_select(Typewriting)
        self.driver.start_activity('yuside.cn.numbersonly', 'yuside.cn.numbersonly.MainActivity')
        time.sleep(5)
        top_y = self.BF.keyboard_get_ready(Typewriting, 'class', 'android.widget.ScrollView')

        keyboard = Keyboard_Operation(self.driver, top_y)
        k = keyboard.keyboard_same(0, top_y + 40 * keyboard.density()['density'], keyboard.phone_width,
                                   (keyboard.density()['app'] - top_y - 40 * keyboard.density()['density']) * 3 / 4,
                                   old_keyboard)
        self.BF.check_assertTrue(k, '自定义主题消失了')
Exemplo n.º 24
0
 def pop_key(self):
     top_y = self.BF.keyboard_get_ready(
         'com.emoji.ikeyboard/com.android.inputmethod.latin.LatinIME',
         'class', 'android.widget.ScrollView')
     keyboard = Keyboard_Operation(self.d, top_y)
     keyboard.pop_select('a', 'á')
     a = self.BF.attribute_name('xpath',
                                '//android.widget.EditText[@index="0"]',
                                'á')
     self.BF.check_assertTrue(a, 'popkey有问题')
     self.BF.check_find_element(
         'xpath', '//android.widget.EditText[@index="0"]').clear()
     keyboard.send_input('number')
     keyboard.pop_select('.', '…', keyboard_type='normal_number')
     number = self.BF.attribute_name(
         'xpath', '//android.widget.EditText[@index="0"]', '…')
     self.BF.check_assertTrue(number, 'popkey有问题')
     self.BF.check_find_element(
         'xpath', '//android.widget.EditText[@index="0"]').clear()
     keyboard.send_input('symbol', keyboard_type='normal_number')
     keyboard.pop_select('=', '∞', keyboard_type='normal_symbol')
     symbol = self.BF.attribute_name(
         'xpath', '//android.widget.EditText[@index="0"]', '∞')
     self.BF.check_assertTrue(symbol, 'popkey有问题')
Exemplo n.º 25
0
    def download_font(self):
        top_y = self.BF.keyboard_get_ready(
            'com.emoji.ikeyboard/com.android.inputmethod.latin.LatinIME',
            'class', 'android.widget.ScrollView')
        keyboard = Keyboard_Operation(self.d, top_y)
        old_keyboard = keyboard.get_keyboard_picture(
            0, top_y + 40 * keyboard.density()['density'],
            keyboard.phone_width, (keyboard.density()['app'] - top_y -
                                   40 * keyboard.density()['density']) * 3 / 4,
            'keyboard_old')
        self.Ik.random_download_font()
        self.d.start_activity('yuside.cn.numbersonly',
                              'yuside.cn.numbersonly.MainActivity')
        time.sleep(5)
        top_y = self.BF.keyboard_get_ready(
            'com.emoji.ikeyboard/com.android.inputmethod.latin.LatinIME',
            'class', 'android.widget.ScrollView')

        keyboard = Keyboard_Operation(self.d, top_y)
        k = keyboard.keyboard_same(
            0, top_y + 40 * keyboard.density()['density'],
            keyboard.phone_width, (keyboard.density()['app'] - top_y -
                                   40 * keyboard.density()['density']) * 3 / 4,
            old_keyboard)
        self.BF.check_assertFalse(k, '字体修改失败')
        self.Ik.clear_font()
Exemplo n.º 26
0
 def emoji_style_download(self):
     top_y = self.BF.keyboard_get_ready(
         'com.emoji.ikeyboard/com.android.inputmethod.latin.LatinIME',
         'class', 'android.widget.ScrollView')
     keyboard = Keyboard_Operation(self.d, top_y)
     keyboard.send_input('emoji')
     old_emoji = keyboard.get_keyboard_picture(
         0, top_y + 40 * keyboard.density()['density'],
         keyboard.phone_width,
         keyboard.density()['app'] - top_y -
         80 * keyboard.density()['density'], 'old_emoji')
     self.Ik.random_download_emoji_style()
     self.d.start_activity('yuside.cn.numbersonly',
                           'yuside.cn.numbersonly.MainActivity')
     # 键盘输入检查
     top_y = self.BF.keyboard_get_ready(
         'com.emoji.ikeyboard/com.android.inputmethod.latin.LatinIME',
         'class', 'android.widget.ScrollView')
     keyboard = Keyboard_Operation(self.d, top_y)
     keyboard.send_input('emoji')
     now_emoji = keyboard.keyboard_same(
         0, top_y + 40 * keyboard.density()['density'],
         keyboard.phone_width,
         keyboard.density()['app'] - top_y -
         80 * keyboard.density()['density'], old_emoji)
     self.BF.check_assertFalse(now_emoji, 'emoji风格更换失败')
     self.Ik.clear_download_emoji_style()