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='删除按钮检验不通过')
def test_batch_submit_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) lp.wait_Tabloading_show_then_hide() ip = InputPage(self.driver, '单行文本') ip.element.send_keys('保存') btn.click_button(btn.save_start) lp.wait_Tabloading_show_then_hide() btn.click_button(btn.to_return) lp.wait_loading_hide() #表单中 lp.wait_loading_hide() #视图中 #确定数据不止一条 self.assertNotEqual(0, lp.get_rows_total(), msg='批量提交按钮检验不通过') lp.click_select_all() #全选 btn.click_button(btn.batch_submit) #点击批量提交 lp.wait_Tabloading_show_then_hide() mp = MainPage(self.driver) mp.switch_to_parent() #切换到主页 #time.sleep(0.5) lp.set_val_and_submit('请审批') #填写审批意见并确定 lp.wait_Tabloading_show_then_hide() mp.switch_to_iframe() #切换回iframe中 #time.sleep(0.5) lp.click_row() #点击第一行数据 lp.wait_Tabloading_show_then_hide() # 等待表单页面的loading加载完 #没有流程处理按钮则通过 self.assertIsNone(btn.get_button(btn.flow_process), msg='批量提交按钮检验不通过') btn.click_button(btn.to_return) #点击返回 lp.wait_loading_hide() #表单中 lp.wait_loading_hide() #视图中 if 0 != lp.get_rows_total(): #清空数据 lp.clear_all_data()