def setUp(self): self.driver = brower() login = LoginPage(self.driver) login.login() choose = ChoosePage(self.driver) time.sleep(2) choose.click_menu_bt('17')
def setUp(self): self.driver = brower() login = LoginPage(self.driver) login.login() choose = ChoosePage(self.driver) choose.click_menu_bt('20') self.conn, self.cur = DatabaseOperation().openconnect()
def setUp(self): self.driver = brower() object = LoginPage(self.driver) object.login() object = ChoosePage(self.driver) object.click_menu_bt('22')
def test_004_meeting_addquesluckydraw(self): """设置问卷和抽奖""" t.deprint("开始执行添加问卷和抽奖的直播会议的用例4") dr = brower() o = LoginPage(dr) o.login() o = ChoosePage(dr) o.click_menu_bt('9') time.sleep(5) o = Webinar_IndexPage(dr) o.webinar_list() o.choose_meeting() time.sleep(3) interact = InteractionSetting(dr) current_handle = interact.interaction_setting() time.sleep(2) interact.create_questionnar() newquestion = NewQuestionnairePage(dr) newquestion.creat_new_questionnaire() newquestion.edit_questionnaire_subject() interact.click_refresh(current_handle) time.sleep(2) acture_result = interact.create_luckydraw() except_result = "抽奖添加成功" # wbr = Webinar_Create(dr) # wbr.cancel_meeting() self.assertEqual(acture_result, except_result, "fail") # self.assertTupleEqual(acture_result,except_result,"fail") t.deprint("用例4执行完成")
def test_003_meeting_addtag(self): """设置嘉宾日程及会议标签""" t.deprint("开始执行添加嘉宾和日程及会议标签的直播会议的用例3") dr = brower() o = LoginPage(dr) o.login() o = ChoosePage(dr) o.click_menu_bt('9') time.sleep(5) gguestnum = Get_Guestnum(dr) guestnum = int(gguestnum.get_num()) # 获取嘉宾管理的嘉宾个数 o = Webinar_IndexPage(dr) o.webinar_list() # 进入直播会议列表 wbr = Webinar_Create(dr) wbr.return_meeting() # 进入直播会议回收站还原会议 o.webinar_list() # 进入直播会议列表 time.sleep(3) o.choose_meeting() # 选择一场直播中的会议 wbr_seting = Webcast_Setting(dr) wbr_seting.into_baseinfo() # 进入会议详情的基础设置页面 wbr_seting.edit_baseinfo() # 编辑会议的基本信息 actual_result1 = wbr_seting.add_guest(guestnum) # 添加会议嘉宾 # self.assertEqual('嘉宾信息成功',actual_result1,msg='failed') # time.sleep(2) actual_result2 = wbr_seting.add_agenda() # 添加会议日程 print actual_result2 self.assertEqual(actual_result2, u'添加会议日程成功', msg='failed') wbr_seting.quit()
def test_003_createoffline(self): """ 测试删除线下会 """ base.deprint("开始执行登录,并进入删除线下会用例") dr = self.driver o = LoginPage(dr) o.login() o = ChoosePage(dr) o.click_menu_bt('10') o = IndexPage(dr) o.click_linelist('2') object = InteractionAndCancle(dr) actual_result = object.interaction_and_cancle('2') expected_result = u'取消会议成功' self.assertEqual(actual_result, expected_result, msg="failed") base.deprint("删除线下会用例完成")
def test_002_interaction(self): """ 添加互动环节""" base.deprint("开始执行登录,并进入添加线下会互动环节用例") dr = self.driver o = LoginPage(dr) o.login() o = ChoosePage(dr) o.click_menu_bt('10') o = IndexPage(dr) o.click_linelist('2') o = InteractionAndCancle(dr) acture_result=o.interaction_and_cancle('1') excepet_result="已添加互动环节" # self.assertEqual(acture_result,excepet_result,"failed") base.deprint( "添加线下会互动环节添加用例完成")
def test_005_meeting_indexpage(self): """进入直播专题页""" t.deprint("开始执行进入直播会场的用例5") dr = brower() o = LoginPage(dr) o.login() o = ChoosePage(dr) o.click_menu_bt('9') time.sleep(5) o = Webinar_IndexPage(dr) o.webinar_list() # 进入直播会议的列表 vtitle = o.choose_meeting() # 获取一场直播中会议的会议标题 time.sleep(3) index = Webinar_Webcast(dr) actual_result1 = index.into_webcast(vtitle) # 进入直播会议会场,并验证会议标题 self.assertEqual(actual_result1, u'进入直播会场成功', msg='failed') index.quit()
def test_001_loginoffline(self): #下面一句的文字,是通过Python的一种注释doc string,用于函数、类和方法的描述,HTMLTestRunner可以读取此类型注释 """ 测试创建线下会 """ base.deprint("开始执行登录,并进入线下会用例") dr = self.driver object = LoginPage(dr) object.login() object = ChoosePage(dr) object.click_menu_bt('10') object = IndexPage(dr) object.click_createunderline() object = NewMeetingPage(dr) actual_result = object.create_neww_offline() expected_result = u'线下会创建成功' self.assertEqual(actual_result, expected_result, msg="failed") base.deprint("创建线下会页面用例执行完成")
def test_001_webinar_create_cancel(self): """创建并取消会议""" t.deprint("开始执行线上会创建后取消的用例1") dr = brower() o = LoginPage(dr) o.login() o = ChoosePage(dr) o.click_menu_bt('10') time.sleep(5) o = Webinar_IndexPage(dr) time.sleep(3) o.index_webinar() # 进入线上会首页 o.index_create() # 点击首页的创建会议按钮 wbr = Webinar_Create(dr) wbr.create_meeting() # 创建线上会直播会议 actual_result = wbr.cancel_meeting() # 取消此会议 self.assertEqual(actual_result, u'会议取消成功', msg='failed') o.quit()
def test_002_webinar_publish_cancel(self): """创建发布并取消会议""" t.deprint("开始执行线上会创建后发布并取消的用例2") dr = brower() o = LoginPage(dr) o.login() o = ChoosePage(dr) o.click_menu_bt('9') time.sleep(5) o = Webinar_IndexPage(dr) time.sleep(3) o.webinar_list() # 进入线上会直播会议列表 o.list_create() # 点击线上会直播列表的创建会议按钮 wbr = Webinar_Create(dr) wbr.create_meeting() # 创建直播会议 actual_result = wbr.publish_meeting() # 发布本会议 self.assertEqual(actual_result, u'会议发布成功', msg='failed') actual_result1 = wbr.cancel_meeting() # 取消本会议 self.assertEqual(actual_result1, u'会议取消成功', msg='failed') o.quit()
str2 = self.find_element_text( 'x', '/html/body/div[1]/div[2]/main/div/div[2]/div[2]/nav/div/span[2]' ) afterDeleteTotalNum = str2.split("共")[1].split("条")[0] if int(totalNum) == (int(afterDeleteTotalNum) + 1): self.deprint('试题删除成功') text = "试题删除成功" else: self.deprint('试题删除失败') text = "试题删除失败" return text except: self.deprint("用例执行失败") text = "用例执行失败" return text if __name__ == '__main__': dr = brower() object = LoginPage(dr) object.login() object = ChoosePage(dr) object.click_menu_bt('11') object = QuestionnaireListPage(dr) object.open_questionBank() object = QuestionBankManagement(dr) object.create_question() object.delete_question() object.quit()
self.driver.switch_to.window(self.driver.window_handles[-1]) # 获取下一个窗口句柄,跳转 self.wait_is_visible('css','#g-right > div > div.clearfix.ng-scope > div.contact-stats-box.w715 > div.event-stats-l > div > button') #点击创建会议 self.driver.implicitly_wait(30) self.deprint("点击创建会议完成") #点击会议列表菜单 def click_linelist(self,list_pos): self.deprint("点击会议列表") self.driver.implicitly_wait(10) css_path = "/html/body/div[2]/div[1]/ul/li[" + str(list_pos) + "]/h2/a" #点击会议列表 self.wait_is_visible('x', css_path) self.driver.refresh() self.deprint("点击第一场会议") self.driver.implicitly_wait(30) self.wait_is_visible('x','//*[@id="g-right"]/div/div[3]/table/tbody/tr[1]/td[2]/a') #点击第一场会议 self.driver.implicitly_wait(30) if __name__ == '__main__': dr = brower() o = LoginPage(dr) o.login() o = ChoosePage(dr) time.sleep(3) o.click_menu_bt('9') o = IndexPage(dr) #o.click_linelist() o.click_linelist('2') o.quit()
#打开新建问卷 def open_create_questionnaire(self): # self.driver.switch_to.window(self.driver.window_handles[-1]) #不要加这句话,在进入问卷的时候一句切换过句柄,再次切换回导致按钮点击不了,应该是句柄不对了 try: self.deprint("开始点击新建问卷") time.sleep(2) self.wait_is_visible( 'x', '/html/body/div[1]/div[2]/main/div/div[1]/div/div[2]/div/div[2]/a' ) #点击新建问卷的按钮 self.deprint("点击新建问卷按钮成功") except: try: self.deprint("开始点击新建问卷") time.sleep(2) self.wait_is_visible( 'x', '/html/body/div[1]/div[2]/main/div/div[1]/div/div[2]/div/div[2]/a' ) #点击新建问卷的按钮 self.deprint("点击新建问卷按钮成功") except: self.deprint("点击新建问卷按钮失败") if __name__ == '__main__': self.driver = brower() object = LoginPage(self.driver) object.login() object = ChoosePage(self.driver) object.click_menu_bt('11')
time.sleep(20) tips = self.find_element_text('x', '//*[@id="spansyncfuns"]') if '本次共同步素材数据' in tips: self.deprint("同步微信素材用例执行完成") return u'同步素材数据成功' except: self.deprint("用例执行失败,重试一次") self.deprint("开始执行同步微信素材用例") self.wait_is_visible('x', '//*[@id="ul-nav-2"]/li[1]/a') # 点击素材管理菜单 time.sleep(3) self.scrollbar("bottom") self.wait_is_visible('x', '// *[ @ id = "spansyncfuns"]') # 点击同步微信素材 time.sleep(20) tips = self.find_element_text('x', '//*[@id="spansyncfuns"]') if '本次共同步素材数据' in tips: self.deprint("同步微信素材用例执行完成") return u'同步微信素材成功' else: self.deprint("同步微信素材失败") if __name__ == '__main__': driver = brower() login = LoginPage(driver) login.login() chooseP = ChoosePage(driver) chooseP.click_menu_bt("1") syn = Syn_materials(driver) result = syn.syn_materials()