def test_11(self): """MRYX_ST_shop011:验证购物车添加功能_购物车里减少商品的数量""" bp = BasePage(self.driver) bp.click(HomePage.sort_locator) bp.choose(SortPage.buy_locator, [1]) for i in range(4): bp.choose(SortPage.repeat_add_locator, [1]) bp.click(HomePage.cart_locator) for i in range(4): bp.click(CartPage.sub_locator) assert_number = bp.get_text(CartPage.cart_number_locator) self.assertEqual("1", assert_number) cp = CartPage(self.driver) cp.drop_cart()
def test_010(self): """MRYX_ST_shop010:验证购物车添加功能_购物车里增加商品的数量""" bp = BasePage(self.driver) bp.click(HomePage.sort_locator) bp.choose(SortPage.buy_locator, [1]) bp.click(HomePage.cart_locator) cp = CartPage(self.driver) for i in range(4): cp.crease(1) """断言""" assert_number = bp.get_text(CartPage.cart_number_locator) self.assertEqual("5", assert_number) ###断言 cp = CartPage(self.driver) ###删除购物车 cp.drop_cart() ###删除购物车
def test_009(self): """MRYX_ST_shop009:验证购物车结算功能_取消部分勾选购物车商品""" bp = BasePage(self.driver) bp.click(HomePage.sort_locator) bp.choose(SortPage.buy_locator, [1, 2]) bp.click(HomePage.cart_locator) """获取断言信息""" before_price = bp.order_text(CartPage.cart_price_locator, 2) ele = bp.find_elements(CartPage.choose_signal_locator) ele[1].click() after_price = bp.get_text(CartPage.all_prince_locator) """断言""" self.assertEqual(before_price, after_price) ele[1].click() cp = CartPage(self.driver) cp.drop_cart()
def test_008(self): """MRYX_ST_shop008:验证购物车结算功能_不勾选【云超特卖】""" bp = BasePage(self.driver) bp.click(HomePage.sort_locator) bp.choose(SortPage.buy_locator, [1, 2]) bp.click(HomePage.cart_locator) """获取断言文本""" all_price_text = bp.get_text(CartPage.all_prince_locator) bp.click(CartPage.cloud_market_locator) none_price_text = bp.get_text(CartPage.choose_all_locator) """断言""" self.assertNotEqual(all_price_text, none_price_text) self.assertEqual(none_price_text, "") bp.click(CartPage.cloud_market_locator) cp = CartPage(self.driver) cp.drop_cart()