def test_CJQ_0001(self): """创建群,并发起群聊""" # 1.进入创建群首页 Preconditions.enter_create_group_page() cgp = CreateGroupPage() # 2.点击马上创建群 cgp.click_create_group() sccp = SelectCompanyContactsPage() sccp.wait_for_page_load() # 3.添加企业联系人 sccp.click_contacts_by_name("大佬1") sccp.click_contacts_by_name("大佬2") # 4.点击确认 sccp.click_sure_button() # 5.输入企业群名 cgp.input_group_name("企业群创建测试1") # 6.点击马上创建群 cgp.click_create_group() time.sleep(1) # 7.点击发起群聊 cgp.click_initiate_group_chat() time.sleep(1) # 8.判断是否在群聊页面 gcp = GroupChatPage() self.assertEqual(gcp.is_on_this_page(), True) time.sleep(1)
def get_into_group_chat_page(name): """进入群聊聊天会话页面""" mp = MessagePage() mp.wait_for_page_load() # 点击 + mp.click_add_icon() # 点击发起群聊 mp.click_group_chat() scg = SelectContactsPage() scg.wait_for_page_load() scg.click_select_one_group() sog = SelectOneGroupPage() # 等待“选择一个群”页面加载 sog.wait_for_page_load() # 选择一个普通群 sog.selecting_one_group_by_name(name) gcp = GroupChatPage() gcp.wait_for_page_load()
def get_into_enterprise_group_chat_page(): """进入企业群聊天会话页面 返回群名""" mp = MessagePage() mp.wait_for_page_load() # 点击 + mp.click_add_icon() # 点击发起群聊 mp.click_group_chat() scg = SelectContactsPage() scg.wait_for_page_load() scg.click_select_one_group() sog = SelectOneGroupPage() # 等待“选择一个群”页面加载 sog.wait_for_page_load() # 选择一个企业群 name = sog.select_one_enterprise_group() gcp = GroupChatPage() gcp.wait_for_page_load() return name
def test_CJQ_0002(self): """发送群消息""" wbp = WorkbenchPage() wbp.wait_for_workbench_page_load() # 1.进入消息页面,进入指定群名企业群 wbp.click_message_icon() Preconditions.get_into_group_chat_page("测试企业群") gcp = GroupChatPage() # 2.输入发送信息 gcp.input_message('大家好,这里是测试消息') # 3.点击发送 gcp.send_message() # 4.验证是否发送成功 gcp.wait_for_msg_send_status_become_to('发送成功', 30)
def tearDown_test_CJQ_0001(): """解散企业群""" try: gcp = GroupChatPage() gcp.wait_for_page_load() # 1.点击设置 gcp.click_setting() gcsp = GroupChatSetPage() gcsp.wait_for_page_load() # 2.点击“—”移除成员 for i in range(2): gcsp.click_delete_member() # 3.选择成员 time.sleep(1) gcsp.click_first_group_member_avatar() time.sleep(1) # 4.点击确定移除 gcsp.click_delete_member_sure() time.sleep(1) gcsp.click_sure() time.sleep(1) # 5.返回群聊页面 gcsp.click_back() except: pass