Exemplo n.º 1
0
 def test_save_new_btn_case(self):
     '''保存并新建按钮'''
     menu3 = '按钮控件_保存并复制和新建'
     self.open_menu3(menu3)
     lp = ListViewPage(self.driver)
     if 0 != lp.get_rows_total():
         lp.clear_all_data()
     btn = ButtonPage(self.driver)
     btn.click_button(btn.new_btn)  #点击新建按钮
     lp.wait_loading_hide()  # 等待loading消失
     ip = InputPage(self.driver, '单行文本')
     ip.element.send_keys('保存')
     btn.click_button(btn.save_new)  #点击保存并新建按钮
     self.assertEqual('[保存成功]', lp.get_msg(), msg='保存并新建按钮检验不通过')
     lp.wait_loading_hide()  #等待loading消失
     time.sleep(10)
     ip2 = InputPage(self.driver, '单行文本')
     ip2.element.send_keys('保存')
     btn.click_button(btn.save)
     lp.wait_loading_hide()  # 等待loading消失
     time.sleep(10)
     btn.click_button(btn.to_return)
     if (lp.is_alert_present()):
         lp.accept_alert()
     lp.wait_loading_hide()  #等待loading消失
     self.assertEqual(2, lp.get_rows_total(), msg='保存并新建按钮检验不通过')
     lp.clear_all_data()
Exemplo n.º 2
0
 def delete_all_data(self):
     '''清空所有数据'''
     bp = ButtonPage(self.driver)
     self.find_elem('.listDataThFirstTd').click()
     bp.click_button(bp.del_btn)
     self.click_alert_accept()
     self.wait_loading_hide()
 def test_adjustment_process_case(self):
     '''前台手动调整流程'''
     name = '前台手动调整流程'
     comp = ProcessApproverPage(self.driver)
     btn = ButtonPage(self.driver)
     #判断是否要删除记录
     lp = ListViewPage(self.driver)
     lp.judge_delete(name)
     #点击新建进入表单
     comp.click_newbtn()
     #录入请假原因
     #time.sleep(0.5)
     comp.input_reason(name)
     #点击保存并启动按钮
     comp.click_starprocessbtn()
     #time.sleep(0.5)
     self.assertTrue(btn.is_button_visiable('流程调整'), msg=name + "检验不通过")
     lp.wait_loading_hide()  # 等待视图加载
     #点击前台流程调整按钮
     comp.click_editFlowbtn()
     #回到主文档,没有iframe
     self.driver.switch_to.default_content()
     #获取弹出框的title
     text = comp.get_popuptitle()
     self.assertEqual("调整流程", text, msg=name + "检验不通过")
     mp = MainPage(self.driver)
     mp.switch_to_div_iframe()
     self.assertTrue(comp.is_embed_visit(), msg=name + "检验不通过")
    def test_delete_case(self):
        '''删除按钮'''
        menu3 = '按钮_case001'
        self.open_menu3(menu3)  #打开菜单

        lp = ListViewPage(self.driver)
        if 0 != lp.get_rows_total():
            lp.clear_all_data()  #清空所有数据

        #新建一条数据
        btn = ButtonPage(self.driver)
        btn.click_button(btn.new_btn)
        #time.sleep(0.5)
        ip = InputPage(self.driver, '单行文本')
        ip.element.send_keys('保存')
        btn.click_button(btn.save_start)
        lp.wait_Tabloading_show_then_hide()  #等待loading消失
        btn.click_button(btn.to_return)
        lp.wait_loading_hide()  #表单中
        lp.wait_loading_hide()  #视图中
        #确定已经有一条数据
        self.assertEqual(1, lp.get_rows_total(), msg='删除按钮检验不通过')
        lp.click_select_all()  #点击全选
        btn.click_button(btn.del_btn)  #点击删除
        lp.click_alert_accept()  #确定确认框
        lp.wait_loading_hide()  # 等待loading消失
        #确定数据条数为0
        self.assertEqual(0, lp.get_rows_total(), msg='删除按钮检验不通过')
Exemplo n.º 5
0
 def test_flow_start_user_appoint_btn(self):
     '''流程启动用户指定按钮'''
     menu3 = '表单按钮_流程相关'
     Process_approver = ProcessApproverPage(self.driver)
     Process_approver.close_message()
     self.open_menu3(menu3)
     #清数据
     lp = ListViewPage(self.driver)
     if 0 != lp.get_rows_total():
         lp.clear_all_data()
     #新建记录
     btn = ButtonPage(self.driver)
     btn.click_button(btn.new_btn)
     #time.sleep(0.5)
     ip = InputPage(self.driver, '单行文本')
     ip.element.send_keys('保存')
     #点击流程启动用户指定按钮
     btn.click_button(btn.flow_start)
     #time.sleep(0.5)
     mp = MainPage(self.driver)
     #切到iframe
     mp.switch_to_div_iframe()
     #在启动流程界面指定流程并确定
     btn.appoint_flow()
     mp.switch_to_parent()
     mp.switch_to_iframe()
     #time.sleep(0.5)
     msgtitle = lp.is_test_in_msg('成功保存并开启流程')
     self.assertTrue(msgtitle, msg='流程启动用户指定按钮检验不通过')
     btn.click_button(btn.to_return)
     lp.wait_loading_hide()  #表单中
     if 0 != lp.get_rows_total():
         lp.clear_all_data()
Exemplo n.º 6
0
    def test_user_defined_close_btn(self):
        '''自定义关闭按钮'''
        menu3 = '表单按钮_自定义关闭按钮'
        Process_approver = ProcessApproverPage(self.driver)
        Process_approver.close_message()  #
        self.open_menu3(menu3)  # 打开三级菜单
        lp = ListViewPage(self.driver)
        # 清空多余数据
        if 0 != lp.get_rows_total():
            lp.clear_all_data()
            lp.add_one_row_div()
        # 无数据时添加一条数据
        if lp.get_rows_total() == 0:
            lp.add_one_row_div()
        # 点击第一条数据
        lp.open_fisrt_doc()

        mp = MainPage(self.driver)
        mp.switch_to_div_iframe()  # 切换到弹出层页面

        btn = ButtonPage(self.driver)
        btn.click_default_btn("自定义关闭")  #点击自定义关闭按钮
        self.assertTrue(lp.is_msg_visiable(), msg='自定义关闭按钮检验不通过')
        msgtitle = lp.is_test_in_msg('自定义关闭成功')
        self.assertTrue(msgtitle, msg='自定义关闭按钮检验不通过')
        lp.wait_loading_hide()  # 等待视图加载完成
        self.assertTrue(mp.div_is_close(), msg='自定义关闭按钮检验不通过')
Exemplo n.º 7
0
 def delete_record(self):
     #删除记录
     self.find_elem_is_clickable('td.listDataThFirstTd > input[type="checkbox"]').click()
     btn = ButtonPage(self.driver)
     btn.click_button(btn.del_btn)
     self.driver.switch_to_alert().accept()
     self.wait_loading_hide()
Exemplo n.º 8
0
 def clear_all_data(self):
     '''清空所有数据'''
     bp = ButtonPage(self.driver)
     bp.click_button(bp.clear_btn)
     self.click_alert_accept()
     self.wait_loading_hide()
     if self.get_rows_total()!=0:
         print("清空所有数据失效")
Exemplo n.º 9
0
 def test_notnull_case(self):
     '''文件上传控件非空校验'''
     comp = FileUploadPage(self.driver)
     name = '文件上传控件非空校验'
     btn = ButtonPage(self.driver)
     btn.click_button(btn.save)
     #time.sleep(0.5)
     text1 = comp.get_msg()
     self.assertIn("文件上传_非空校验'必须填写!", text1, msg=name + '检验不通过')
 def test_notnull_case(self):
     '''左右选择框非空校验'''
     comp = SelectAboutPage(self.driver)
     name = '左右选择框非空校验'
     compname = '左右框_非空校验'
     btn = ButtonPage(self.driver)
     btn.click_button(btn.save)
     #time.sleep(0.5)
     text1 = comp.get_msg()
     self.assertIn("左右框_非空校验'必须填写!;", text1, msg=name + '检验不通过')
Exemplo n.º 11
0
 def test_edit_yes(self):
     '''是否可编辑脚本_是'''
     menu3 = '表单_是否可编辑脚本_是'
     self.open_menu3(menu3)
     lp = ListViewPage(self.driver)
     lp.click_row()
     btn = ButtonPage(self.driver)
     self.assertNotEqual('none',
                         btn.get_button(btn.save),
                         msg='是否可编辑脚本_是检验不通过')
Exemplo n.º 12
0
    def test_readonly_not(self):
        '''非只读'''
        menu3 = '列表视图_只读_否'
        self.open_menu3(menu3)
        lp = ListViewPage(self.driver)
        lp.click_row()
        btn = ButtonPage(self.driver)

        btn_title = btn.get_button_title(btn.save)
        self.assertEqual('保存', btn_title, msg='非只读检验不通过')
Exemplo n.º 13
0
 def set_val_save_get_msg(self, keyVal):
     '''设置控件值、触发保存、获取提醒消息并返回'''
     comp = self.get_component()
     #time.sleep(0.5)
     comp.clear()
     comp.send_keys(keyVal)
     btn = ButtonPage(self.driver)
     btn.click_button(btn.save)
     self.wait_loading_hide()
     return self.get_msg()
Exemplo n.º 14
0
    def test_readonly(self):
        '''只读'''
        menu3 = '列表视图_只读_是'
        self.open_menu3(menu3)
        lp = ListViewPage(self.driver)
        lp.click_row()
        btn = ButtonPage(self.driver)

        btn_title = btn.get_button_title(btn.new_btn)
        self.assertEqual('新建', btn_title, msg='非只读检验不通过')
Exemplo n.º 15
0
    def test_jump_url_current_page_btn(self):
        '''跳转(当前页)按钮'''
        menu3 = '按钮_case002'
        self.open_menu3(menu3)  #打开菜单

        btn = ButtonPage(self.driver)
        btn.click_button_by_type_title(btn.jump_to, '跳转(当前页)')  #点击跳转
        #time.sleep(0.5)
        lp = ListViewPage(self.driver)
        self.assertEqual('保存', lp.get_column_row1_col1(), msg='跳转(当前页)按钮检验不通过')
Exemplo n.º 16
0
 def test_save_draft_btn_case(self):
     '''保存草稿按钮'''
     menu3 = '按钮控件_保存类'
     self.open_menu3(menu3)
     lp = ListViewPage(self.driver)
     lp.open_fisrt_doc()
     #time.sleep(0.5)
     btn = ButtonPage(self.driver)
     btn.click_button(btn.save_draft)
     #time.sleep(0.5)
     self.assertEqual('[保存成功]', lp.get_msg(), msg='保存草稿按钮检验不通过')
Exemplo n.º 17
0
 def test_new_case(self):
     '''新建按钮'''
     menu3 = '按钮_case001'
     self.open_menu3(menu3)  #打开菜单
     btn = ButtonPage(self.driver)
     btn.click_button(btn.new_btn)  #点击新建
     #time.sleep(0.5)
     #确定已经跳转到对应的表单页面
     self.assertEqual('视图按钮测试用例-case001',
                      btn.get_caption_text(),
                      msg='新建按钮检验不通过')
Exemplo n.º 18
0
 def add_one_row2(self):
     '''新建一条数据'''
     bp = ButtonPage(self.driver)
     bp.click_button(bp.new_btn)
     bp.wait_loading_hide()
     ip = InputPage(self.driver, '单行文本')
     ip.element.send_keys('保存')
     bp.click_button(bp.save)
     ip.wait_loading_hide()
     bp.click_button(bp.to_return)
     ip.wait_loading_hide()  #表单中
Exemplo n.º 19
0
 def test_save_return_btn_case(self):
     '''保存并返回按钮'''
     menu3 = '按钮控件_保存类'
     self.open_menu3(menu3)
     lp = ListViewPage(self.driver)
     lp.open_fisrt_doc()
     #time.sleep(0.5)
     btn = ButtonPage(self.driver)
     btn.click_button(btn.save_return)
     self.assertEqual('[保存成功]', lp.get_msg(), msg='保存并返回按钮检验不通过')
     #time.sleep(0.5)
     self.assertEqual('保存', lp.get_column_row1_col1(), msg='保存并返回按钮检验不通过')
Exemplo n.º 20
0
 def judge_delete(self, name):
     """判断是否已存在记录有则删除"""
     s = self.driver.find_elements_by_link_text(name)
     if len(s) >= 1:
         print("记录已存在,需要删除")
         self.find_elem_is_clickable('td.listDataThFirstTd > input[type="checkbox"]').click() #点击全选
         btn = ButtonPage(self.driver)
         btn.click_button(btn.del_btn)
         self.driver.switch_to_alert().accept()
         self.wait_loading_hide()
         self.wait_elem_visible('.content-space-txt.text-center') #判断数据已经删除完
     else:
         print("记录不存在,不需要删除")
Exemplo n.º 21
0
 def test_button_self_print_case(self):
     '''自定义打印按钮'''
     menu3 = '按钮控件_打印导出下载等'
     self.open_menu3(menu3)
     comp = InputPage(self.driver, '单行文本')
     btn = ButtonPage(self.driver)
     btn.open_and_switch_to_self_print_page()
     self.assertNotEqual('none',
                         comp.find_element_by_css_selector('#MyappsReport'),
                         msg='自定义打印按钮检验不通过')
     self.driver.close()
     mp = MainPage(self.driver)
     mp.switch_to_current_window()
Exemplo n.º 22
0
    def test_jump_form_current_page_btn_case(self):
        '''跳转动态表单当前页按钮'''
        menu3 = '按钮控件_自定义跳转'
        self.open_menu3(menu3)
        #lp = ListViewPage(self.driver)
        #lp.open_fisrt_doc()

        btn = ButtonPage(self.driver)
        btn.click_button_by_type_title(btn.jump_to, '跳转动态表单当前页')

        #time.sleep(0.5)
        self.assertEqual('按钮测试用例-保存类',
                         btn.get_caption_text(),
                         msg='跳转动态表单当前页按钮检验不通过')
Exemplo n.º 23
0
    def test_jump_url_tab_page_btn(self):
        '''跳转(页签)按钮'''
        menu3 = '按钮_case002'
        self.open_menu3(menu3)

        btn = ButtonPage(self.driver)
        btn.click_button_by_type_title(btn.jump_to, '跳转(页签)')

        #time.sleep(0.5)
        mp = MainPage(self.driver)
        mp.switch_to_parent()
        mp.switch_to_iframe()
        lp = ListViewPage(self.driver)
        self.assertEqual('保存', lp.get_column_row1_col1(), msg='跳转(页签)按钮检验不通过')
Exemplo n.º 24
0
    def tab_list_delete_row(self,num):
        '''选项卡点击列表删除类型的操作按钮'''
        '''删除记录数,1或者当前显示数'''
        checkboxs = self.click_tab_list_rows()
        print("checkboxs=====%s"%checkboxs)
        if checkboxs:
            if num == 1:
                checkboxs[0].click()
 
            else:
                 for checkbox in checkboxs:
                     checkbox.click() 
                   
                      
            bp = ButtonPage(self.driver)
            bp.click_tab_list_button(bp.del_btn)
            #time.sleep(0.5)
            self.click_alert_dismiss()
            #time.sleep(0.5)
            bp.wait_loading_hide()
            bp.click_tab_list_button(bp.del_btn)
            #time.sleep(0.5)
            tismsg = self.get_alert_text() 
            self.click_alert_accept()
            self.wait_loading_hide()
            #time.sleep(0.5)
            return tismsg
Exemplo n.º 25
0
 def delete_all_data(self):
     '''删除所有数据'''
     bp = ButtonPage(self.driver)
     self.find_elem('.listDataThFirstTd').click()
     bp.click_button(bp.del_btn)
     self.click_alert_accept()
     bp.wait_Tabloading_show_then_hide()  # 等待loading消失
     bp.wait_elem_visible('.content-space-txt.text-center')  #判断数据已经删除完
Exemplo n.º 26
0
    def test_jump_url_new_window_btn(self):
        '''跳转(新窗口)按钮'''
        menu3 = '按钮_case002'
        self.open_menu3(menu3)

        btn = ButtonPage(self.driver)
        btn.click_button_by_type_title(btn.jump_to, '跳转(新窗口)')

        #time.sleep(0.5)
        lp = ListViewPage(self.driver)
        lp.switch_to_another_window()
        self.assertEqual('保存', lp.get_column_row1_col1(), msg='跳转(新窗口)按钮检验不通过')
        self.driver.close()
        mp = MainPage(self.driver)
        mp.switch_to_current_window()
Exemplo n.º 27
0
 def test_user_defined_return_btn(self):
     '''自定义返回按钮'''
     menu3 = '表单按钮_自定义按钮'
     self.open_menu3(menu3)
     lp = ListViewPage(self.driver)
     if 0 != lp.get_rows_total():
         lp.clear_all_data()
         lp.add_one_row2()  #添加一条数据
     if lp.get_rows_total() == 0:
         lp.add_one_row2()  #无数据时添加一条数据
     lp.open_fisrt_doc()
     btn = ButtonPage(self.driver)
     btn.click_default_btn("自定义返回")
     msgtitle = lp.is_test_in_msg('自定义返回成功')
     self.assertTrue(msgtitle, msg='自定义返回按钮检验不通过')
Exemplo n.º 28
0
    def tab_list_add_row(self):
        btn = ButtonPage(self.driver)
        btn_title = btn.get_tab_list_button(btn.new_btn).get_attribute('title')

        #点击新建按钮
        btn.click_tab_list_button(btn.new_btn)
        #time.sleep(0.5)
        #切换到弹出层打开的页面
        mp = MainPage(self.driver)        
        mp.switch_to_div_iframe()
        #time.sleep(0.5)
        btn_title = btn.get_button_title(btn.save)
        btn.click_button(btn.save)
        btn.wait_loading_hide()
        return btn_title            
Exemplo n.º 29
0
    def test_column_type_submit(self):
        '''列-操作类型-提交流程'''
        menu3 = '列表视图_列_操作类型_提交流程'
        self.open_menu3(menu3)
        lp = ListViewPage(self.driver)
        if lp.get_rows_total() == 0:
            lp.add_one_row()

        if lp.get_rows_total() >= 1:
            lp.delete_record()
            lp.add_one_row()

        lp.click_submit()  #点击视图的流程提交按钮
        mp = MainPage(self.driver)
        mp.switch_to_parent()
        mp.wait_elem_visible('div.aui_content')  #等待动画弹框显示
        lp.set_val_and_submit('请审批')  #设置提交审批意见并确定提交
        mp.switch_to_iframe()
        mp.wait_loading_hide()  #等待loading加载完

        #点击行数据
        lp.click_row()
        bp = ButtonPage(self.driver)
        fp = FormPage(self.driver)
        self.assertEqual(0, fp.get_nextids(), msg='列-操作类型-提交流程检验不通过')
Exemplo n.º 30
0
 def test_close_window_btn(self):
     '''关闭窗口按钮'''
     menu3 = '按钮控件_分享签章返回等'
     self.open_menu3(menu3)
     lp = ListViewPage(self.driver)
     #lp.open_fisrt_doc()
     #time.sleep(0.5)
     mp = MainPage(self.driver)
     #mp.switch_to_div_iframe()
     #time.sleep(0.5)
     btn = ButtonPage(self.driver)
     btn.click_button(btn.close_window)
     self.driver.switch_to_default_content()
     text = mp.find_elem('div.navbar-tabs-panel>ul li>a>div').text
     #time.sleep(0.5)
     self.assertNotIn('按钮控件_分享签章返回等', text, msg='关闭窗口按钮检验不通过')