def test_MRYX_ST_usr_002(self): """注销登录测试""" bp = BasePage(self.driver) sleep(5) bp.click((By.ID, "cn.missfresh.application:id/mineTab")) #点击我的 sleep(1) bp.to_up(duration=3000) # 上滑出现设置 mp = MysPage(self.driver) #实例化"我的"界面 mp.click_set() #点击设置按钮 sleep(1) msp = MysSetPage(self.driver) #实例化我的设置界面 msp.click_sign_out() # 点击退出登录
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_MRYX_ST_usr_002(self): """注销登录测试""" bp = BasePage(self.driver) sleep(5) bp.click((By.ID, "cn.missfresh.application:id/mineTab")) #点击我的 sleep(1) bp.to_up(duration=3000) # 上滑出现设置 mp = MysPage(self.driver) #实例化"我的"界面 mp.click_set() #点击设置按钮 sleep(1) msp = MysSetPage(self.driver) #实例化我的设置界面 msp.click_sign_out() # 点击退出登录 hp = HomePage(self.driver) sleep(3) text = hp.text_quest_login() # 获取立即登录的文本 self.assertEqual(text, self.asserts)
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()
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()