Arthur-Wu committed this file on 2024-11-18

This commit is contained in:
ieemoo 2024-11-18 11:51:08 +08:00
parent 61d92d5036
commit 875fad5324
47 changed files with 323 additions and 23 deletions

View File

@ -63,13 +63,13 @@ class YMClientApi(object):
logging.info(f"-----------接口返回数据:{response.json()}\n\n")
return response.json()
def add_retire_purchase(self, GoodsInfoData, LoginData):
def add_retire_purchase(self, GoodsInfoData, AddPurchaseQuantity, LoginData):
logging.info("========== [加入购物车] add_retire_purchase ==========")
payload = json.dumps({
"addGoods":[{
"inputCode": GoodsInfoData["data"]["inputCode"],
"isNormalAddPurchase": True,
"qty": GoodsInfoData["data"]["qty"],
"qty": int(AddPurchaseQuantity), # AddPurchaseQuantityGoodsInfoData["data"]["qty"]
"weight": int(GoodsInfoData["data"]["weight"]),
}],
"autoSelectCoupon": True,
@ -146,11 +146,8 @@ class YMClientApi(object):
POST
https://api.test.yimaogo.com/cart/v2/shopping/add/retire/purchase
payload = {"addGoods":[{"inputCode":"6942728414063","isNormalAddPurchase":true,"qty":1,"weight":0}],"autoSelectCoupon":true,"coupons":[],"deleteGoods":[],"existGoods":[],"orderNo":"1857003957307801600"}
'''
''' 2- without sessionid '''
def get_ads_list(self):
logging.info("========== [获取广告列表] get_ads_list ==========")
@ -174,25 +171,23 @@ class YMClientApi(object):
return response.json()
if __name__ == '__main__':
ym = YMClientApi()
ymc = YMClientApi()
''' 01- '''
ym.session_start() # step1session开始
ymc.session_start() # step1session开始
Payload01 = {"action": 0, "isAnon": True}
LoginData = ym.login_app_v2(Payload01) # step2匿名登录
ym.get_login_type() # step3获取登录方式
LoginData = ymc.login_app_v2(Payload01) # step2匿名登录
ymc.get_login_type() # step3获取登录方式
Payload02 = {"action": 1, "code": "18052753212", "isAnon": False}
ym.login_app_v2(Payload02) # step4切换会员登录
GoodsInfoData = ym.get_goods_info(InputCode=6924882486100) # step5获取商品信息
CouponListData = ym.get_coupon_list() # step6获取优惠券列表
ym.receive_coupon(CouponListData) # step7领取优惠券
ym.query_coupon_list_user() # step8查询用户持有的优惠券列表
ym.add_retire_purchase(GoodsInfoData, LoginData) # step9加购商品
ym.get_cart_goods_info(GoodsInfoData) # step10获取购物车商品信息
ym.request_order_settlement(LoginData) # step11请求订单结算
ymc.login_app_v2(Payload02) # step4切换会员登录
GoodsInfoData = ymc.get_goods_info(InputCode=6924882486100) # step5获取商品信息 ------ 6924882486100
CouponListData = ymc.get_coupon_list() # step6获取优惠券列表
ymc.receive_coupon(CouponListData) # step7领取优惠券
ymc.query_coupon_list_user() # step8查询用户持有的优惠券列表
ymc.add_retire_purchase(GoodsInfoData, 1, LoginData) # step9加购商品 ------ 6924882486100
ymc.get_cart_goods_info(GoodsInfoData) # step10获取购物车商品信息
ymc.request_order_settlement(LoginData) # step11请求订单结算
ym.session_end()
ymc.session_end()

View File

@ -0,0 +1,5 @@

View File

@ -0,0 +1,5 @@
# !/usr/bin/python
# -*- coding: utf-8 -*-
# @Author:: Arthur Wu
# @Description:: 游客登录,加购多件商品,并结算
# @Date:: 2021-05-10 16:30:23

View File

@ -0,0 +1,5 @@
# !/usr/bin/python
# -*- coding: utf-8 -*-
# @Author:: Arthur Wu
# @Description:: 游客登录,加购打折商品,并结算
# @Date:: 2021-05-10 16:30:22

View File

@ -0,0 +1,5 @@
# !/usr/bin/python
# -*- coding: utf-8 -*-
# @Author:: Arthur Wu
# @Description:: 游客登录,加购促销白名单商品,并结算
# @Date:: 2021-05-10 16:30:23

View File

@ -0,0 +1,5 @@
# !/usr/bin/python
# -*- coding: utf-8 -*-
# @Author:: Arthur Wu
# @Description:: 游客登录,加购重量放通商品,并结算
# @Date:: 2021-05-10 16:30:22

View File

@ -0,0 +1,5 @@
# !/usr/bin/python
# -*- coding: utf-8 -*-
# @Author:: Arthur Wu
# @Description:: 游客登录加购2个购物袋退购一个购物袋并结算
# @Date:: 2021-05-10 16:30:22

View File

@ -0,0 +1,5 @@
# !/usr/bin/python
# -*- coding: utf-8 -*-
# @Author:: Arthur Wu
# @Description:: 游客登录加购2个普通商品退购一个并结算
# @Date:: 2021-05-10 16:00:00

View File

@ -0,0 +1,5 @@
# !/usr/bin/python
# -*- coding: utf-8 -*-
# @Author:: Arthur Wu
# @Description:: 游客登录加购2个会员商品退购一个并结算
# @Date:: 2021-05-10 16:27:22

View File

@ -0,0 +1,5 @@
# !/usr/bin/python
# -*- coding: utf-8 -*-
# @Author:: Arthur Wu
# @Description:: 游客登录,加购多件商品,退购一个商品,并结算
# @Date:: 2021-05-10 16:30:23

View File

@ -0,0 +1,5 @@
# !/usr/bin/python
# -*- coding: utf-8 -*-
# @Author:: Arthur Wu
# @Description:: 游客登录加购2个打折商品退购一个并结算
# @Date:: 2021-05-10 16:30:22

View File

@ -0,0 +1,5 @@
# !/usr/bin/python
# -*- coding: utf-8 -*-
# @Author:: Arthur Wu
# @Description:: 游客登录加购2个促销白名单商品退购一个并结算
# @Date:: 2021-05-10 16:00:00

View File

@ -0,0 +1,5 @@
# !/usr/bin/python
# -*- coding: utf-8 -*-
# @Author:: Arthur Wu
# @Description:: 游客登录加购2个重量放通商品退购一个并结算
# @Date:: 2021/04/01 16:00:00

View File

@ -0,0 +1,5 @@
# !/usr/bin/python
# -*- coding: utf-8 -*-
# @Author:: Arthur Wu
# @Description:: 游客转会员登录,加购购物袋,并结算
# @Date:: 2021-05-10 16:30:22

View File

@ -0,0 +1,4 @@
# !/usr/bin/python
# -*- coding: utf-8 -*-
# @Author:: Arthur Wu
# @Description:: 游客转会员登录,加购普通商品,并结算

View File

@ -0,0 +1,5 @@
# !/usr/bin/python
# -*- coding: utf-8 -*-
# @Author:: Arthur Wu
# @Description:: 游客转会员登录,加购会员商品,并结算
# @Date:: 2021-05-10 16:30:23

View File

@ -0,0 +1,5 @@
# !/usr/bin/python
# -*- coding: utf-8 -*-
# @Author:: Arthur Wu
# @Description:: 游客转会员登录,加购多件商品,并结算
# @Date:: 2021-05-10 16:30:23

View File

@ -0,0 +1,5 @@
# !/usr/bin/python
# -*- coding: utf-8 -*-
# @Author:: Arthur Wu
# @Description:: 游客转会员登录,加购打折商品,并结算
# @Date:: 2021-05-10 16:30:23

View File

@ -0,0 +1,5 @@
# !/usr/bin/python
# -*- coding: utf-8 -*-
# @Author:: Arthur Wu
# @Description:: 游客转会员登录,加购促销白名单商品,并结算
# @Date:: 2021-05-10 16:30:22

View File

@ -0,0 +1,4 @@
# !/usr/bin/python
# -*- coding: utf-8 -*-
# @Author:: Arthur Wu
# @Description:: 游客转会员登录,加购重量放通商品,并结算

View File

@ -0,0 +1,5 @@
# !/usr/bin/python
# -*- coding: utf-8 -*-
# @Author:: Arthur Wu
# @Description:: 游客转会员登录加购2个购物袋退购一个购物袋并结算
# @Date:: 2021-05-10 15:30:27

View File

@ -0,0 +1,5 @@
# !/usr/bin/python
# -*- coding: utf-8 -*-
# @Author:: Arthur Wu
# @Description:: 游客转会员登录加购2个普通商品退购一个并结算
# @Date:: 2021-05-10 15:30:27

View File

@ -0,0 +1,5 @@
# !/usr/bin/python
# -*- coding: utf-8 -*-
# @Author:: Arthur Wu
# @Description:: 游客转会员登录加购2个会员商品退购一个并结算
# @Date:: 2021-05-10 15:30:27

View File

@ -0,0 +1,4 @@
# !/usr/bin/python
# -*- coding: utf-8 -*-
# @Author:: Arthur Wu
# @Description:: 游客转会员登录,加购多件商品,退购一个商品,并结算

View File

@ -0,0 +1,5 @@
# !/usr/bin/python
# -*- coding: utf-8 -*-
# @Author:: Arthur Wu
# @Description:: 游客转会员登录加购2个打折商品退购一个并结算
# @Date:: 2021-05-10 15:30:22

View File

@ -0,0 +1,5 @@
# !/usr/bin/python
# -*- coding: utf-8 -*-
# @Author:: Arthur Wu
# @Description:: 游客转会员登录加购2个促销白名单商品退购一个并结算
# @Date:: 2021-05-10 16:30:22

View File

@ -0,0 +1,5 @@
# !/usr/bin/python
# -*- coding: utf-8 -*-
# @Author:: Arthur Wu
# @Description:: 游客转会员登录加购2个重量放通商品退购一个并结算
# @Date:: 2021-05-10 15:30:23

View File

@ -0,0 +1,4 @@
# !/usr/bin/python
# -*- coding: utf-8 -*-
# @Author:: Arthur Wu
# @Description:: 会员登录,领取优惠券

View File

@ -0,0 +1,5 @@
# !/usr/bin/python
# -*- coding: utf-8 -*-
# @Author:: Arthur Wu
# @Description:: 会员登录,加购普通商品,并结算
# @Date:: 2021-05-10 15:30:22

View File

@ -0,0 +1,4 @@
# !/usr/bin/python
# -*- coding: utf-8 -*-
# @Author:: Arthur Wu
# @Description:: 会员登录,加购会员商品,并结算

View File

@ -0,0 +1,5 @@
# !/usr/bin/python
# -*- coding: utf-8 -*-
# @Author:: Arthur Wu
# @Description:: 会员登录,加购多件商品,并结算
# @Date:: 2021-05-10 15:40:32

View File

@ -0,0 +1,5 @@
# !/usr/bin/python
# -*- coding: utf-8 -*-
# @Author:: Arthur Wu
# @Description:: 会员登录,加购打折商品,并结算
# @Date:: 2021-05-10 16:00:00

View File

@ -0,0 +1,5 @@
# !/usr/bin/python
# -*- coding: utf-8 -*-
# @Author:: Arthur Wu
# @Description:: 会员登录,加购促销白名单商品,并结算
# @Date:: 2021-05-10 16:30:22

View File

@ -0,0 +1,5 @@
# !/usr/bin/python
# -*- coding: utf-8 -*-
# @Author:: Arthur Wu
# @Description:: 会员登录,加购重量放通商品,并结算
# @Date:: 2021-05-10 15:30:22

View File

@ -0,0 +1,5 @@
# !/usr/bin/python
# -*- coding: utf-8 -*-
# @Author:: Arthur Wu
# @Description:: 会员登录加购2个购物袋退购一个购物袋并结算
# @Date:: 2021-05-20 15:30:23

View File

@ -0,0 +1,5 @@
# !/usr/bin/python
# -*- coding: utf-8 -*-
# @Author:: Arthur Wu
# @Description:: 会员登录加购2个普通商品退购一个并结算
# @Date:: 2021-05-10 15:30:22

View File

@ -0,0 +1,5 @@
# !/usr/bin/python
# -*- coding: utf-8 -*-
# @Author:: Arthur Wu
# @Description:: 会员登录加购2个会员商品退购一个并结算
# @Date:: 2021-05-10 16:30:23

View File

@ -0,0 +1,4 @@
# !/usr/bin/python
# -*- coding: utf-8 -*-
# @Author:: Arthur Wu
# @Description:: 会员登录,加购多件商品,退购一个商品,并结算

View File

@ -0,0 +1,5 @@
# !/usr/bin/python
# -*- coding: utf-8 -*-
# @Author:: Arthur Wu
# @Description:: 会员登录加购2个打折商品退购一个并结算
# @Date:: 2021-05-10 15:30:22

View File

@ -0,0 +1,5 @@
# !/usr/bin/python
# -*- coding: utf-8 -*-
# @Author:: Arthur Wu
# @Description:: 会员登录加购2个促销白名单商品退购一个并结算
# @Date:: 2021-05-10 16:30:23

View File

@ -0,0 +1,5 @@
# !/usr/bin/python
# -*- coding: utf-8 -*-
# @Author:: Arthur Wu
# @Description:: 会员登录加购2个重量放通商品退购一个并结算
# @Date:: 2021-05-10 16:30:22

View File

@ -0,0 +1,5 @@
# !/usr/bin/python
# -*- coding: utf-8 -*-
# @Author:: Arthur Wu
# @Date:: 2024/11/18-11:49
# @Description::

View File

@ -0,0 +1,59 @@
# !/usr/bin/python
# -*- coding: utf-8 -*-
# @Author:: Arthur Wu
# @Date:: 2024/11/18-9:38
# @Description::
import unittest,allure,time
from configs.globalObj import LOGGER
from YiMao.businessFunc.ClientApiLib import YMClientApi
class Test_C002_AddShoppingBagAndSettlePayment(unittest.TestCase):
'''@Date:: 2024/11/15
@Author:: Arthur Wu
@Desc::
[购物车客户端] 加购购物袋并试算验证
1武商测试环境购物袋inputcode为
69716489229906971648922983
'''
def setUp(self) -> None:
self.timestamp = int(time.time())
self.ymc = YMClientApi()
@allure.story('[购物车客户端] 加购购物袋并试算验证-01')
def test_C00201_AddShoppingBagAndSettlePayment(self):
allure.dynamic.description("描述:加购中号购物袋")
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获取商品信息")
GoodsInfoData = self.ymc.get_goods_info(InputCode=6971648922990)
allure.step("步骤4添加购物袋")
self.ymc.add_retire_purchase(GoodsInfoData, 2, LoginData)
allure.step("步骤5获取购物车商品信息")
self.ymc.get_cart_goods_info(GoodsInfoData)
allure.step("步骤6请求订单结算")
self.ymc.request_order_settlement(LoginData)
@allure.story('[购物车客户端] 加购购物袋并试算验证-02')
def test_C00202_AddShoppingBagAndSettlePayment(self):
allure.dynamic.description("描述:加购大号购物袋")
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获取商品信息")
GoodsInfoData = self.ymc.get_goods_info(InputCode=6971648922983)
allure.step("步骤4添加购物袋")
self.ymc.add_retire_purchase(GoodsInfoData, 2, LoginData)
allure.step("步骤5获取购物车商品信息")
self.ymc.get_cart_goods_info(GoodsInfoData)
allure.step("步骤6请求订单结算")
self.ymc.request_order_settlement(LoginData)
if __name__ == '__main__':
unittest.main(verbosity=2)

View File

@ -0,0 +1,42 @@
# !/usr/bin/python
# -*- coding: utf-8 -*-
# @Author:: Arthur Wu
# @Date:: 2024/11/18-10:49
# @Description::
import unittest,allure,time
from configs.globalObj import LOGGER
from YiMao.businessFunc.ClientApiLib import YMClientApi
class Test_C002_AddShoppingBagAndSettlePayment(unittest.TestCase):
'''@Date:: 2024/11/15
@Author:: Arthur Wu
@Desc::
[购物车客户端] 加购无优惠商品并试算验证
1武商测试环境普通无优惠商品inputcode为
6924743915848
'''
def setUp(self) -> None:
self.timestamp = int(time.time())
self.ymc = YMClientApi()
@allure.story('[购物车客户端] 加购无优惠商品并试算验证-01')
def test_C00201_AddShoppingBagAndSettlePayment(self):
allure.dynamic.description("描述:加购无优惠商品")
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获取商品信息")
GoodsInfoData = self.ymc.get_goods_info(InputCode=6924743915848)
allure.step("步骤4添加无优惠商品")
self.ymc.add_retire_purchase(GoodsInfoData, 5, LoginData)
allure.step("步骤5获取购物车商品信息")
self.ymc.get_cart_goods_info(GoodsInfoData)
allure.step("步骤6请求订单结算")
self.ymc.request_order_settlement(LoginData)
if __name__ == '__main__':
unittest.main(verbosity=2)

View File

@ -0,0 +1,5 @@
# !/usr/bin/python
# -*- coding: utf-8 -*-
# @Author:: Arthur Wu
# @Description:: 游客登录,加购会员商品,并结算
# @Date:: 2021-05-10 16:30:23

View File

@ -84,8 +84,8 @@ class Engine():
indexh5path = self.__execute()
self.__set_overview_title(indexh5path, self.newName)
returnList = []
# lastReportPath = self.__move_file()
# returnList.append(lastReportPath)
lastReportPath = self.__move_file()
returnList.append(lastReportPath)
self.__delete_txt_files(txtPath)
self.__delete_pycache_dirs(self.rootpath)
return returnList