def test12(self): '''进入消息页面是否正常''' Mylogin(self.driver).login() time.sleep(5) self.driver.find_element_by_id( "cn.xiaochuankeji.tieba:id/iconTabItem").click() time.sleep(6) self.driver.find_elements_by_id( "cn.xiaochuankeji.tieba:id/iconTabItem")[2].click() time.sleep(6) self.driver.find_elements_by_id( "cn.xiaochuankeji.tieba:id/title")[1].click() time.sleep(6) a = self.driver.find_elements_by_class_name( "android.widget.RelativeLayout") for i in range(0, len(a)): a[i].click() time.sleep(3) self.driver.find_element_by_id( "cn.xiaochuankeji.tieba:id/input").send_keys('cs哈喽哇') self.driver.find_element_by_id( "cn.xiaochuankeji.tieba:id/text").click() self.driver.keyevent(4) time.sleep(4) continue time.sleep(6)
def test10(self): '''验证评论发送是否正常''' Mylogin(self.driver).login() time.sleep(5) self.driver.find_element_by_id( "cn.xiaochuankeji.tieba:id/iconTabItem").click() time.sleep(6) self.driver.implicitly_wait(60) el = self.driver.find_element_by_id( "cn.xiaochuankeji.tieba:id/ic_search_b") time.sleep(6) self.driver.find_element_by_id( "cn.xiaochuankeji.tieba:id/expand_content_view").click() time.sleep(6) self.driver.find_element_by_id( "cn.xiaochuankeji.tieba:id/etInput").send_keys('t123') time.sleep(2) self.driver.find_element_by_id( "cn.xiaochuankeji.tieba:id/send").click() toast_loc = ("xpath", '//*[contains(@text,"评论发送成功")]') e1 = WebDriverWait(self.driver, 20, 0.1).until( EC.presence_of_element_located(toast_loc)) print(e1.text) time.sleep(2) self.driver.keyevent(4)
def test08(self): '''验证编辑个人信息选择城市''' Mylogin(self.driver).login() time.sleep(8) self.driver.find_elements_by_id( 'cn.xiaochuankeji.tieba:id/iconTabItem')[3].click() time.sleep(5) self.driver.find_element_by_class_name( 'android.widget.ImageView').click() self.driver.implicitly_wait(100) self.driver.find_element_by_id( 'cn.xiaochuankeji.tieba:id/btn_edit_info').click() time.sleep(5) city00 = self.driver.find_element_by_id( 'cn.xiaochuankeji.tieba:id/tvCity') aa = city00.text city00.click() time.sleep(5) height = self.driver.get_window_size()['height'] width = self.driver.get_window_size()['width'] self.driver.swipe(width * 0.3, height * 0.8, width * 0.8, height * 0.8, 3000) self.driver.find_element_by_id( 'cn.xiaochuankeji.tieba:id/btnSubmit').click() time.sleep(5) city = self.driver.find_element_by_id( 'cn.xiaochuankeji.tieba:id/tvCity') bb = city.text city.click() time.sleep(5) self.assertFalse(aa.text, bb.text)
def testshoye01_001(self): '''验证游戏界面是否正常显示''' Mylogin(self.driver).login() time.sleep(6) try: self.driver.find_element_by_id("cn.xiaochuankeji.tieba:id/home_item").click() except: pass time.sleep(3) aText = self.driver.find_element_by_id("cn.xiaochuankeji.tieba:id/titile") self.assertEqual(aText[6].text,"关注")
def test16(self): '''验证顶帖键功能是否正常''' Mylogin(self.driver).login() time.sleep(5) self.driver.find_element_by_id( "cn.xiaochuankeji.tieba:id/iconTabItem").click() time.sleep(6) a = self.driver.find_element_by_id( "cn.xiaochuankeji.tieba:id/tvUpCount") bb = a.text self.driver.find_element_by_id( "cn.xiaochuankeji.tieba:id/ivUpArrow").click() self.assertNotEqual(bb, a.text)
def test09(self): '''验证长按弹出分享''' Mylogin(self.driver).login() time.sleep(5) self.driver.find_element_by_id( "cn.xiaochuankeji.tieba:id/iconTabItem").click() time.sleep(5) el = self.driver.find_element_by_class_name('android.widget.ImageView') time.sleep(5) TouchAction(self.driver).long_press(el).perform() self.driver.implicitly_wait(80) self.driver.find_element_by_id( 'cn.xiaochuankeji.tieba:id/iconTabItem').click()
def test19(self): '''验证进入视频是否正常''' Mylogin(self.driver).login() time.sleep(5) self.driver.find_element_by_id( "cn.xiaochuankeji.tieba:id/iconTabItem").click() time.sleep(2) self.driver.find_elements_by_id( "cn.xiaochuankeji.tieba:id/title")[2].click() time.sleep(2) self.driver.find_element_by_id( "cn.xiaochuankeji.tieba:id/holder_flow_rmdv").click() time.sleep(5) self.driver.find_element_by_id( "cn.xiaochuankeji.tieba:id/iv_danmu_switch").click()
def test18(self): '''验证进入话题是否正常''' Mylogin(self.driver).login() time.sleep(5) self.driver.find_element_by_id( "cn.xiaochuankeji.tieba:id/iconTabItem").click() time.sleep(2) a = self.driver.find_element_by_id( "cn.xiaochuankeji.tieba:id/topic_tv") bb = a.text a.click() time.sleep(2) cc = self.driver.find_element_by_id( "cn.xiaochuankeji.tieba:id/tvTopicName").text self.assertEqual(bb, cc)
def testshouye01_03(self): '''验证评论帖子功能''' Mylogin(self.driver).login() time.sleep(3) self.driver.find_element_by_id("cn.xiaochuankeji.tieba:id/iconTabItem").click() time.sleep(6) self.driver.find_element_by_id("cn.xiaochuankeji.tieba:id/expand_content_view").click() time.sleep(3) self.driver.find_element_by_id("cn.xiaochuankeji.tieba:id/etInput").send_keys("textCESHI") self.driver.find_element_by_id("cn.xiaochuankeji.tieba:id/send").click() sendContent = self.driver.find_elements_by_id("cn.xiaochuankeji.tieba:id/expandTextView") sendContentRawList = [] for i in range(0, len(sendContent)): sendContentRawList.append(sendContent[i].text) sendContentList = "".join(sendContentRawList) self.assertIn("textCESHI", sendContentList)
def test20(self): '''验证发弹幕是否正常''' Mylogin(self.driver).login() time.sleep(5) self.driver.find_element_by_id( "cn.xiaochuankeji.tieba:id/iconTabItem").click() time.sleep(2) self.driver.find_elements_by_id( "cn.xiaochuankeji.tieba:id/title")[2].click() time.sleep(2) self.driver.find_element_by_id( "cn.xiaochuankeji.tieba:id/holder_flow_rmdv").click() time.sleep(5) self.driver.find_element_by_id( "cn.xiaochuankeji.tieba:id/text_danmu").send_keys('发弹幕测试测试测试') time.sleep(5)
def test17(self): '''验证取消顶帖键功能是否正常''' Mylogin(self.driver).login() time.sleep(5) self.driver.find_element_by_id( "cn.xiaochuankeji.tieba:id/iconTabItem").click() time.sleep(2) # a=self.driver.find_element_by_id("cn.xiaochuankeji.tieba:id/tvUpCount") # bb=a.text self.driver.find_element_by_id( "cn.xiaochuankeji.tieba:id/ivUpArrow").click() self.driver.find_element_by_id( "cn.xiaochuankeji.tieba:id/ivDownArrow").click() time.sleep(2) self.driver.find_element_by_id( "cn.xiaochuankeji.tieba:id/tv_func_click").click()
def test14(self): '''验证关注别人是否正常''' Mylogin(self.driver).login() time.sleep(5) self.driver.find_element_by_id( "cn.xiaochuankeji.tieba:id/iconTabItem").click() time.sleep(6) self.driver.find_element_by_id( "cn.xiaochuankeji.tieba:id/simple_member_tv_name").click() time.sleep(3) a = self.driver.find_element_by_id( "cn.xiaochuankeji.tieba:id/btn_follow") bb = a.text a.click() time.sleep(3) self.assertnNotEqual(a.text, bb)
def test13(self): '''验证搜索功能是否正常''' Mylogin(self.driver).login() time.sleep(5) self.driver.find_element_by_id( "cn.xiaochuankeji.tieba:id/iconTabItem").click() time.sleep(6) self.driver.find_element_by_id( "cn.xiaochuankeji.tieba:id/ic_search_b").click() time.sleep(3) self.driver.find_element_by_id( "cn.xiaochuankeji.tieba:id/search_input").send_keys('电影') self.driver.find_element_by_id( "cn.xiaochuankeji.tieba:id/ic_search_b").click() time.sleep(5) self.assertTrue( self.driver.find_element_by_xpath('//*[contains(text,"电影")]'))
def test07(self): '''验证发帖正常''' Mylogin(self.driver).login() time.sleep(8) self.driver.find_element_by_id( 'cn.xiaochuankeji.tieba:id/iconTabItem').click() self.driver.implicitly_wait(100) self.driver.find_element_by_id( 'cn.xiaochuankeji.tieba:id/etContent').send_keys('fatian') time.sleep(5) self.driver.find_element_by_id( 'cn.xiaochuankeji.tieba:id/select_topic_top_container').click() time.sleep(5) self.driver.find_element_by_id( 'cn.xiaochuankeji.tieba:id/topic_title_tv').click() time.sleep(5) self.driver.find_element_by_id( 'cn.xiaochuankeji.tieba:id/try_publish').click() time.sleep(5) a = self.driver.find_element_by_id( 'cn.xiaochuankeji.tieba:id/simple_member_tv_name') self.assertTrue(a.text, 'ad涅米')