示例#1
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')
示例#2
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')
 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默认设置取消失败')