示例#1
0
class DiscussLog(BaseCase):
    '''
    评论下属日志
    '''
    @ddt.data(*get_data_from_csv("log_discuss_datas.csv"))
    @ddt.unpack
    def test_discuss_log(self, logtitle, contenttext, discusstype):
        '''
        评论下属日志成功_验证输入所有项合法;CRM-ST-BG-017
        :return:
        '''
        #登录
        # username = "******"
        # password = '******'
        # logtitle = '2020-03-19 工作日志'
        # contenttext ='很好'
        # discusstype ='站内信'
        #
        # lp = LoginPage(self.driver)
        # lp.open()
        # lp.login(username,password)
        # sleep(3)
        # #去到日志页面
        # ip = IndexPage(self.driver)
        # ip.more_button_click()
        # ip.log_button_click()
        #在日志页面
        sleep(4)
        lgp = LogPage(self.driver, LOG_URL)
        lgp.open()
        #点击查看下属日志
        lgp.sub_button_click()
        sleep(4)
        lgp.look_log_click(logtitle)
        #去到下属日志详情页面
        sleep(4)
        #评论日志
        dlp = DetailLogPage(self.driver)
        dlp.discuss_click()
        sleep(4)
        dlp.discuss_content_send(contenttext)
        sleep(2)
        #选择通知方式
        dlp.discuss_type_click(discusstype)
        sleep(2)
        #确认
        dlp.ok_click()
        sleep(2)
        #断言
        text = dlp.success_get()
        self.assertIn('添加评论成功', text)


# if __name__ == '__main__':
#     unittest.main()
示例#2
0
class SeaTask(BaseCase):
    '''
    搜索任务功能
    '''
    @ddt.data(*get_data_from_csv('task_search_datas.csv'))
    @ddt.unpack
    def test_sea_task(self, visible_text_one, visible_text_two,
                      visible_text_thr):
        '''
        搜索统计任务成功_搜索条件所有项合法;CRM-ST-BG-007
        :return:
        '''
        # username = "******"
        # password = "******"
        # visible_text_one="任务主题"
        # visible_text_two='包含'
        # visible_text_thr='任务'
        # #登录
        # lp = LoginPage(self.driver)
        # lp.open()
        # lp.login(username,password)
        # #去到任务页面
        # sleep(4)
        # ip = IndexPage(self.driver)
        # ip.task_button_click()
        #去到任务搜索页面
        sleep(4)
        tp = TaskPage(self.driver, TASK_URL)
        tp.open()
        #指定搜索
        sleep(4)
        #指定第一个下拉框
        tp.sea_one_select(visible_text_one)
        sleep(4)
        # 指定第二个下拉框
        tp.sea_two_select(visible_text_two)
        sleep(4)
        #指定第三个搜索条件
        tp.sea_thr_send(visible_text_thr)
        sleep(4)
        #点击搜索
        tp.sea_click()
        sleep(4)
        #断言
        text = tp.task_title_get()
        logger.info(text)
        for i in text:
            logger.info(i)
            self.assertIn(visible_text_thr, i)
            continue
示例#3
0
class AddKnow(BaseCase):
    '''
    添加知识
    '''
    @ddt.data(*get_data_from_csv('know_add_datas.csv'))
    @ddt.unpack
    def test_add_know(self,know_title,know_text,know_content):
        '''
        添加知识成功_验证输入所有项合法;CRM-ST-BG-014
        :return:
        '''
        # username = "******"
        # password = "******"
        # know_title="知识7"
        # know_text ='知识分类2'
        # know_content ='知识'
        # 登录
        # sleep(4)
        # lp = LoginPage(self.driver)
        # sleep(2)
        # lp.open()
        # lp.login(username, password)
        # sleep(2)
        # # 去知识页面
        # ip = IndexPage(self.driver)
        # ip.know_button_click()
        #去到添加知识页面
        kp = KnowPage(self.driver, KNOW_URL)
        kp.open()
        kp.add_know_button_click()
        #添加知识内容
        sleep(3)
        ap = AddKnowPage(self.driver)
        sleep(3)
        ap.know_title_send(know_title)
        sleep(3)
        ap.know_select(know_text)
        sleep(3)
        ap.know_content_send(know_content)
        sleep(3)
        ap.know_ok_click()
        sleep(3)
        #断言
        text = kp.add_know_mark_get()
        self.assertIn('添加成功',text)

# if __name__ == '__main__':
#     unittest.main()
示例#4
0
class AddLog(BaseCase):
    '''
    添加日志
    '''
    @ddt.data(*get_data_from_csv("log_add_datas.csv"))
    @ddt.unpack
    def test_add_log(self, logtitle, types, logconten):
        '''
        新建日志成功_验证输入所有项合法;CRM-ST-BG-018
        :return:
        '''
        #登录
        # username = "******"
        # password = '******'
        # logtitle = '劳动日志'
        # types='周报'
        # logconten='劳动'
        # lp = LoginPage(self.driver)
        # lp.open()
        # lp.login(username,password)
        # sleep(3)
        # #去到日志页面
        # ip = IndexPage(self.driver)
        # ip.more_button_click()
        # ip.log_button_click()
        #去到添加日志页面

        sleep(4)
        lgp = LogPage(self.driver, LOG_URL)
        lgp.open()
        lgp.add_log_button_click()
        #添加日志内容
        sleep(2)
        ap = AddLogPage(self.driver)
        ap.add_log_title_send(logtitle)
        sleep(3)
        #勾选日志类型
        ap.log_type_click(types)
        sleep(3)
        #输入日志内容
        ap.log_content_send(logconten)
        sleep(3)
        #保存
        ap.log_save_click()
        sleep(3)
        #断言
        text = lgp.add_log_success_get()
        self.assertIn('添加日志成功', text)
示例#5
0
class SeaLog(BaseCase):
    '''
    搜索日志
    '''

    @ddt.data(*get_data_from_csv("log_sea_datas.csv"))
    @ddt.unpack
    def test_search_log(self,visible_text_one,visible_text_two,visible_text_thr):
        '''
        搜索日志成功_验证通过内容搜索;CRM-ST-BG-019
        :return:
        '''
        #登录
        # username = "******"
        # password = '******'
        # visible_text_one='标题'
        # visible_text_two='包含'
        # visible_text_thr='工作'
        #
        # lp = LoginPage(self.driver)
        # lp.open()
        # lp.login(username,password)
        # sleep(3)
        # #去到日志页面
        # ip = IndexPage(self.driver)
        # ip.more_button_click()
        # sleep(3)
        # ip.log_button_click()
        #去到添加日志页面
        sleep(4)
        lgp = LogPage(self.driver, LOG_URL)
        lgp.open()
        # 指定第一个下拉框
        lgp.sea_one_select(visible_text_one)
        sleep(4)
        # 指定第二个下拉框
        lgp.sea_two_select(visible_text_two)
        sleep(4)
        # 指定第三个搜索条件
        lgp.sea_thr_send(visible_text_thr)
        sleep(4)
        # 点击搜索
        lgp.sea_click()
        sleep(4)
        # 断言
        text = lgp.get_log_title()
        for i in text:
            self.assertIn(visible_text_thr,i)
示例#6
0
class AddNotice(BaseCase):
    '''
    公告管理
    '''
    @ddt.data(*get_data_from_csv("notice_add_datas.csv"))
    @ddt.unpack
    def test_add_notice(self, title):
        '''
        添加公告管理;CRM-ST-BG-020
        :return:
        '''
        #登录
        # username = "******"
        # password = "******"
        # title = "公告"
        # lp = LoginPage(self.driver)
        # lp.open()
        # lp.login(username,password)
        # #去到公告管理页面
        # sleep(3)
        # ip = IndexPage(self.driver)
        # ip.username_click()
        # sleep(3)
        # ip.notice_click()
        # sleep(3)
        #去到添加公告管理页面
        np = NoticePage(self.driver, NOTICE_URL)
        np.open()
        np.add_notice_button_click()
        sleep(3)
        #添加公告内容
        ap = AddNoticePage(self.driver)
        ap.notice_title_send(title)
        ap.notice_save_click()
        sleep(3)
        #断言
        text = np.notice_title_get()
        logger.info(text)
        self.assertIn(title, text)
示例#7
0
class RecTask(BaseCase):
    '''
    还原任务
    '''

    @ddt.data(*get_data_from_csv('task_del_datas .csv'))
    @ddt.unpack
    def test_rec_task(self,tasktitle):
        '''
        还原任务_通过回收站还原任务;CRM-ST-BG-004
        :return:
        '''
        # username = "******"
        # password = "******"
        # rec_title = "任务二"
        # #登录
        # sleep(4)
        # lp = LoginPage(self.driver)
        # lp.open()
        # lp.login(username, password)
        # sleep(2)
        # #去任务页面
        # ip = IndexPage(self.driver)
        # ip.task_button_click()
        # 去回收站页面
        tp = TaskPage(self.driver, TASK_URL)
        tp.open()
        tp.task_rec_button_click()
        sleep(7)
        #还原被删除的任务
        rp = RecTaskPage(self.driver)
        rp.task_rec_title_click(tasktitle)
        #断言
        sleep(4)
        text = rp.task_rec_mesg_get()
        self.assertIn('还原成功',text)

# if __name__ == '__main__':
#     unittest.main()
示例#8
0
class CloTask(BaseCase):
    '''
    关闭任务
    '''

    @ddt.data(*get_data_from_csv('task_clo_datas.csv'))
    @ddt.unpack
    def test_close_task(self,tasktitle):
        '''
        还原任务_通过回收站关闭任务;CRM-ST-BG-005
        :return:
        '''
        # username = "******"
        # password = "******"
        # tasktitle = "主题"
        # # 登录
        # sleep(4)
        # lp = LoginPage(self.driver)
        # lp.open()
        # lp.login(username, password)
        # sleep(2)
        # # 去任务页面
        # ip = IndexPage(self.driver)
        # ip.task_button_click()
        # 在任务页面页面
        tp = TaskPage(self.driver, TASK_URL)
        tp.open()
        #关闭任务
        sleep(10)
        tp.task_close_click(tasktitle)
        # 断言
        sleep(4)
        text = tp.task_mesg_get()
        self.assertIn('已成功关闭', text)


# if __name__ == '__main__':
#     unittest.main()
示例#9
0
class DelKnow(BaseCase):
    '''
    删除知识
    '''
    @ddt.data(*get_data_from_csv('know_del_datas.csv'))
    @ddt.unpack
    def test_del_know(self, title):
        '''
        删除知识成功_验证指定知识标题进行删除;CRM-ST-BG-016
        :return:
        '''
        # username = "******"
        # password = "******"
        # title = '123'
        # # 登录
        # sleep(4)
        # lp = LoginPage(self.driver)
        # sleep(2)
        # lp.open()
        # lp.login(username, password)
        #
        # # 去知识页面
        # sleep(3)
        # ip = IndexPage(self.driver)
        # ip.know_button_click()
        # sleep(6)
        #在知识页面
        kp = KnowPage(self.driver, KNOW_URL)
        kp.open()
        kp.get_title_click(title)
        kp.know_del_click()
        #确认删除
        sleep(3)
        confirm = Alert(self.driver)
        confirm.accept()
        #断言
        text = kp.get_know_title()
        self.assertNotIn(title, text)
示例#10
0
class DelTask(BaseCase):
    '''
    删除任务、取消删除功能
    '''
    @ddt.data(*get_data_from_csv('task_del_datas .csv'))
    @ddt.unpack
    def test_del_task(self, title):
        '''
        删除任务成功_验证单选第一条进行删除;CRM-ST-BG-002
        :return:
        '''
        # username = "******"
        # password = "******"
        # tasktitle="任务二"
        #
        # #登录
        # lp = LoginPage(self.driver)
        # lp.open()
        # lp.login(username,password)
        # #去任务页面
        # ip = IndexPage(self.driver)
        # ip.task_button_click()
        #查找指定任务进行删除
        sleep(3)
        tp = TaskPage(self.driver, TASK_URL)
        tp.open()
        sleep(3)
        tp.task_title_click(title)
        sleep(3)
        tp.task_delate_button_click()
        sleep(3)
        #删除弹框确认

        confirm = Alert(self.driver)
        confirm.accept()
        sleep(3)
        self.driver.refresh()
        sleep(2)
        #断言
        text = tp.task_title_get()
        logger.info(text)
        self.assertNotIn(title, text)

    @ddt.data(*get_data_from_csv('task_canceldel_datas .csv'))
    @ddt.unpack
    def test_candel_task(self, title):
        '''
        取消删除任务成功_验证单选第一条进行删除;CRM-ST-BG-003
        :return:
        '''
        # username = "******"
        # password = "******"
        # tasktitle="任务二"

        #登录
        # lp = LoginPage(self.driver)
        # lp.open()
        # lp.login(username,password)
        # #去任务页面
        # ip = IndexPage(self.driver)
        # ip.task_button_click()
        # #查找指定任务进行删除

        sleep(3)
        tp = TaskPage(self.driver, TASK_URL)
        tp.open()
        tp.task_title_click(title)
        sleep(3)
        tp.task_delate_button_click()
        sleep(3)
        #删除弹框确认
        confirm = Alert(self.driver)
        confirm.dismiss()
        sleep(3)
        #断言
        text = tp.task_title_get()
        logger.info(text)
        self.assertIn(title, text)
示例#11
0
class DelNotice(BaseCase):
    '''
    删除公告管理
    '''
    @ddt.data(*get_data_from_csv("notice_add_datas.csv"))
    @ddt.unpack
    def test_del_notice(self, title):
        '''
        删除公告管理;CRM-ST-BG-022
        :return:
        '''
        #登录
        # username = "******"
        # password = "******"
        # noticetitle = "公告2"
        # lp = LoginPage(self.driver)
        # lp.open()
        # lp.login(username,password)
        # #去到公告管理页面
        # sleep(3)
        # ip = IndexPage(self.driver)
        # ip.username_click()
        # sleep(3)
        # ip.notice_click()
        sleep(3)
        #删除公告
        np = NoticePage(self.driver, NOTICE_URL)
        np.open()
        np.notice_del(title)
        np.notice_del_button_click()
        #确认删除
        sleep(3)
        confirm = Alert(self.driver)
        confirm.accept()

        #断言
        text = np.notice_title_get()
        logger.info(text)
        self.assertNotIn(title, text)

        def test_candel_notice(self):
            '''
            取消删除公告管理;CRM-ST-BG-021
            :return:
            '''
            # 登录
            username = "******"
            password = "******"
            noticetitle = "公告"
            lp = LoginPage(self.driver)
            lp.open()
            lp.login(username, password)
            # 去到公告管理页面
            sleep(3)
            ip = IndexPage(self.driver)
            ip.username_click()
            sleep(3)
            ip.notice_click()
            sleep(3)
            # 删除公告
            np = NoticePage(self.driver)
            np.notice_del(noticetitle)
            np.notice_del_button_click()
            # 确认删除
            sleep(3)
            confirm = Alert(self.driver)
            confirm.dismiss()

            # 断言
            text = np.notice_title_get()
            logger.info(text)
            self.asserttIn(noticetitle, text)
示例#12
0
class Addtask(BaseCase):
    # 添加任务

    # 导入任务必填项数据
    @ddt.data(*get_data_from_csv('task_add_datas.csv'))
    @ddt.unpack
    def test_add_task(self,title):
        '''
        添加任务成功_验证必填项;CRM-ST-BG-001
        :return:
        '''
        # username = "******"
        # password = "******"
        # title = "主题3"
        #登录
        # sleep(4)
        # lp = LoginPage(self.driver)
        # lp.open()
        # lp.login(username, password)
        # sleep(2)
        # #去任务页面
        # ip = IndexPage(self.driver)
        # ip.task_button_click()
        sleep(2)
        #去添加任务页面
        tp = TaskPage(self.driver,TASK_URL)
        tp.open()
        tp.task_add_button_click()
        sleep(4)
        #添加任务内容
        ap = Addtaskpage(self.driver)

        ap.task_title_click(title)

        ap.task_owner_click()
        sleep(4)
        ap.task_all_click()
        sleep(2)
        ap.task_ok_click()
        sleep(2)
        ap.save_click()
        sleep(2)
        #判断是否成功
        text = tp.task_title_get()
        self.assertIn(title,text)
        mesg = tp.task_mesg_get()
        logger.info(mesg)
        self.assertIn("添加成功",mesg)

    @ddt.data(*get_data_from_csv('task_addall_datas.csv'))
    @ddt.unpack
    def a_test_alladd_task(self,title,roles,apartment):
        '''
        添加任务成功_验证输入所有项合法;CRM-ST-BG-008
        :return:
        '''
        # username = "******"
        # password = "******"
        # title = "主题二"
        # roles = 'admin4【CEO】'
        # apartment = '办公室'
        #登录
        # sleep(4)
        # lp = LoginPage(self.driver)
        #
        # lp.open()
        # lp.login(username, password)
        # sleep(2)
        # #去任务页面
        # ip = IndexPage(self.driver)
        # ip.task_button_click()
        # sleep(2)
        #去添加任务页面
        tp = TaskPage(self.driver, TASK_URL)
        tp.open()
        tp.task_add_button_click()
        sleep(4)
        #添加任务内容
        ap = Addtaskpage(self.driver)

        ap.task_title_click(title)
        #添加负责人
        ap.task_owner_click()
        sleep(4)
        ap.task_all_click()
        sleep(2)
        ap.task_ok_click()
        sleep(10)
        #点击任务相关人
        ap.task_role_click()
        sleep(5)
        #选择部门
        ap.task_apartment_click(apartment)
        #选择任务相关人
        ap.task_check_role_click(roles)
        sleep(2)
        #确认
        ap.task_role_ok_click()
        sleep(2)
        #保存
        ap.save_click()
        sleep(2)
        #判断是否成功
        text = tp.task_title_get()
        self.assertIn(title,text)
        mesg = tp.task_mesg_get()
        logger.info(mesg)
        self.assertIn("添加成功",mesg)

# if __name__ == '__main__':
#     unittest.main()