def setUp(self): print('Test start') desired_caps = {} desired_caps[ 'automationName'] = "appium" # Appium,UiAutomator2,XCUITest,YouiEngine desired_caps['platformName'] = 'Android' desired_caps['deviceName'] = self.device desired_caps['udid'] = self.device # desired_caps['appPackage'] = 'com.tencent.mm' # desired_caps['appActivity'] = 'com.tencent.mm.ui.LauncherUI' desired_caps['appPackage'] = 'com.facebook.orca' desired_caps['appActivity'] = '.auth.StartScreenActivity' # desired_caps['appPackage'] = 'com.emoji.ikeyboard' # desired_caps['appActivity'] = 'com.qisi.ikeyboarduirestruct.NavigationActivity' # 隐藏键盘 # desired_caps['resetKeyboard'] = 'True' # 使用appium键盘 # desired_caps['unicodeKeyboard'] = 'True' self.d = webdriver.Remote( 'http://%s:%s/wd/hub' % (self.APPIUM_CONFIG[0], self.APPIUM_CONFIG[1]), desired_caps) # self.d = webdriver.Remote('http://%s:%s/wd/hub' % ('127.0.0.1', '4711'), desired_caps) self.extend = Appium_Extend(self.d) self.BF = BaseFunction(self, self.d) self.Ik = Ikey_Function(self, self.d) self.M = Messager_Function(self, self.d, DEVICE_CONFIG) self.BF.keyboard_select( 'com.emoji.ikeyboard/com.android.inputmethod.latin.LatinIME') time.sleep(5)
def setUp(self): print('Test start') desired_caps = {} desired_caps[ 'automationName'] = "appium" # Appium,UiAutomator2,XCUITest,YouiEngine desired_caps['platformName'] = 'Android' desired_caps['deviceName'] = self.device desired_caps['udid'] = self.device # 超时时间设置 desired_caps['newCommandTimeout'] = 360 # desired_caps['appPackage'] = 'com.tencent.mm' # desired_caps['appActivity'] = 'com.tencent.mm.ui.LauncherUI' desired_caps['appPackage'] = 'yuside.cn.numbersonly' desired_caps['appActivity'] = 'yuside.cn.numbersonly.MainActivity' # desired_caps['appPackage'] = 'com.emoji.ikeyboard' # desired_caps['appActivity'] = 'com.qisi.ikeyboarduirestruct.NavigationActivity' # 隐藏键盘 # desired_caps['resetKeyboard'] = 'True' # 使用appium键盘 # desired_caps['unicodeKeyboard'] = 'True' self.d = webdriver.Remote( 'http://%s:%s/wd/hub' % (self.APPIUM_CONFIG[0], self.APPIUM_CONFIG[1]), desired_caps) # self.d = webdriver.Remote('http://%s:%s/wd/hub' % ('127.0.0.1', '4711'), desired_caps) self.extend = Appium_Extend(self.d) self.BF = BaseFunction(self, self.d) self.Ik = Ikey_Function(self, self.d, self.device) time.sleep(5) self.BF.keyboard_select( 'com.emoji.ikeyboard/com.android.inputmethod.latin.LatinIME', self.device)
def setUp(self): print('Test start') desired_caps = {} desired_caps['automationName'] = "appium" # Appium,UiAutomator2,XCUITest,YouiEngine desired_caps['platformName'] = 'Android' desired_caps['deviceName'] = self.device desired_caps['udid'] = self.device # desired_caps['appPackage'] = 'com.tencent.mm' # desired_caps['appActivity'] = 'com.tencent.mm.ui.LauncherUI' desired_caps['appPackage'] = 'com.whatsapp' desired_caps['appActivity'] = 'com.whatsapp.Main' # desired_caps['appPackage'] = 'com.emoji.ikeyboard' # desired_caps['appActivity'] = 'com.qisi.ikeyboarduirestruct.NavigationActivity' # 隐藏键盘 # desired_caps['resetKeyboard'] = 'True' # 使用appium键盘 # desired_caps['unicodeKeyboard'] = 'True' self.d = webdriver.Remote('http://%s:%s/wd/hub' % (self.APPIUM_CONFIG[0], self.APPIUM_CONFIG[1]), desired_caps) # self.d = webdriver.Remote('http://%s:%s/wd/hub' % ('127.0.0.1', '4711'), desired_caps) self.extend = Appium_Extend(self.d) self.BF = BaseFunction(self, self.d) self.kika = Kika_Function(self, self.d) self.Ik = Ikey_Function(self, self.d) self.W = Whatsapp_Function(self, self.d, DEVICE_CONFIG) time.sleep(5)
class Messenger(unittest.TestCase): def __init__(self, methodName='runTest', device=DEVICE_CONFIG): unittest.TestCase.__init__(self, methodName) self.device = device self.APPIUM_CONFIG = appium_config.get_appium_set()[self.device] def setUp(self): print('Test start') desired_caps = {} desired_caps[ 'automationName'] = "appium" # Appium,UiAutomator2,XCUITest,YouiEngine desired_caps['platformName'] = 'Android' desired_caps['deviceName'] = self.device desired_caps['udid'] = self.device # desired_caps['appPackage'] = 'com.tencent.mm' # desired_caps['appActivity'] = 'com.tencent.mm.ui.LauncherUI' desired_caps['appPackage'] = 'com.facebook.orca' desired_caps['appActivity'] = '.auth.StartScreenActivity' # desired_caps['appPackage'] = 'com.emoji.ikeyboard' # desired_caps['appActivity'] = 'com.qisi.ikeyboarduirestruct.NavigationActivity' # 隐藏键盘 # desired_caps['resetKeyboard'] = 'True' # 使用appium键盘 # desired_caps['unicodeKeyboard'] = 'True' self.d = webdriver.Remote( 'http://%s:%s/wd/hub' % (self.APPIUM_CONFIG[0], self.APPIUM_CONFIG[1]), desired_caps) # self.d = webdriver.Remote('http://%s:%s/wd/hub' % ('127.0.0.1', '4711'), desired_caps) self.extend = Appium_Extend(self.d) self.BF = BaseFunction(self, self.d) self.Ik = Ikey_Function(self, self.d) self.M = Messager_Function(self, self.d, DEVICE_CONFIG) self.BF.keyboard_select( 'com.emoji.ikeyboard/com.android.inputmethod.latin.LatinIME') time.sleep(5) def tearDown(self): print('Test end') self.d.quit() def precast_condition(self): # self.d.start_activity('com.emoji.ikeyboard', 'com.android.inputmethod.latin.setup.SetupWizard2Activity') # time.sleep(3) self.Ik.precast_condition( 'com.emoji.ikeyboard', '/Users/xm/Downloads/app-ikeyboard-135601-release-ikey_engine_refactor.apk', 'com.emoji.ikeyboard/com.android.inputmethod.latin.LatinIME') 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') def es_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_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, '没有纠正') 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, '没有纠正')
class InputApp(unittest.TestCase): def __init__(self, methodName='runTest', device=DEVICE_CONFIG): unittest.TestCase.__init__(self, methodName) self.device = device self.APPIUM_CONFIG = appium_config.get_appium_set()[self.device] def setUp(self): print('Test start') desired_caps = {} desired_caps[ 'automationName'] = "appium" # Appium,UiAutomator2,XCUITest,YouiEngine desired_caps['platformName'] = 'Android' desired_caps['deviceName'] = self.device desired_caps['udid'] = self.device # 超时时间设置 desired_caps['newCommandTimeout'] = 360 # desired_caps['appPackage'] = 'com.tencent.mm' # desired_caps['appActivity'] = 'com.tencent.mm.ui.LauncherUI' desired_caps['appPackage'] = 'yuside.cn.numbersonly' desired_caps['appActivity'] = 'yuside.cn.numbersonly.MainActivity' # desired_caps['appPackage'] = 'com.emoji.ikeyboard' # desired_caps['appActivity'] = 'com.qisi.ikeyboarduirestruct.NavigationActivity' # 隐藏键盘 # desired_caps['resetKeyboard'] = 'True' # 使用appium键盘 # desired_caps['unicodeKeyboard'] = 'True' self.d = webdriver.Remote( 'http://%s:%s/wd/hub' % (self.APPIUM_CONFIG[0], self.APPIUM_CONFIG[1]), desired_caps) # self.d = webdriver.Remote('http://%s:%s/wd/hub' % ('127.0.0.1', '4711'), desired_caps) self.extend = Appium_Extend(self.d) self.BF = BaseFunction(self, self.d) self.Ik = Ikey_Function(self, self.d, self.device) time.sleep(5) self.BF.keyboard_select( 'com.emoji.ikeyboard/com.android.inputmethod.latin.LatinIME', self.device) def tearDown(self): print('Test end') self.d.quit() def precast_condition(self): self.Ik.precast_condition( 'com.emoji.ikeyboard', '/Users/xm/Downloads/app-ikeyboard-136401-release-ikey_engine_refactor.apk', 'com.emoji.ikeyboard/com.android.inputmethod.latin.LatinIME') 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_app1(self): self.Ik.old_new_app_custom_keyboard( 'com.emoji.ikeyboard', 'com.emoji.ikeyboard/com.android.inputmethod.latin.LatinIME', '/Users/xm/Downloads/app-ikeyboard-135401-release-ikey_release.apk', '/Users/xm/Downloads/app-ikeyboard-135601-release-ikey_engine_refactor.apk' ) def old_new_app2(self): run_result = [] false_result = [] for i in range(3, 12): # for i in range(5, 7): result = self.Ik.old_new_app_theme( i, 'com.emoji.ikeyboard', 'com.emoji.ikeyboard/com.android.inputmethod.latin.LatinIME', '/Users/xm/Downloads/app-ikeyboard-135401-release-ikey_release.apk', '/Users/xm/Downloads/app-ikeyboard-135601-release-ikey_engine_refactor.apk' ) run_result.append(result) print(run_result) for g in range(0, len(run_result)): for f in run_result[g]: key = f if run_result[g][f] == False: false_result.append(key) if len(false_result) > 0: assert 1 + 1 > 2, '以下主题前后不一致%s' % str(false_result) def old_new_app3(self): run_result = [] false_result = [] for i in range(0, 5): result = self.Ik.old_new_app_font( i, 'com.emoji.ikeyboard', 'com.emoji.ikeyboard/com.android.inputmethod.latin.LatinIME', '/Users/xm/Downloads/app-ikeyboard-135401-release-ikey_release.apk', '/Users/xm/Downloads/app-ikeyboard-135601-release-ikey_engine_refactor.apk' ) run_result.append(result) print(run_result) for g in range(0, len(run_result)): for f in run_result[g]: key = f if run_result[g][f] == False: false_result.append(key) if len(false_result) > 0: assert 1 + 1 > 2, '以下字体前后不一致%s' % str(false_result) # 自定义键盘 def change(self): self.Ik.change_custom_keyboard() def settings(self): self.Ik.app_settings() # 修改为第几个主题 def theme_change(self): self.Ik.change_theme(3) 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('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, '键盘输入内容错误') # 随机下载主题并清除下载的主题 def download_theme(self): self.Ik.random_download_theme() 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('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, '键盘输入内容错误') self.Ik.clear_download_theme() # 跟换emoji的风格 def emoji_style_change(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.change_emoji_style(0) 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风格更换失败') # 下载并更换emoji主题后清理 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() # 下载font对比后并清理 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() # pop_key检查 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有问题') # 开启Number和Select后的layout检查 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后键盘高度变化了') # 新老版本语言 def new_language(self): self.Ik.app_settings() self.BF.click('name', 'Language') self.Ik.reach_language_add('Español (US)') self.Ik.reach_language_add('Português (Brasil)') self.d.back() self.BF.click('name', 'Language') l1 = self.BF.existence('name', 'English (US)') l2 = self.BF.existence('name', 'Español (US)') l3 = self.BF.existence('name', 'Português (Brasil)') if l1 and l2 and l3 is True: new_result = True else: new_result = False self.BF.check_assertTrue(new_result, '键盘添加语言正确') # 键盘检查 self.BF.open_app_atcivity( 'com.emoji.ikeyboard/com.qisi.ikeyboarduirestruct.NavigationActivity', self.device) self.Ik.app_settings() self.BF.click('name', 'Language') self.BF.click('name', 'Español (US)') self.BF.click('id', 'com.emoji.ikeyboard:id/iv_bg') es = self.BF.existence('name', 'Español (US)', fail_pic=False) self.BF.check_assertFalse(es, 'Es删除失败') self.BF.click('name', 'Português (Brasil)') self.BF.click('id', 'com.emoji.ikeyboard:id/iv_bg') es = self.BF.existence('name', 'Português (Brasil)', fail_pic=False) self.BF.check_assertFalse(es, 'Pt删除失败') def test(self): top_y = self.BF.keyboard_get_ready( 'com.emoji.ikeyboard/com.android.inputmethod.latin.LatinIME', 'class', 'android.widget.ScrollView', self.device) keyboard = Keyboard_Operation(self.d, top_y, self.device) 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')