7 changed files with 211 additions and 8 deletions
Unified View
Diff Options
-
20000-LoginToken/000-dataDriven.robot
-
43000-LoginToken/Client-Login.robot
-
5000-LoginToken/Factory-Login.robot
-
123001-Coupon/Coupon.robot
-
0001-Coupon/__init__.robot
-
26002-SpuCalculation/Calculation.robot
-
2002-SpuCalculation/__init__.robot
@ -0,0 +1,123 @@ |
|||||
|
*** Settings *** |
||||
|
Documentation 优惠券 |
||||
|
Library urllib3 |
||||
|
Library Collections |
||||
|
Library RequestsLibrary |
||||
|
Library DatabaseLibrary |
||||
|
|
||||
|
*** Test Cases *** |
||||
|
0-register |
||||
|
#注册登录送券 |
||||
|
Run Keyword UecLogin |
||||
|
Run Keyword LoginToken |
||||
|
Create Session factory ${uecClient} ${client_firstlogin_header} |
||||
|
${reps} GET On Session factory coupon-service/user/page/coupon params=checked=false |
||||
|
${records} Get From Dictionary ${reps.json()['data']} records #获取优惠券列表 |
||||
|
Run Keyword DeleteLogin |
||||
|
|
||||
|
OrderCoupon |
||||
|
#下首单送券 |
||||
|
Run Keyword UecLogin |
||||
|
Run Keyword LoginToken |
||||
|
Run Keyword BaseInfo |
||||
|
Run Keyword 完善用户信息 |
||||
|
#获取spu列表 |
||||
|
Create Session factory ${yytClient} ${client_firstlogin_header} |
||||
|
${reps} GET On Session factory printing-packaging-factory-service/user/get/all-spu-list params=printingType=2&status=1 |
||||
|
${records} Get From Dictionary ${reps.json()['data']} records |
||||
|
FOR ${Items} IN @{records} |
||||
|
${id} Get From Dictionary ${Items} id #获取spuid |
||||
|
${name} Get From Dictionary ${Items} name #盒子名称 |
||||
|
${orgId} Get From Dictionary ${Items} orgId #获取spuorgid |
||||
|
${factoryId} Get From Dictionary ${Items} factoryId #获取spufactoryId |
||||
|
Exit For Loop If '${id}'=='820801091557003264' #下单内托 |
||||
|
END |
||||
|
#获取SPU报价 |
||||
|
${spuData} Set Variable {"spuId":"${id}","basic":true} |
||||
|
${reps} POST On Session factory printing-packaging-factory-service/user/render/spu-detail data=${spuData.encode('utf-8')} |
||||
|
${desc} Get From Dictionary ${reps.json()['data']['quote']} desc #盒型参数 |
||||
|
${count} Get From Dictionary ${reps.json()['data']['quote']} count #下单数量 |
||||
|
${price} Get From Dictionary ${reps.json()['data']['quote']} price #单价 |
||||
|
${quote} Get From Dictionary ${reps.json()['data']} quote #获取报价json |
||||
|
${amount} Get From Dictionary ${reps.json()['data']['quote']} amount #获取盒型价格 |
||||
|
${spuDetail} Get From Dictionary ${reps.json()['data']} spuDetail #获取盒型渲染 |
||||
|
${processDesc} Get From Dictionary ${reps.json()['data']['quote']} processDesc #盒型工艺 |
||||
|
${productArea} Get From Dictionary ${reps.json()['data']['quote']} productArea #初始化尺寸 |
||||
|
${materialDesc} Get From Dictionary ${reps.json()['data']['quote']} materialDesc #盒型材质 |
||||
|
${originalAmount} Get From Dictionary ${reps.json()['data']['quote']} originalAmount #低消 |
||||
|
${productMeasureDesc} Get From Dictionary ${reps.json()['data']['quote']} productMeasureDesc #下单尺寸 |
||||
|
${productProcessDesc} Get From Dictionary ${reps.json()['data']['quote']} productProcessDesc #下单工艺 |
||||
|
${productMaterialDesc} Get From Dictionary ${reps.json()['data']['quote']} productMaterialDesc #下单材质 |
||||
|
${data} Get From Dictionary ${reps.json()} data |
||||
|
#${productSpecDetailJson} Set Variable {"quote":"${quote}"} |
||||
|
#获取工厂税点信息(自提) |
||||
|
#${reps} GET On Session factory printing-package-mall-service/user/page/invoice-title params=pageNum=factoryId=${factoryId}&orgId=${orgId}&deliveryAddressProvinceId=&deliveryAddressCityId=&deliveryAddressDistrictId= |
||||
|
#${enterpriseInvoiceList} Get From Dictionary ${reps.json()['data']} enterpriseInvoiceList |
||||
|
#FOR ${Freedata} IN @{enterpriseInvoiceList} |
||||
|
#${tax} Get From Dictionary ${Freedata} tax #税点 |
||||
|
#${type} Get From Dictionary ${Freedata} type #开票类型 |
||||
|
#${logisticsCharges} Get From Dictionary ${Freedata} logisticsCharges #物流费用 |
||||
|
#Exit For Loop If '${type}'==1 #普通发票:1,专用发票:2 |
||||
|
#END |
||||
|
#获取用户钱包账号 |
||||
|
Create Session factory ${uecClient} ${client_firstlogin_header} |
||||
|
${reps} GET On Session factory wallet-service/user/get/wallet-account |
||||
|
${amountGift} Get From Dictionary ${reps.json()['data']} amountGift #赠送金额 |
||||
|
${totalBalance} Get From Dictionary ${reps.json()['data']} totalBalance #总金额 |
||||
|
${frozenBalance} Get From Dictionary ${reps.json()['data']} frozenBalance #可用金额 |
||||
|
${availableBalance} Get From Dictionary ${reps.json()['data']} availableBalance #冻结金额 |
||||
|
#获取可用优惠券 |
||||
|
#${reps} GET On Session factory coupon-service/user/calculate/discount-amount params=amount=${amount}&couponBusinessType=2&isUseCoupon=true |
||||
|
#创建订单 |
||||
|
Create Session factory ${yytClient} ${client_firstlogin_header} |
||||
|
${OrderData} Set Variable { \ \ \ \ "remark":"", \ \ \ \ "totalAmount":"${amount}", \ \ \ \ "taxFee":0, \ \ \ \ "taxRate":0, \ \ \ \ "logisticsFee":0, \ \ \ \ "supplierFactoryId":"${factoryId}", \ \ \ \ "supplierOrgId":"${orgId}", \ \ \ \ "customerContactsName":"26用户", \ \ \ \ "customerContactsPhone":"${mobile}", \ \ \ \ "packingMethod":2, \ \ \ \ "salesOrderInvoice":{ \ \ \ \ \ \ \ \ "type":0 \ \ \ \ }, \ \ \ \ "salesOrderItemProduct":{ \ \ \ \ \ \ \ \ "productName":"${name}", \ \ \ \ \ \ \ \ "productId":"${id}", \ \ \ \ \ \ \ \ "amount":"${amount}", \ \ \ \ \ \ \ \ "quantity":"${count}", \ \ \ \ \ \ \ \ "price":"${price}", \ \ \ \ \ \ \ \ "productImgUrl":"https://qncloudprintfiletest.oss-cn-shenzhen.aliyuncs.com/cloudprint/ee9ecad4-9535-42af-b92f-f7d5c804df1c.png", \ \ \ \ \ \ \ \ "factoryId":"${factoryId}", \ \ \ \ \ \ \ \ "orgId":"${orgId}", \ \ \ \ \ \ \ \ "orderSource":1, \ \ \ \ \ \ \ \ "desc":"${desc}", \ \ \ \ \ \ \ \ "productMeasureDesc":"${productMeasureDesc}", \ \ \ \ \ \ \ \ "productMaterialDesc":"${productMaterialDesc}", \ \ \ \ \ \ \ \ "productProcessDesc":"${productProcessDesc}", \ \ \ \ \ \ \ \ "copyFromId":null, \ \ \ \ \ \ \ \ "productSpecDetailJson":{"quote":"${data}"}, \ \ \ \ \ \ \ \ "productSpecDetail":"${desc}" \ \ \ \ }, \ \ \ \ "orderSource":1 } |
||||
|
${reps} POST On Session factory printing-package-mall-service/user/create/sales-order data=${OrderData.encode('utf-8')} |
||||
|
${OrderId} Get From Dictionary ${reps.json()} data #获取订单id |
||||
|
|
||||
|
*** Keywords *** |
||||
|
DeleteLogin |
||||
|
#新用户登录 |
||||
|
#判断新用户 |
||||
|
Connect To Database Using Custom Params pymysql host='8.135.8.221',user='root', password='qniaothreetwoonego', \ port=3306,database='ztb_recycle' #链接测试环境数据库 |
||||
|
Execute Sql String UPDATE `uec`.`qn_account` SET `is_delete` = 1 WHERE `user_id` = ${userId}; |
||||
|
Execute Sql String UPDATE `uec`.`qn_user` SET `is_delete` = 1 WHERE `id` = ${userId}; |
||||
|
Execute Sql String UPDATE `coupon`.`qn_user_behavior` SET `is_delete` = 1 WHERE `user_id` = ${userId} |
||||
|
Disconnect From Database |
||||
|
Sleep 1 |
||||
|
|
||||
|
UecLogin |
||||
|
#登录UEC |
||||
|
Disable Warnings |
||||
|
Create Session factory ${uecClient} ${Client-LoginHeader} |
||||
|
${LoginData} Set Variable {"account":"${New_account}","captcha":"${client_password}","accountType":2} |
||||
|
${resp} POST On Session factory uec/authorize/by-captcha data=${LoginData} |
||||
|
${token} Get From Dictionary ${resp.json()["data"]} token #获取UECtoken |
||||
|
${userId} Get From Dictionary ${resp.json()["data"]} userId #获取用户id |
||||
|
Set Global Variable ${token} |
||||
|
Set Global Variable ${userId} |
||||
|
|
||||
|
LoginToken |
||||
|
#切换业务线token |
||||
|
Create Session factory ${yytClient} ${Client-LoginHeader} |
||||
|
#${Token} Create Dictionary loginToken=${token} |
||||
|
${Token} Set Variable {"loginToken":"${token}"} |
||||
|
${reps} POST On Session factory yyt-uec/authorize/get/product-line-token/by/login-token ${Token.encode('utf-8')} |
||||
|
${Token} Get From Dictionary ${reps.json()} data #获取业务线token |
||||
|
#Set Global Variable ${Token} |
||||
|
${client_firstlogin_header} Set Variable {'Content-Type':'application/json','Authorization':'QNT ${Token}','X-APP-ID':'503258978847966422'} #移动端首次登录headerBaseInfo |
||||
|
Set Global Variable ${client_firstlogin_header} |
||||
|
|
||||
|
BaseInfo |
||||
|
#获取用户基础信息 |
||||
|
Create Session factory ${yytClient} ${client_firstlogin_header} |
||||
|
${reps} GET On Session factory yyt-uec/get/base-info params=userId=${userId} |
||||
|
${mobile} Get From Dictionary ${reps.json()["data"]} mobile #获取用户手机号 |
||||
|
Set Global Variable ${mobile} |
||||
|
|
||||
|
完善用户信息 |
||||
|
#完善用户信息 |
||||
|
Create Session factoey ${uecClient} ${client_firstlogin_header} |
||||
|
${UserData} Set Variable {"avatar":"https://qncloudprintfiletest.oss-cn-shenzhen.aliyuncs.com/cloudprint/1697687519017.jpeg","nickname":"26用户"} |
||||
|
${reps} POST On Session factoey uec/user/update/user-info params=userId=${userId} data=${UserData.encode('utf-8')} |
||||
|
${message} Get From Dictionary ${reps.json()} message |
||||
|
Should Be Equal ${message} successful |
||||
@ -0,0 +1,26 @@ |
|||||
|
*** Settings *** |
||||
|
Library urllib3 |
||||
|
Library Collections |
||||
|
Library RequestsLibrary |
||||
|
Library DatabaseLibrary |
||||
|
|
||||
|
*** Test Cases *** |
||||
|
spu |
||||
|
#尺寸换算 |
||||
|
#获取盒型大类 |
||||
|
Create Session factory ${yytClient} ${ClientHeader} |
||||
|
${reps} GET On Session factory printing-packaging-factory-service/user/page/spu-category-by params=enable=true&parentId=1&existFormula=true |
||||
|
${records} Get From Dictionary ${reps.json()['data']} records #盒型大类列表 |
||||
|
${Json} Evaluate random.choice(${records}) random #获取随机盒型 |
||||
|
${SpuCategoryId} Get From Dictionary ${Json} id #盒型大类id |
||||
|
${SpuCategoryName} Get From Dictionary ${Json} name #盒型大类名称 |
||||
|
#获取盒型分类数据 |
||||
|
${reps} GET On Session factory printing-packaging-factory-service/user/page/spu-category-by params=enable=true&parentId=${SpuCategoryId}&level=3&existFormula=true |
||||
|
${records} Get From Dictionary ${reps.json()['data']} records #获取盒型分类列表 |
||||
|
FOR ${items} IN @{records} |
||||
|
${id} Get From Dictionary ${items} id #盒型分类id |
||||
|
${name} Get From Dictionary ${items} name #盒型分类name |
||||
|
Exit For Loop If '${name}'=='双插盒' |
||||
|
END |
||||
|
#盒型分类详情 |
||||
|
${reps} GET On Session \ printing-packaging-factory-service/user/get/spu-category-unfolding-size-calculation-detail/796099526745264128 |
||||
@ -0,0 +1,2 @@ |
|||||
|
*** Settings *** |
||||
|
Documentation 盒型尺寸换算 |
||||
Write
Preview
Loading…
Cancel
Save