class Test_self_leiji(): driver = appium_desired() com = Common(driver) @pytest.fixture() def my_fixture(self): WebDriverWait(self.driver, 10).until(lambda x: x.find_element(*self.com.gesture)) self.com.shoushi() self.driver.implicitly_wait(3) self.driver.find_element(*self.com.self_button).click() def test_totalAsset(self, my_fixture): total_Asset = SelfLeijiView(self.driver).get_totalAsset() assert total_Asset != False, '没有获取到总资产' assert total_Asset != '', '总资产显示处为空' def test_totalIncome(self): totalIncome = SelfLeijiView(self.driver).get_todoIncome() assert totalIncome != False, '没有获取到总收益' assert totalIncome != '', '累计收益处显示为空' def test_todoIncome(self): todoIncome = SelfLeijiView(self.driver).get_todoIncome() assert todoIncome != False, '没有获取到待收收益' assert todoIncome != '', '待收收益处显示为空'
class Test_zidongtou(): driver = appium_desired() obj = SelfZidongtouView(driver) com = Common(driver) @pytest.fixture() def my_fixture(self): WebDriverWait(self.driver, 10).until(lambda x: x.find_element(*self.com.gesture)) self.com.shoushi() self.driver.implicitly_wait(3) self.com.click_self_center() self.obj.click_zidongtou() def test_topBanner(self, my_fixture): assert self.obj.click_top_banner() == True, '点击topBanner失败' def test_topBanner_jump(self): assert self.obj.check_banner_jump() == True, 'topBanner_jump失败' def test_commonProblem(self): assert self.obj.click_common_problem() == True, '点击常见问题icon失败' def test_commonProble_jump(self): assert self.obj.check_common_problem_jump() == True, '常见问题跳转失败' def test_open_auto(self): assert self.obj.click_open_auto() == True, '点击开启自动投icon失败' def test_check_openAuto_jump(self): assert self.obj.check_openAuto_jump() == True, '开启自动投跳转失败'
def setUp(self): """ 预处理 :return: """ logging.info('=====setUp====') self.driver = appium_desired()
def test_user_register(self): logging.info('=========test user register==========') r = RegisterView(appium_desired()) username = '******' + 'xlp' + str(random.randint(1000, 9000)) password = '******' + str(random.randint(1000, 9000)) email = '51zxw' + str(random.randint(1000, 9000)) + '@163.com' self.assertTrue(r.register_action(username, password, email))
def setUp(self): self.driver = appium_desired() commonView = Common(self.driver) commonView.always_allow() time.sleep(1) commonView.check_cancel_button() commonView = Common(self.driver) commonView.check_skip_button() self.loginView = LoginView(self.driver)
def test_xiaomi_login(): driver = appium_desired() com = XiaoMi(driver) csv_file = "../data/login_datas.csv" xiaomi_name = CommonFuntions().get_csv_datas(csv_file, 2)[0] xiaomi_pwd = CommonFuntions().get_csv_datas(csv_file, 2)[1] com.xiaomi(xiaomi_name, xiaomi_pwd) com1 = TestXiaoMi(driver) com1.test_xiaomi()
def setUpClass(self): warnings.simplefilter('ignore', ResourceWarning) self.driver = appium_desired() c = Common(self.driver) for x in range(3): c.swipeLeft() time.sleep(1) self.driver.find_element_by_id( 'com.yhbc.purchase:id/tv_start_login').click()
class StartEnd(unittest.TestCase): driver = appium_desired() def SetUp(self): logging.info('===========SetUp=========') # self.driver=appium_desired() def TearDown(self): logging.info('=========TearDown========') sleep(5) self.driver.close_app()
class TestLogin(): csv_file = '../data/num.csv' driver = appium_desired() def teardown_method(self): obj = LoginView(self.driver) obj.logout_action() self.driver.keyevent(4) def test_01(self): logging.info('----通过测试') obj = LoginView(self.driver) data = obj.get_csv(self.csv_file, 0) obj.login_action(data[0], data[1]) assert obj.check_login_success() == True def test_02(self): logging.info('----密码错误') obj = LoginView(self.driver) data = obj.get_csv(self.csv_file, 1) obj.login_action(data[0], data[1]) assert obj.check_login_success() == False, 'test02 登录未成功'
def start_devices_action(udid, port): host = '127.0.0.1' if start_appium_action(host, port): appium_desired(udid, port) else: release_port(port)
def test_mobilephone_login(): driver = appium_desired() com = MobilePhone(driver) com.mobilephone() com1 = TestMobilePhone(driver) com1.test_mobilephone()
def setUp(self): self.dr = appium_desired() self.f = ForumView(self.dr) self.f.check_is_login()
# try: # WebDriverWait(driver, 10).until(lambda func: func.find_element_by_android_uiautomator("new UiSelector().text(\"Display\")")) # except NoSuchElementException: # print("NOT exists") # else: # dsplay_view.click() # print(ft_size) # ft_size.click() if __name__ == '__main__': _host = '127.0.0.1' _port = 4723 AppiumUtils().start_appium_server(_host, _port) ADB = AdbCommon() driver = dc.appium_desired(udid='1649c2e3', port=_port) bv = BaseView(driver) time.sleep(2) # SEARCH_BTN = (By.XPATH, "//*[@text='Display']") SEARCH_BTN = (By.XPATH, "text, Display, 1") # SEARCH_BTN = (By.XPATH, ["text, Display", "index, 0, 1"]) # print(time.strftime("%Y-%m-%D %H:%M:%S")) # SEARCH_BTN = (By.NAME, "Search settings") search_view = bv.find_element(SEARCH_BTN) search_view.click() time.sleep(3) # search = bv.find_element_by_desc(_desc='Search settings') # ele_bounds = bv.get_element_bounds(search) # print(ele_bounds) # bv.delay(5) # print(bv.get_network_connection_type())
def setUp(self): logging.info('--setUp--') self.dr = appium_desired()
def setUp(self): logging.info('**********setUp**********') self.driver = appium_desired()
id_go_login_btn = (By.ID, 'com.souyidai.investment.android:id/login') id_user_name_et = (By.ID, 'com.souyidai.investment.android:id/user_name') id_password_et = (By.ID, 'com.souyidai.investment.android:id/password') id_login_btn = (By.ID, 'com.souyidai.investment.android:id/login') def login_action(self, username, password): if self.is_login(): self.logout() if self.wait_activity(self.activity_login, self.timeout): self._login_action(username, password) else: self.go_main_activity() self.find_element(*self.id_go_login_btn).click() self._login_action(username, password) def _login_action(self, username, password): user_name_et = self.find_element(*self.id_user_name_et) # user_name_et.clear() user_name_et.send_keys(username) password_et = self.find_element(*self.id_password_et) # password_et.clear() password_et.send_keys(password) self.find_element(*self.id_login_btn).click() if __name__ == '__main__': l = LoginView(appium_desired()) l.login_action("15811079371", "1234567788")
def setUp(self): logging.info('=====setUp====') ov = OpenView(self) connect_device(ov.get_phone_dev()) self.driver = appium_desired()
def setUpClass(cls): cls.driver = appium_desired(devices=devices) cls.devicesName = devices['deviceName']
def setUp(self): self.driver = appium_desired() common = Common(self.driver) common.check_cancel_button() common.check_skip_button() self.loginView = LoginView(self.driver)
def setUp(self): warnings.simplefilter("ignore", ResourceWarning) logging.info('=====setUp=====') self.driver = appium_desired()
def test_wechat_login(): driver = appium_desired() com = WeChat(driver) com.wechat() com1 = TestWeChat(driver) com1.test_wechat()
def setUp(self): logging.info('=====开始执行自动化测试====') self.driver = appium_desired()
def setUp(self): logging.info('=======setUp=======') self.driver = appium_desired()
def setUp(self): logging.info('=====setUp====') # case运行前 先连接服务 self.driver=appium_desired()
def setUp(self): self.driver = appium_desired()
def test_qq_login(): driver = appium_desired() com = QqLogin(driver) com.qqlogin() com1 = TestQq(driver) com1.test_qq()
logging.info('====register_action====') self.dr.find_element(*self.myself_loc).click() self.dr.find_element(*self.login_loc).click() self.dr.find_element(*self.register_loc).click() self.dr.find_element(*self.username).send_keys(username) self.dr.find_element(*self.password).send_keys(password) self.dr.find_element(*self.email).send_keys(email) self.dr.find_element(*self.registerBtn).click() def check_register(self): logging.info('====check register====') try: self.dr.find_element(*self.username_loc) except: logging.error("register fail") return False else: logging.info('register sucess') self.logout() return True if __name__ == "__main__": dr = appium_desired() r = RegisterView(dr) username = '******' + str(random.randint(100, 1000)) password = '******' email = str(random.randint(100000000, 10000000000)) + '@qq.com' r.register_action(username, password, email) r.check_register()
def test_microblog_login(): driver = appium_desired() com = MicroBlog(driver) com.microblog() com1 = TestMicroBlog(driver) com1.test_microblog()
logging.info('====check_loginStatus======') self.check_market_ad() self.check_account_alert() try: self.driver.find_element(*self.button_mysefl).click() self.driver.find_element(*self.username) except NoSuchElementException: logging.error('login Fail!') self.getScreenShot('login fail') return False else: logging.info('login success!') self.logout_action() return True def logout_action(self): logging.info('=====logout_action======') self.driver.find_element(*self.RightButton).click() self.driver.find_element(*self.logoutBtn).click() self.driver.find_element(*self.tip_commit).click() if __name__ == '__main__': driver = appium_desired() l = LoginView(driver) # l.login_action('自学网2018','zxw2018') l.login_action('自学网2018', '34454') l.check_loginStatus()
def setUp(self): logging.info('======SET UP======') self.driver = appium_desired('127.0.0.1:21503', 4725)