Beispiel #1
0
    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)
    def test_edit_offer(self, browser):
        page = TaskPage(browser, offer_dependency_url)
        page.go_to_site()
        page.get_cookies()
        page.check_values_from_table(offer_name)

        assert page.check_edit(SC.OFFER_COMMENT, 'Комментарий')
    def test_create_offer_empty_name(self, browser):
        case_id = 735199
        page = TaskPage(browser, url)
        page.go_to_site()
        page.get_cookies()
        page.click_on_the_button(TotalLocators.BUTTON)
        current_url = browser.current_url
        page.click_on_the_button(TotalLocators.BUTTON)

        assert current_url == browser.current_url, add_result_for_case(
            run_id, case_id, results['failed'])
        add_result_for_case(run_id, case_id, results['passed'])
    def test_remove_type_step_two(self, browser):
        case_id = 735196
        page = TaskPage(browser, url)
        page.go_to_site()
        page.check_values_from_table(type_offer_name)
        page.remove_type_step_two()

        assert page.get_name_from_table() != type_offer_name, add_result_for_case(
            run_id, case_id, results['failed'])
        add_result_for_case(run_id, case_id, results['passed'])
Beispiel #5
0
    def test_check_values_client_segment(self, browser):
        case_id = 890425
        page = TaskPage(browser, url)
        page.go_to_site()
        page.get_cookies()
        page.check_values_from_table(segment_name)

        assert page.check_field_values_from_table(), add_result_for_case(
            run_id, case_id, results['failed'])
        add_result_for_case(run_id, case_id, results['passed'])
    def test_check_values_offer(self, browser):
        case_id = 735198
        page = TaskPage(browser, url)
        page.go_to_site()
        page.get_cookies()
        page.check_values_from_table(type_offer_name)

        assert page.check_field_values_from_table(), add_result_for_case(
            run_id, case_id, results['failed'])
        add_result_for_case(run_id, case_id, results['passed'])
    def test_remove_product_param_step_two(self, browser):
        case_id = 735774
        page = TaskPage(browser, url)
        page.go_to_site()
        page.get_cookies()
        page.remove_type_step_two()

        assert page.get_name_from_table() != param_name, add_result_for_case(
            run_id, case_id, results['failed'])
        add_result_for_case(run_id, case_id, results['passed'])
    def test_remove_product_param_step_one(self, browser):
        case_id = 735773
        page = TaskPage(browser, url)
        page.go_to_site()
        page.get_cookies()
        page.remove_type_step_one()

        assert page.get_remove_flag(), add_result_for_case(
            run_id, case_id, results['failed'])
        add_result_for_case(run_id, case_id, results['passed'])
Beispiel #9
0
 def test_ept_task(self):
     '''
     导出任务成功_验证导出所有任务为excel格式;CRM-ST-BG-006
     :return:
     '''
     # username = "******"
     # password = "******"
     # path='C:/Users/40511/Documents/Downloads/5kcrm_task_2020-03-18_1.xls'
     #
     # #登录
     # 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()
     tp.task_tool_button_click()
     tp.task_export_button_click()
     #提示框点击确认
     sleep(4)
     confirm = Alert(self.driver)
     confirm.accept()
     sleep(4)
     #断言
     print(os.path.exists(EPT_TASK))  #查看是否成功
     self.assertTrue(os.path.exists(EPT_TASK))
     os.remove(EPT_TASK)  #删除数据
Beispiel #10
0
    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()
Beispiel #11
0
    def test_edit_client_segment(self, browser):
        case_id = 890424
        page = TaskPage(browser, url)
        page.go_to_site()
        page.get_cookies()
        page.check_values_from_table(segment_name)

        assert page.check_edit(SC.SEGMENT_COMMENT,
                               'Комментарий'), add_result_for_case(
                                   run_id, case_id, results['failed'])
        add_result_for_case(run_id, case_id, results['passed'])
    def test_edit_offer(self, browser):
        case_id = 735200
        page = TaskPage(browser, url)
        page.go_to_site()
        page.get_cookies()
        page.check_values_from_table(type_offer_name)

        assert page.check_edit(SC.OFFER_COMMENT,
                               'Комментарий'), add_result_for_case(
                                   run_id, case_id, results['failed'])
        add_result_for_case(run_id, case_id, results['passed'])
    def test_create_type_offer_empty_name(self, browser):
        case_id = 735192
        page = TaskPage(browser, url)
        page.go_to_site()
        page.get_cookies()
        page.click_on_the_button(TotalLocators.BUTTON)
        page.click_on_the_button(TotalLocators.BUTTON)

        assert page.check_name_text_error(SC.NAME_ERROR, 'Необходимо заполнить «Имя».'), add_result_for_case(run_id,
                                                                                                             case_id,
                                                                                                             results[
                                                                                                                 'failed'])
        add_result_for_case(run_id, case_id, results['passed'])
Beispiel #14
0
    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()
Beispiel #15
0
    def test_check_values_cache_suggest(self, browser, get_suggestions):
        case_id = 756205
        page = CachePage(browser, url)
        page.go_to_site()
        page.get_cookies()
        page = TaskPage(browser, url)

        assert page.check_field_values_from_table(), add_result_for_case(
            run_id, case_id, results['failed'])
        add_result_for_case(run_id, case_id, results['passed'])
    def test_check_values_product_param(self, browser):
        case_id = 735771
        page = TaskPage(browser, url)
        page.go_to_site()
        page.get_cookies()

        assert page.check_field_values_from_table(), add_result_for_case(
            run_id, case_id, results['failed'])
        add_result_for_case(run_id, case_id, results['passed'])
Beispiel #17
0
def init_web_task():
    driver = webdriver.Chrome()
    driver.maximize_window()
    driver.implicitly_wait(20)
    login_page = LoginPage(driver)
    login_page.login(19915986907, 'yyd19915986907')
    task_page = TaskPage(driver)

    yield driver, task_page

    driver.quit()
Beispiel #18
0
    def test_check_cache(self, browser, get_suggestions):
        case_id = 756201
        page = TaskPage(browser, url)
        page.go_to_site()
        page.get_cookies()

        assert not (page.is_element_present(
            TC.TABLE_EMPTY_BODY)), add_result_for_case(run_id, case_id,
                                                       results['failed'])
        add_result_for_case(run_id, case_id, results['passed'])
    def test_edit_product_param(self, browser):
        case_id = 735772
        page = TaskPage(browser, url)
        page.go_to_site()
        page.get_cookies()

        assert page.check_edit(SC.PARAM_VALUE,
                               'Значение'), add_result_for_case(
                                   run_id, case_id, results['failed'])
        add_result_for_case(run_id, case_id, results['passed'])
Beispiel #20
0
    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()
Beispiel #21
0
    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)
    def test_create_product_param(self, browser):
        case_id = 735769
        page = TaskPage(browser, product_url)
        page.go_to_site()
        page.get_cookies()
        page.click_on_the_button(TotalLocators.LOOK_BUTTON_FROM_TABLE)
        page.click_on_the_button(TotalLocators.CREATE_PARAM_BUTTON)
        page.enter_field(SC.PARAM_VALUE, 120)
        name = page.get_text(SC.OFFER_NAME, SC.PRODUCT_NAME)
        page.click_on_the_button(TotalLocators.BUTTON)

        assert page.check_current_title(name), add_result_for_case(
            run_id, case_id, results['failed'])
        add_result_for_case(run_id, case_id, results['passed'])
    def test_create_product_param_empty_name(self, browser):
        case_id = 735770
        page = TaskPage(browser, product_url)
        page.go_to_site()
        page.get_cookies()
        page.click_on_the_button(TotalLocators.LOOK_BUTTON_FROM_TABLE)
        page.click_on_the_button(TotalLocators.CREATE_PARAM_BUTTON)

        current_url = browser.current_url
        page.click_on_the_button(TotalLocators.BUTTON)

        assert current_url == browser.current_url, add_result_for_case(
            run_id, case_id, results['failed'])
        add_result_for_case(run_id, case_id, results['passed'])
    def test_remove_offer_step_one(self, browser):
        case_id = 735201
        page = TaskPage(browser, url)
        page.go_to_site()
        page.get_cookies()
        page.check_values_from_table(type_offer_name)
        page.remove_type_step_one()

        assert page.get_remove_flag(), add_result_for_case(
            run_id, case_id, results['failed'])
        add_result_for_case(run_id, case_id, results['passed'])
Beispiel #25
0
    def test_remove_client_segment_step_two(self, browser):
        case_id = 890427
        page = TaskPage(browser, url)
        page.go_to_site()
        page.get_cookies()
        page.check_values_from_table(segment_name)
        page.remove_type_step_two()

        assert page.get_name_from_table() != segment_name, add_result_for_case(
            run_id, case_id, results['failed'])
        add_result_for_case(run_id, case_id, results['passed'])
    def test_create_offer(self, browser):
        case_id = 735197
        page = TaskPage(browser, url)
        page.go_to_site()
        page.click_on_the_button(TotalLocators.BUTTON)
        page.enter_field(SC.OFFER_NAME, type_offer_name)
        page.enter_field(SC.OFFER_COMMENT, 'test_comment')
        page.click_on_the_button(SC.OFFER_CONTEXT)
        page.enter_type(SC.OFFER_TYPE, 1)
        page.enter_date(SC.OFFER_START_DATE, start_date)
        page.enter_date(SC.OFFER_FINISH_DATE, end_date)
        page.click_on_the_button(TotalLocators.BUTTON)

        assert page.check_current_title(type_offer_name), add_result_for_case(
            run_id, case_id, results['failed'])
        add_result_for_case(run_id, case_id, results['passed'])
    def create_offer(self, browser):
        page = TaskPage(browser, offer_url)
        page.go_to_site()
        page.get_cookies()
        page.click_on_the_button(TotalLocators.BUTTON)
        page.enter_field(SC.OFFER_NAME, offer_name)
        page.enter_field(SC.OFFER_COMMENT, 'test_comment')
        page.click_on_the_button(SC.OFFER_CONTEXT)
        page.enter_type(SC.OFFER_TYPE, 1)
        page.enter_date(SC.OFFER_START_DATE, start_date)
        page.enter_date(SC.OFFER_FINISH_DATE, end_date)
        page.click_on_the_button(TotalLocators.BUTTON)

        assert page.check_current_title(offer_name)
Beispiel #28
0
 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
Beispiel #29
0
    def test_create_client_segment(self, browser):
        case_id = 890422
        page = TaskPage(browser, url)
        page.go_to_site()
        page.click_on_the_button(TotalLocators.BUTTON)
        page.enter_field(SC.SEGMENT_NAME, segment_name)
        page.enter_field(SC.SEGMENT_COMMENT, "test_comment")
        page.click_on_the_button(TotalLocators.BUTTON)

        assert page.check_current_title(segment_name), add_result_for_case(
            run_id, case_id, results['failed'])
        add_result_for_case(run_id, case_id, results['passed'])
    def test_create_offer_dependency(self, browser):
        case_id = 735322
        page = TaskPage(browser, offer_dependency_url)
        page.go_to_site()
        page.get_cookies()
        page.click_on_the_button(TotalLocators.BUTTON)
        page.enter_type_of_value(OD.OFFER, offer_name)
        page.enter_type_of_value(OD.PRODUCT, 'КЕНО')
        page.click_on_the_button(TotalLocators.BUTTON)

        assert page.check_current_title(offer_name), add_result_for_case(
            run_id, case_id, results['failed'])
        add_result_for_case(run_id, case_id, results['passed'])