From 97df4b4c9414696ed4cc18edc3a140f652faeb44 Mon Sep 17 00:00:00 2001 From: LG_lai Date: Thu, 16 Nov 2023 16:41:53 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=AF=E4=BB=98=E8=AE=A2=E5=8D=95=E3=80=81?= =?UTF-8?q?=E8=BF=90=E8=90=A5=E7=AB=AF=E7=99=BB=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 000-LoginToken/000-dataDriven.robot | 6 +++++ 000-LoginToken/Client-Login.robot | 6 ----- 000-LoginToken/Operation-Login.robot | 37 ++++++++++++++++++++++++++++ 003-CreateOrder/Order.robot | 23 +++++++++++------ 004-Operation/001-OrderManage.robot | 22 +++++++++++++++++ 5 files changed, 81 insertions(+), 13 deletions(-) create mode 100644 004-Operation/001-OrderManage.robot diff --git a/000-LoginToken/000-dataDriven.robot b/000-LoginToken/000-dataDriven.robot index 197f99b..f4fbac5 100644 --- a/000-LoginToken/000-dataDriven.robot +++ b/000-LoginToken/000-dataDriven.robot @@ -20,17 +20,23 @@ LoginBase #登录Header ${Client-LoginHeader} Set Variable {'Content-Type':'application/json','X-APP-ID':'503258978847966422'} #客户端登录Header ${Factory-LoginHeader} Set Variable {'Content-Type':'application/json','X-APP-ID':'503258978847966422'} #工厂端登录Header + ${WOperation-LoginHeader} Set Variable {'Content-Type':'application/json','X-APP-ID':'503258978847966425'} #Web运营端Header Set Global Variable ${Client-LoginHeader} Set Global Variable ${Factory-LoginHeader} + Set Global Variable ${WOperation-LoginHeader} #登录账号 ${New_account} Set Variable 12222222226 #新用户登录 ${client_account} Set Variable 15014242835 #客户端登录账号 ${factory_account} Set Variable 15014242835 #工厂端登录账号 + ${woperation_account} Set Variable 15014242835 #Web客户端登录账号 Set Global Variable ${New_account} Set Global Variable ${client_account} Set Global Variable ${factory_account} + Set Global Variable ${woperation_account} #登录密码 ${client_password} Set Variable 888888 #客户端登录密码 ${factory_password} Set Variable 888888 #工厂端登录密码 + ${woperation_password} Set Variable 888888 #Web客户端登录密码 Set Global Variable ${client_password} Set Global Variable ${client_password} + Set Global Variable ${woperation_password} diff --git a/000-LoginToken/Client-Login.robot b/000-LoginToken/Client-Login.robot index 27041a6..5f797c1 100644 --- a/000-LoginToken/Client-Login.robot +++ b/000-LoginToken/Client-Login.robot @@ -6,12 +6,6 @@ Library RequestsLibrary Library DatabaseLibrary *** Test Cases *** -NewLogin - #新用户登录 - Create Session factory ${uecClient} ${Client-LoginHeader} - ${data} Set Variable {"authCode":"0f3wAd0w3dASy13Mkk2w3q8rqC2wAd0P","authMethod":"WeChatMiniProgram"} #拉取微信 - ${reps} POST On Session factory uec/authorize/by-oauth2 data=${data} - uec-login #登录uec #普通用户账号密码登录 diff --git a/000-LoginToken/Operation-Login.robot b/000-LoginToken/Operation-Login.robot index 58582c6..badbe7c 100644 --- a/000-LoginToken/Operation-Login.robot +++ b/000-LoginToken/Operation-Login.robot @@ -5,3 +5,40 @@ Library Collections Library RequestsLibrary *** Test Cases *** +uec-login + #账号密码登录获取UECtoken + Disable Warnings + Create Session opr-center ${uecClient} ${WOperation-LoginHeader} + ${LoginData} Set Variable { \ \ \ \ "account":"${woperation_account}", \ \ \ \ "accountType":2, \ \ \ \ "captcha":"${woperation_password}", \ \ \ \ "$loginType":"telphone", \ \ \ \ "$isNextAutoLogin":true } + ${reps} POST On Session opr-center uec/authorize/by-captcha ${LoginData.encode('utf-8')} + ${Otoken} Get From Dictionary ${reps.json()['data']} token #获取UECtoken + ${OuserId} Get From Dictionary ${reps.json()['data']} userId #获取用户id + Set Global Variable ${Otoken} + Set Global Variable ${OuserId} + +Login-Token + #转换业务线token + Create Session opr-center ${yytClient} ${WOperation-LoginHeader} + ${LoginData} Set Variable { \ \ \ \ "loginToken":"${Otoken}", \ \ \ \ "$configs":{ \ \ \ \ \ \ \ \ "$isBizFailedNotToast":true \ \ \ \ } } + ${reps} POST On Session opr-center cloud-print-user-center/authorize/get/product-line-token/by/login-token ${LoginData.encode('utf-8')} + ${LoginToken} Get From Dictionary ${reps.json()} data #获取业务线token + ${operation_firstlogin_header} Set Variable {'Content-Type':'application/json','Authorization':'${LoginToken}','X-APP-ID':'503258978847966425'} + Set Global Variable ${LoginToken} + Set Global Variable ${operation_firstlogin_header} + +base-info + #获取登录用户基础信息 + Create Session opr-center ${yytClient} ${operation_firstlogin_header} + ${reps} GET On Session opr-center yyt-uec/get/base-info + ${organizationList} Get From Dictionary ${reps.json()['data']} organizationList #获取用户的组织列表 + FOR ${List} IN @{organizationList} + ${factoryId} Get From Dictionary ${List['factoryList'][0]} id #工厂id + ${enterpriseId} Get From Dictionary ${List} enterpriseId #企业id + ${organizationId} Get From Dictionary ${List} organizationId #组织id + Exit For Loop If '${enterpriseId}'=='723635193163943936' #普睿特企业id + END + ${OperationHeader} Set Variable {'Content-Type':'application/json','Authorization':'${LoginToken}','X-APP-ID':'503258978847966425','X-Factory-Id':'${factoryId}','X-Organization-Id':'${organizationId}','X-Enterprise-Id':'${enterpriseId}'} + Set Global Variable ${factoryId} + Set Global Variable ${enterpriseId} + Set Global Variable ${organizationId} + Set Global Variable ${OperationHeader} diff --git a/003-CreateOrder/Order.robot b/003-CreateOrder/Order.robot index 8280544..1eee110 100644 --- a/003-CreateOrder/Order.robot +++ b/003-CreateOrder/Order.robot @@ -3,14 +3,14 @@ Documentation 拼版下单 Test Teardown Run Keyword If Test Failed Fatal Error Test Timeout Library urllib3 +Library String +Library demjson Library Collections +Library HttpLibrary +Library JSONLibrary Library RequestsLibrary Library DatabaseLibrary -Library JSONLibrary -Library demjson -Library HttpLibrary Library HttpLibrary.HTTP -Library String *** Test Cases *** spuDetail @@ -120,8 +120,8 @@ Quotation ${TotalPrice} Evaluate round(${Material}+${Technology},2) #总价 ${Price} Set Variable If '${TotalPrice}'<='125' 125 ${TotalPrice} #比较价格 ${DATA} Evaluate demjson.encode(${DATA}) demjson - ${DATA} Replace String ${DATA} None null - ${DATA} Replace String ${DATA} "null" null + ${DATA} Replace String ${DATA} "None" null + #${DATA} Replace String ${DATA} "null" null ${DATA} Convert Json To String ${DATA} Should Be Equal As Numbers ${Amount} ${Price} Set Global Variable ${desc} @@ -287,7 +287,16 @@ CreateOrder ${OrderData} Set Variable { \ \ \ \ "remark":"", \ \ \ \ "totalAmount":"${TotalAmount}", \ \ \ \ "taxFee":"${InvoicePrice}", \ \ \ \ "taxRate":"${InvoiceData}", \ \ \ \ "logisticsFee":"${Charges}", \ \ \ \ "supplierFactoryId":"${factoryId}", \ \ \ \ "supplierOrgId":"${orgId}", \ \ \ \ "customerContactsName":"${consigneeName}", \ \ \ \ "customerContactsPhone":"${consigneeMobile}", \ \ \ \ "deliveryAddressCityId":"${CityId}", \ \ \ \ "deliveryAddressCityName":"${cityName}", \ \ \ \ "deliveryAddressDistrictId":"${DistrictId}", \ \ \ \ "deliveryAddressDistrictName":"${districtName}", \ \ \ \ "shippingAddressId":"${AddressId}", \ \ \ \ "deliveryAddressLocDetails":"${AddressDetail}", \ \ \ \ "deliveryAddressProvinceId":"${ProvinceId}", \ \ \ \ "deliveryAddressProvinceName":"${provinceName}", \ \ \ \ "packingMethod":1, \ \ \ \ "salesOrderInvoice":{ \ \ \ \ \ \ \ \ "type":1, \ \ \ \ \ \ \ \ "invoiceTitleId":"${invoiceTitleId}", \ \ \ \ \ \ \ \ "entityType":"1", \ \ \ \ \ \ \ \ "invoicingEnterpriseAddress":"${invoicingEnterpriseAddress}", \ \ \ \ \ \ \ \ "invoicingEnterpriseName":"${invoicingEnterpriseName}", \ \ \ \ \ \ \ \ "invoicingEnterpriseOpeningBank":"${invoicingEnterpriseOpeningBank}", \ \ \ \ \ \ \ \ "invoicingEnterprisePhone":"${invoicingEnterprisePhone}", \ \ \ \ \ \ \ \ "invoicingOpenAccount":"${invoicingOpenAccount}", \ \ \ \ \ \ \ \ "taxpayerIdentificationNumber":"${taxpayerIdentificationNumber}" \ \ \ \ }, \ \ \ \ "salesOrderItemProduct":{ \ \ \ \ \ \ \ \ "productName":"${productName}", \ \ \ \ \ \ \ \ "productId":"${productId}", \ \ \ \ \ \ \ \ "amount":"${Amount}", \ \ \ \ \ \ \ \ "quantity":"${quantity}", \ \ \ \ \ \ \ \ "price":"${unitprice}", \ \ \ \ \ \ \ \ "productImgUrl":"${url}", \ \ \ \ \ \ \ \ "factoryId":"${factoryId}", \ \ \ \ \ \ \ \ "orgId":"${orgId}", \ \ \ \ \ \ \ \ "orderSource":1, \ \ \ \ \ \ \ \ "desc":"${desc}", \ \ \ \ \ \ \ \ "productMeasureDesc":"${productArea}", \ \ \ \ \ \ \ \ "productMaterialDesc":"${productMaterialDesc}", \ \ \ \ \ \ \ \ "productProcessDesc":"${productProcessDesc}", \ \ \ \ \ \ \ \ "copyFromId":null, \ \ \ \ \ \ \ \ "productSpecDetailJson":${DATA}, \ \ \ \ \ \ \ \ "productSpecDetail":"${desc}" \ \ \ \ }, \ \ \ \ "orderSource":1 } log ${OrderData} ${reps} POST On Session factory printing-package-mall-service/user/create/sales-order ${OrderData.encode('utf-8')} - ${OrderId} Get From Dictionary ${reps.json()} data #订单id + ${orderid} Get From Dictionary ${reps.json()} data #订单id + Set Global Variable ${orderid} + #支付订单 + ${OrderPay} Set Variable {"businessType":202,"tradeOrderId":"${orderid}"} + ${reps} POST On Session factory wallet-service/user/prepay/wallet-bill ${OrderPay.encode('utf-8')} + ${PayId} Get From Dictionary ${reps.json()['data']} id #获取支付id + ${IdData} Set Variable {"id":"${PayId}"} + ${reps} POST On Session factory /wallet-service/user/confirm/wallet-account-pay ${IdData.encode('utf-8')} + ${message} Get From Dictionary ${reps.json()} message + Should Be Equal ${message} successful #校验是否一致 TestCase ${Data} Set Variable { \ \ \ \ \ \ \ \ "amount":0.28, \ \ \ \ \ \ \ \ "detailItemName":"测试", \ \ \ \ \ \ \ \ "discountAmount":0, \ \ \ \ \ \ \ \ "formula":"None", \ \ \ \ \ \ \ \ "nodeIdList":"None", \ \ \ \ \ \ \ \ "originalAmount":0.28, \ \ \ \ \ \ \ \ "settlementName":"小小", \ \ \ \ \ \ \ \ "settlementNameEnum":1, \ \ \ \ \ \ \ \ "spuSpecItemType":"None", \ \ \ \ \ \ \ \ "topic":"开心麻花" } diff --git a/004-Operation/001-OrderManage.robot b/004-Operation/001-OrderManage.robot new file mode 100644 index 0000000..aa366e2 --- /dev/null +++ b/004-Operation/001-OrderManage.robot @@ -0,0 +1,22 @@ +*** Settings *** +Documentation 订单管理 +Library urllib3 +Library String +Library demjson +Library Collections +Library RequestsLibrary + +*** Test Cases *** +salesOrder + #销售订单 + Create Session opr-center ${yytClient} ${OperationHeader} + ${reps} GET On Session opr-center printing-packaging-factory-service/user/page/printing-sales-order params=status=&pageNum=1&pageSize=10&orderQueryType=0 + ${orderList} Get From Dictionary ${reps.json()['data']} records #获取销售单列表 + FOR ${OrderList} IN @{orderList} + ${OrderId} Get From Dictionary ${OrderList} id #获取销售单id + ${OrderCode} Get From Dictionary ${OrderList} orderCode #获取销售单号 + Exit For Loop If '${OrderId}'=='922542346799812608' #判断订单号是否相等 + #Exit For Loop If '${OrderId}'=='${orderid}' #判断订单号是否相等 + END + Set Global Variable ${OrderId} + Set Global Variable ${OrderCode}