diff --git a/DA_data.yaml b/DA_data.yaml index 013bb02..fd0ac1e 100644 --- a/DA_data.yaml +++ b/DA_data.yaml @@ -1,8 +1,8 @@ 婚介: - UEC域名: https://dating-agency-api-test.qniao.cn - Client域名: - Header: {'Content-Type':'application/json','X-APP-ID':'50325897884795880'} - + UEC域名: http://dating-agency-api-test.qniao.cn + Client域名: https://dating-agency-api-test.qniao.cn + Header: {'Content-Type':'application/json','X-APP-ID':'50325897884795880','Authorization':'iHP4V/g6O5DXHixyNrf7tpCK+JiAdjwqvmEI29SAae3EMtjrMqMK0q3e/2IuIuhNQVUm9nfV0euEXrYU2hFWfA=='} + Admin_Header: {'Content-Type':'application/json','X-APP-ID':'50325897884795880'} 用户: diff --git a/Login/Login.robot b/Login/Login.robot index fdb394b..4b1792b 100644 --- a/Login/Login.robot +++ b/Login/Login.robot @@ -13,6 +13,7 @@ Plogin Given 用户打开小程序 When 输入手机号获取验证码 Then 登录 + ${/} WLogin Given 用户打开小程序 diff --git a/Login/LoginResource.robot b/Login/LoginResource.robot index 6cd159e..26f1c64 100644 --- a/Login/LoginResource.robot +++ b/Login/LoginResource.robot @@ -4,6 +4,7 @@ Library AppiumLibrary *** Keywords *** 用户打开小程序 #UI自动化,连接设备 + #用户已登录过,打开小程序直接进入 Open Application http://127.0.0.1:4723/wd/hub platformName=Android platformVersion=7.1.2 deviceName=127.0.0.1:5555 #... appPackage=com.tencent.mm appActivity=ui.LauncherUI #打开微信 Click Element xpath=//android.widget.TextView[@text='微信' and @content-desc='微信'] #打开微信 @@ -12,7 +13,8 @@ Library AppiumLibrary #Click Element xpath=//android.widget.EditText[@resource-id='com.tencent.mm:id/bxz'] #点击文本输入框 sleep 1 Input Text xpath=//android.widget.EditText[@resource-id='com.tencent.mm:id/bxz'] 盒版拼拼 #文本框输入:盒版拼拼 - Click Element xpath=//android.widget.TextView[@text='盒版拼拼'] #点击搜索的结果 + sleep 1 + Click Element xpath=//android.widget.TextView[@resource-id='com.tencent.mm:id/ir3' and @text='盒版拼拼'] #点击搜索的结果 sleep 1 #Close Application diff --git a/WriteInfo/DA_data.yaml b/WriteInfo/DA_data.yaml new file mode 100644 index 0000000..013bb02 --- /dev/null +++ b/WriteInfo/DA_data.yaml @@ -0,0 +1,10 @@ +婚介: + UEC域名: https://dating-agency-api-test.qniao.cn + Client域名: + Header: {'Content-Type':'application/json','X-APP-ID':'50325897884795880'} + + + +用户: + 手机号: 15014242835 + 验证码: 888888 \ No newline at end of file diff --git a/WriteInfo/InfoResource.robot b/WriteInfo/InfoResource.robot index c48cf64..7c16c87 100644 --- a/WriteInfo/InfoResource.robot +++ b/WriteInfo/InfoResource.robot @@ -1,13 +1,117 @@ *** Settings *** Library urllib3 Library String +Library demjson Library Collections +Library JSONLibrary Library RequestsLibrary *** Keywords *** -性别 +用户首次填写${dating}资料 + Disable Warnings + #获取首次婚介资料信息 + Create Session dating ${${dating}.UEC域名} ${${dating}.Header} + ${reps} GET On Session dating /dating-agency-service/user/get/first/fill/marriage/information/details + ${Data} Get From Dictionary ${reps.json()} data + #${Data} Replace String ${Data} "None" null #将所有None改为null + ${id} Get From Dictionary ${reps.json()['data']} id #资料id + ${height} Get From Dictionary ${reps.json()['data']} height #证婚人身高 + ${nickName} Get From Dictionary ${reps.json()['data']} nickName #证婚人昵称 + ${cityCode} Get From Dictionary ${reps.json()['data']} cityCode #市编号 + ${cityName} Get From Dictionary ${reps.json()['data']} cityName #市名称 + ${birthYear} Get From Dictionary ${reps.json()['data']} birthYear #证婚人出生年份 + ${genderCode} Get From Dictionary ${reps.json()['data']} genderCode #证婚人性别 + ${incomeCode} Get From Dictionary ${reps.json()['data']} incomeCode #证婚人月收入 + ${districtCode} Get From Dictionary ${reps.json()['data']} districtCode #区编码 + ${districtName} Get From Dictionary ${reps.json()['data']} districtName #区名称 + ${provinceCode} Get From Dictionary ${reps.json()['data']} provinceCode #省编码 + ${provinceName} Get From Dictionary ${reps.json()['data']} provinceName #省名称 + ${educationCode} Get From Dictionary ${reps.json()['data']} educationCode #证婚人学历编码 + ${fillSerialNumber} Get From Dictionary ${reps.json()['data']} fillSerialNumber + ${maritalStatusCode} Get From Dictionary ${reps.json()['data']} maritalStatusCode #证婚人婚姻状况,0:未婚,1:离异,2:丧偶的 0:未婚,1:离异,2:丧偶的 + #${Information} Create Dictionary + Set Global Variable ${id} + Set Global Variable ${Data} + Set Global Variable ${height} + Set Global Variable ${nickName} + Set Global Variable ${cityCode} + Set Global Variable ${cityName} + Set Global Variable ${birthYear} + Set Global Variable ${genderCode} + Set Global Variable ${incomeCode} + Set Global Variable ${districtCode} + Set Global Variable ${districtName} + Set Global Variable ${provinceCode} + Set Global Variable ${provinceName} + Set Global Variable ${educationCode} + Set Global Variable ${fillSerialNumber} + Set Global Variable ${maritalStatusCode} -城市 +检查首次填写${dating}资料序号 + #检查首次填写序号 + Create Session dating ${${dating}.UEC域名} ${${dating}.Header} + ${reps} GET On Session dating /dating-agency-service/user/check/first/fill/marriage/information/sn + ${fillSerialNumber} Get From Dictionary ${reps.json()['data']} fillSerialNumber #填写序号 + Set Global Variable ${fillSerialNumber} + +选择${dating}性别资料 + #选择性别 + Log To Console ${CURDIR} + Disable Warnings + #用户首次填写婚介资料 + ${SexCode} Evaluate 1 #男:0,女:1 + Create Session dating ${${dating}.UEC域名} ${${dating}.Header} + ${Data} Update Value To Json ${Data} $.genderCode ${SexCode} + ${Data} Evaluate demjson.encode(${DATA}) demjson + ${Data} Replace String ${Data} "None" null + ${reps} POST On Session dating /dating-agency-service/user/save/first/fill/marriage/Information ${Data.encode('utf-8')} + ${DataId} Get From Dictionary ${reps.json()} data #获取证婚人资料id + Set Global Variable ${DataId} + #检查首次填写婚介资料序号 + +选择${dating}证婚人的城市 + #选择城市 + #获取省市区 + Disable Warnings + Create Session region http://qncloud.oss-cn-shenzhen.aliyuncs.com + ${reps} GET On Session region address.json + ${local_data} Get From Dictionary ${reps.json()} data + FOR ${province} IN @{local_data} #省列表数据 + ${provinceCode} Get From Dictionary ${province} value #获取省编码 + ${provinceName} Get From Dictionary ${province} label #获取省名称 + Exit For Loop If '${provinceName}'=='广东省' + END + ${city_data} Get From Dictionary ${province} children #广东省市列表数据 + FOR ${city} IN @{city_data} + ${cityCode} Get From Dictionary ${city} value #获取市编码 + ${cityName} Get From Dictionary ${city} label #获取市名称 + Exit For Loop If '${cityName}'=='广州市' + END + ${district_data} Get From Dictionary ${city} children #广州市列表数据 + log ${district_data} + ${district} Evaluate random.choice(${district_data}) random + ${districtCode} Get From Dictionary ${district} value #随机获取广州市区编码 + ${districtName} Get From Dictionary ${district} label #随机获取广州市区名称 + Set Global Variable ${cityCode} + Set Global Variable ${cityName} + Set Global Variable ${districtCode} + Set Global Variable ${districtName} + Set Global Variable ${provinceCode} + Set Global Variable ${provinceName} + #选择证婚人地区资料 + Create Session dating ${${dating}.UEC域名} ${${dating}.Header} + ${Data} Update Value To Json ${Data} $.id ${DataId} + ${Data} Update Value To Json ${Data} $.fillSerialNumber ${fillSerialNumber} + ${Data} Update Value To Json ${Data} $.cityCode ${cityCode} + ${Data} Update Value To Json ${Data} $.cityName ${cityName} + ${Data} Update Value To Json ${Data} $.districtCode ${districtCode} + ${Data} Update Value To Json ${Data} $.districtName ${districtName} + ${Data} Update Value To Json ${Data} $.provinceCode ${provinceCode} + ${Data} Update Value To Json ${Data} $.provinceName ${provinceName} + ${Data} Evaluate demjson.encode(${DATA}) demjson + ${Data} Replace String ${Data} "None" null + ${reps} POST On Session dating /dating-agency-service/user/save/first/fill/marriage/Information ${Data.encode('utf-8')} + #检查首次填写婚介资料序号 出生年份 diff --git a/WriteInfo/Infomation.robot b/WriteInfo/Infomation.robot index 909f6e5..7b60ae8 100644 --- a/WriteInfo/Infomation.robot +++ b/WriteInfo/Infomation.robot @@ -1,5 +1,5 @@ *** Settings *** -Suite Setup Import Variables D:\LYL\Study\Robot_framework\space\Dating-agency\DA_data.yaml +Suite Setup Import Variables ${CURDIR}\\DA_data.yaml Resource InfoResource.robot Resource ../Login/LoginResource.robot Library Collections @@ -8,8 +8,8 @@ Library RequestsLibrary *** Test Cases *** Info Given 用户打开小程序 - Then 性别 - And 城市 + Then 选择${dating}性别资料 + And 选择${dating}证婚人的城市 And 出生年份 And 身高 And 学历 @@ -19,14 +19,14 @@ Info sex_info #选择性别 - Given 用户打开小程序 - Then 性别 - And 重新进入小程序 + #Given 用户打开小程序 + Given 选择婚介性别资料 + #And 重新进入小程序 city_info #选择推荐城市 Given 用户打开小程序 - Then 城市 + Then 选择婚介证婚人的城市 And 返回上一步 And 重新进入小程序 @@ -64,3 +64,36 @@ money_info Then 月收入 And 返回上一步 And 重新进入小程序 + +region + Disable Warnings + Create Session region http://qncloud.oss-cn-shenzhen.aliyuncs.com + ${reps} GET On Session region address.json + ${local_data} Get From Dictionary ${reps.json()} data + FOR ${province} IN @{local_data} #省列表数据 + ${provinceCode} Get From Dictionary ${province} value #获取省编码 + ${provinceName} Get From Dictionary ${province} label #获取省名称 + Exit For Loop If '${provinceName}'=='广东省' + END + ${city_data} Get From Dictionary ${province} children #广东省市列表数据 + FOR ${city} IN @{city_data} + ${cityCode} Get From Dictionary ${city} value #获取市编码 + ${cityName} Get From Dictionary ${city} label #获取市名称 + Exit For Loop If '${cityName}'=='广州市' + END + ${district_data} Get From Dictionary ${city} children #广州市列表数据 + log ${district_data} + ${district} Evaluate random.choice(${district_data}) random + ${districtCode} Get From Dictionary ${district} value #随机获取广州市区编码 + ${districtName} Get From Dictionary ${district} label #随机获取广州市区名称 + Set Global Variable ${cityCode} + Set Global Variable ${cityName} + Set Global Variable ${districtCode} + Set Global Variable ${districtName} + Set Global Variable ${provinceCode} + Set Global Variable ${provinceName} + +test + Given 用户首次填写婚介资料 + Then 选择婚介性别资料 + And 选择婚介证婚人的城市