auto_test_dev/YiMao/scripts/BusiScenarios/test_C005_NonVipAddMultipleItemsForPurchase.py

55 lines
2.3 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# !/usr/bin/python
# -*- coding: utf-8 -*-
# @Author:: Arthur Wu
# @Description:: 游客登录,加购多件商品并结算
# @Date:: 2021-05-10 16:30:23
import unittest,allure,time
from configs.globalObj import LOGGER
from YiMao.businessFunc.ClientApiLib import YMClientApi
from YiMao.data.WuShangSceneTestData import *
DescName = "005-非会员加购多件商品并结算"
@allure.story(f'[场景测试] {DescName}验证')
class Test_C005(unittest.TestCase):
f'''@Date:: 2024/11/15
@Author:: Arthur Wu
@Desc::
[购物车客户端] {DescName}
1、武商测试环境多件商品的 inputcode 分别为:
'''
def setUp(self) -> None:
self.timestamp = int(time.time())
self.ymc = YMClientApi()
self.goods_inputcode1 = NormalGoodsInputcode01 # 乐事薯片
self.goods_inputcode2 = NormalGoodsInputcode02 # 统一番茄牛肉面
def test_C005_NonVipAddMultipleItemsForPurchase(self):
allure.dynamic.description(f"描述:{DescName}")
allure.step("步骤1session开始")
self.ymc.session_start()
allure.step("步骤2匿名登录")
Payload01 = {"action": 0, "isAnon": True}
LoginData = self.ymc.login_app_v2(Payload01)
allure.step("步骤3获取商品1信息")
GoodsInfoData1 = self.ymc.get_goods_info(InputCode=self.goods_inputcode1)
if GoodsInfoData1['msg'] != '加购商品不存在':
allure.step("步骤4添加商品1")
self.ymc.add_cart_goods(GoodsInfoData1, 1, LoginData)
allure.step("步骤5获取商品2信息")
GoodsInfoData2 = self.ymc.get_goods_info(InputCode=self.goods_inputcode2)
if GoodsInfoData2['msg'] != '加购商品不存在':
allure.step("步骤6添加商品2")
self.ymc.add_cart_goods(GoodsInfoData2, 1, LoginData)
allure.step("步骤7获取购物车商品信息")
self.ymc.get_cart_goods_info([GoodsInfoData1, GoodsInfoData2])
allure.step("步骤8请求订单结算")
self.ymc.request_order_settlement(LoginData)
else:
LOGGER.info(f"---商品 {self.goods_inputcode2} 不存在")
else:
LOGGER.info(f"---商品 {self.goods_inputcode1} 不存在")
if __name__ == '__main__':
unittest.main(verbosity=2)