def test_product_management(self): dr = base_common(self.driver) input_username(page.user_name, dr) input_password(page.passwd, dr) click_submit(dr) product_management(dr, page.product_management) rich_product(dr, page.rich_product) #输入产品名称进行查询 enter_product_name(dr, page.enter_product_name) query(dr, page.query_button) self.assertIn(get_page_text(dr, page.select_result), page.enter_name, logger.info("对比结果:成功")) #重置搜索 reset(dr, page.reset_search) #跟据状态进行查询 product_status(dr, page.product_status) product_shelf(dr, page.shelf_button) query(dr, page.query_button) #通过查询数据库,不同状态的产品名称存入list,获取当前页面返回的产品名称,进行对比 sql = "SELECT product_name FROM main_product WHERE `status`='SALES'" self.assertIn(get_page_text(dr, page.select_result), select_mysql(sql), logger.info("比对结果正确")) reset(dr, page.reset_search) product_status(dr, page.product_status) product_shelf(dr, page.lower_frame) query(dr, page.query_button) sql1 = "SELECT product_name FROM main_product WHERE `status`='OFF_LINE'" self.assertIn(get_page_text(dr, page.select_result), select_mysql(sql1), logger.info("比对结果正确"))
def test_banner_management(self): dr = base_common(self.driver) input_username(page.user_name, dr) input_password(page.passwd, dr) click_submit(dr) banner_manage(dr, page.banner_management) banner_channel(dr, page.banner_channel) h5_page(dr, page.h5_page) query(dr, page.query_button) base_common.js_scroll_end(self) banner_limit = get_page_total(dr, page.banner_limit) self.assertEqual(banner_limit, str(banner(page.h5_url, page.login)), logger.info("h5端对比结果:成功")) pc_page(dr, page.pc_page) query(dr, page.query_button) self.assertEqual(banner_limit, str(banner(page.pc_url, page.login)), logger.info("pc端对比结果:成功")) app_page(dr, page.app_page) query(dr, page.query_button) base_common.js_scroll_end(self) self.assertEqual(banner_limit, str(banner(page.app_url, page.login)), logger.info("app端对比结果:成功"))
def test_login(self): dr = base_common(self.driver) input_username(page.user_name, dr) input_password(page.passwd, dr) click_submit(dr)