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') #判断数据已经删除完
def add_one_row(self): '''新建一条数据''' bp = ButtonPage(self.driver) bp.click_button(bp.new_btn) bp.wait_Tabloading_show_then_hide() ip = InputPage(self.driver, '列表视图_单行文本框') ip.element.send_keys(20) bp.click_button(bp.save_start) #点击流程启动按钮 bp.wait_Tabloading_show_then_hide() bp.click_button(bp.to_return) #点击返回按钮 bp.wait_loading_hide() #表单中
def creat_leaf_data(self): '''新建数据''' # 打开无下级二级 bp = ButtonPage(self.driver) bp.click_button(bp.new_btn) bp.wait_Tabloading_show_then_hide() self.find_elem('#_formHtml p:nth-child(1) input').send_keys('211') self.find_elem('#_formHtml p:nth-child(2) input').send_keys('322') self.find_elem('#_formHtml p:nth-child(3) input').send_keys('自动化测试') bp.click_button(bp.save) bp.wait_Tabloading_show_then_hide() bp.click_button(bp.to_return) bp.wait_loading_hide() #表单中 bp.wait_loading_hide() #视图中
def test_clear_data_case(self): '''清空所有数据按钮''' menu3 = '按钮_case001' self.open_menu3(menu3) #打开菜单 #新建一条数据 btn = ButtonPage(self.driver) btn.click_button(btn.new_btn) btn.wait_Tabloading_show_then_hide() ip = InputPage(self.driver, '单行文本') ip.element.send_keys('保存') btn.click_button(btn.save_start) btn.wait_Tabloading_show_then_hide() btn.click_button(btn.to_return) lp = ListViewPage(self.driver) lp.wait_loading_hide() #表单中 lp.wait_loading_hide() #视图中 #确定数据不止一条 self.assertNotEqual(0, lp.get_rows_total(), msg='清空所有数据按钮检验不通过') lp.clear_all_data() #执行清空数据操作 #确定数据为空 self.assertEqual(0, lp.get_rows_total(), msg='清空所有数据按钮检验不通过')