Authored by 李犇

订单、商品详情、首页、tab切换测试用例——review by 陈林

... ... @@ -7,8 +7,14 @@ module.exports.iOS_TAB_CATEGORY = 'iOS_TAB_CATEGORY';
module.exports.iOS_TAB_GUANG = 'iOS_TAB_GUANG';
module.exports.IOS_PRODUCT_DETAIL_GROUP = 'IOS_PRODUCT_DETAIL_GROUP';
module.exports.ANDROID_TAB_HOME = 'ANDROID_TAB_HOME';
module.exports.ANDROID_TAB_CATEGORY = 'ANDROID_TAB_CATEGORY';
module.exports.ANDROID_TAB_GUANG = 'ANDROID_TAB_GUANG';
module.exports.ANDROID_CASE_UFO_BROWSE = 'ANDROID_CASE_UFO_BROWSE';
module.exports.ANDROID_TAB_MINE = 'ANDROID_TAB_MINE';
module.exports.ANDROID_MAINTAB_SWITCH = 'ANDROID_MAINTAB_SWITCH';
module.exports.ANDROID_PRODUCT_DETAIL = 'ANDROID_PRODUCT_DETAIL';
module.exports.ANDROID_UFO_PRODUCT_DETAIL = 'ANDROID_UFO_PRODUCT_DETAIL';
module.exports.ANDROID_PRODUCT_CART = 'ANDROID_PRODUCT_CART';
module.exports.ANDROID_CASE_UFO_BROWSE = 'ANDROID_CASE_UFO_BROWSE';
module.exports.ANDROID_CASE_UFO_SELL = 'ANDROID_CASE_UFO_SELL';
module.exports.ANDROID_ORDER_CONFIRM = 'ANDROID_ORDER_CONFIRM';
\ No newline at end of file
... ...
const {
ANDROID_ORDER_CONFIRM
} = require('../../scene-types/scene-types');
module.exports = {
[ANDROID_ORDER_CONFIRM]: [
{ op: 'YB_PAGE_ENTER', name: '进入商品详情页', equals: { PAGE_ID: 'spxqy' } },
{
op: 'YB_GDS_DT_INFO', name: '请求商品数据成功', validate: (log) => {
return log.param.PRD_SKN.length > 0;
}
},
{
op: 'YB_GDS_COLOR_C', name: '点击颜色(可以没有 如果只有一个颜色是不可点击的)', validate: (log) => {
return log.param.PRD_ID.length > 0 && log.param.COLOR.length > 0;
}
},
{
op: 'YB_GDS_SIZE_C', name: '点击尺码(可以没有 如果只有一个尺码是不可点击的)', validate: (log) => {
return log.param.PRD_ID.length > 0 && log.param.SIZE.length > 0;
}
},
{
op: 'YB_GDS_DT_SEL', name: '加入购物车', validate: (log) => {
return log.param.PRD_SKU > 0;
}
},
//套餐商品接口上报
{
op: 'YB_GDS_PACKAGE_L', name: '套餐商品接口上报', types: { LIST: Array }, validate: (log) => {
return log.param.PRD_ID.length > 0;
}
},
//售罄商品 推荐商品列表上报
{
op: 'YB_CHOOSE_FOR_YOU', name: '售罄商品 推荐商品列表上报', equals: { REC_POSE: '100025', ACTION_ID:'0'}, validate: (log) => {
return log.param.PRD_ID.length > 0 && log.param.MAIN_SKN.length > 0;
}
},
//点击售罄商品 推荐商品列表展开按钮
{
op: 'YB_GDS_DT_SHOW_RES_C', name: '点击售罄商品 推荐商品列表展开按钮', validate: (log) => {
return log.param.STATUS.length > 0 && log.param.MAIN_SKN.length > 0;
}
},
//店铺推荐的商品列表
{
op: 'YB_CHOOSE_FOR_YOU', name: '店铺推荐的商品列表', equals: { REC_POSE: '100029', ACTION_ID: '0' }, validate: (log) => {
return log.param.PRD_ID.length > 0;
}
},
//点击店铺推荐的商品列表
{
op: 'YB_CHOOSE_FOR_YOU', name: '点击店铺推荐的商品列表', equals: { REC_POSE: '100029', ACTION_ID: '1' }, validate: (log) => {
return log.param.PRD_ID.length > 0;
}
},
//点击商品详情
{
op: 'YB_GDS_DT_BUY', name: '点击商品详情', validate: (log) => {
return log.param.PRD_ID.length > 0;
}
},
//点击在线客服
{ op: 'YB_MY_OLCS', name: '点击在线客服', equals: { TYPE: '1' } },
//立即购买
{
op: 'YB_GDS_DT_BILL', name: '立即购买', validate: (log) => {
return log.param.PRD_SKN.length > 0 && log.param.PRD_SKU.length > 0 && log.param.PRD_TYPE.length > 0;
}
},
//点击提问问题按钮
{ op: 'YB_GDS_DT_ASK', name: '点击提问问题按钮', types: { PRD_ID: String, TOURL: String } },
//点击店铺按钮
{ op: 'YB_BRAND_SHOP_C', name:'点击店铺按钮', types:{SHOP_ID:String, POS_ID:String}},
//点击套餐
{ op: 'YB_GDS_PACKAGE_C', name: '点击套餐', types: { PRD_ID: String } },
//点击分享
{ op: 'YB_GDS_DT_SHARE', name: '点击分享', types: { PRD_ID: String, BR_ID: String, TOURL: String } },
//分享商品
{ op: 'YB_SHARE_PRODUCT', name: '分享商品', equals: { FROM: 'pt' }, types: { PRD_ID: String, BR_ID: String, TOURL: String } },
]
};
... ...
const {
ANDROID_PRODUCT_DETAIL
} = require('../../scene-types/scene-types');
module.exports = {
[ANDROID_PRODUCT_DETAIL]: [
{ op: 'YB_PAGE_ENTER', name: '进入商品详情页', equals: { PAGE_ID: 'spxqy' } },
{
op: 'YB_GDS_DT_INFO', name: '请求商品数据成功', validate: (log) => {
return log.param.PRD_SKN.length > 0;
}
},
{
op: 'YB_GDS_COLOR_C', name: '点击颜色(可以没有 如果只有一个颜色是不可点击的)', validate: (log) => {
return log.param.PRD_ID.length > 0 && log.param.COLOR.length > 0;
}
},
{
op: 'YB_GDS_SIZE_C', name: '点击尺码(可以没有 如果只有一个尺码是不可点击的)', validate: (log) => {
return log.param.PRD_ID.length > 0 && log.param.SIZE.length > 0;
}
},
{
op: 'YB_GDS_DT_SEL', name: '加入购物车', validate: (log) => {
return log.param.PRD_SKU > 0;
}
},
//套餐商品接口上报
{
op: 'YB_GDS_PACKAGE_L', name: '套餐商品接口上报', types: { LIST: Array }, validate: (log) => {
return log.param.PRD_ID.length > 0;
}
},
//售罄商品 推荐商品列表上报
{
op: 'YB_CHOOSE_FOR_YOU', name: '售罄商品 推荐商品列表上报', equals: { REC_POSE: '100025', ACTION_ID:'0'}, validate: (log) => {
return log.param.PRD_ID.length > 0 && log.param.MAIN_SKN.length > 0;
}
},
//点击售罄商品 推荐商品列表展开按钮
{
op: 'YB_GDS_DT_SHOW_RES_C', name: '点击售罄商品 推荐商品列表展开按钮', validate: (log) => {
return log.param.STATUS.length > 0 && log.param.MAIN_SKN.length > 0;
}
},
//店铺推荐的商品列表
{
op: 'YB_CHOOSE_FOR_YOU', name: '店铺推荐的商品列表', equals: { REC_POSE: '100029', ACTION_ID: '0' }, validate: (log) => {
return log.param.PRD_ID.length > 0;
}
},
//点击店铺推荐的商品列表
{
op: 'YB_CHOOSE_FOR_YOU', name: '点击店铺推荐的商品列表', equals: { REC_POSE: '100029', ACTION_ID: '1' }, validate: (log) => {
return log.param.PRD_ID.length > 0;
}
},
//点击商品详情
{
op: 'YB_GDS_DT_BUY', name: '点击商品详情', validate: (log) => {
return log.param.PRD_ID.length > 0;
}
},
//点击在线客服
{ op: 'YB_MY_OLCS', name: '点击在线客服', equals: { TYPE: '1' } },
//立即购买
{
op: 'YB_GDS_DT_BILL', name: '立即购买', validate: (log) => {
return log.param.PRD_SKN.length > 0 && log.param.PRD_SKU.length > 0 && log.param.PRD_TYPE.length > 0;
}
},
//点击提问问题按钮
{ op: 'YB_GDS_DT_ASK', name: '点击提问问题按钮', types: { PRD_ID: String, TOURL: String } },
//点击店铺按钮
{ op: 'YB_BRAND_SHOP_C', name:'点击店铺按钮', types:{SHOP_ID:String, POS_ID:String}},
//点击套餐
{ op: 'YB_GDS_PACKAGE_C', name: '点击套餐', types: { PRD_ID: String } },
//点击分享
{ op: 'YB_GDS_DT_SHARE', name: '点击分享', types: { PRD_ID: String, BR_ID: String, TOURL: String } },
//分享商品
{ op: 'YB_SHARE_PRODUCT', name: '分享商品', equals: { FROM: 'pt' }, types: { PRD_ID: String, BR_ID: String, TOURL: String } },
]
};
... ...
const {
ANDROID_TAB_HOME
} = require('../../scene-types/scene-types');
module.exports = {
[ANDROID_TAB_HOME]:[
{op: 'YB_LAUNCH_APP', name: '启动app', single: true},
{op: 'YB_ENTER_CHOICE', name: '性别男女入口', single: true, validate: (log) => {
return ((log.param.ENT_TYP === '1' && log.param.SUB_C_ID === '1' && log.param.C_ID === '1')
|| (log.param.ENT_TYP === '0' && log.param.SUB_C_ID === '2' && log.param.C_ID === '2'));
}},
{op: 'YB_MAIN_SHOW', name: '底部首页点击'},
{op: 'YB_PAGE_ENTER', name: '欢迎页载入', equals: { PAGE_ID: 'start' }},
{op: 'YB_PAGE_EXIT', name: '欢迎页载出', equals: { PAGE_ID: 'start' }},
{op: 'YB_PAGE_ENTER', name: '频道选择页载入', equals: { PAGE_ID: 'xbxzy' }},
{op: 'YB_PAGE_EXIT', name: '频道选择页载出', equals: { PAGE_ID: 'xbxzy' }},
{op: 'YB_PAGE_ENTER', name: '首页载入', equals: { PAGE_ID: 'sy' }},
{op: 'YB_PAGE_EXIT', name: '首页载出', equals: { PAGE_ID: 'sy' }},
{op: 'YB_PAGE_ENTER', name: '首页载入', equals: { PAGE_ID: 'sy' }},
{op: 'YB_PAGE_EXIT', name: '首页载出', equals: { PAGE_ID: 'sy' }},
{op: 'YB_PAGE_ENTER', name: '首页载入', equals: { PAGE_ID: 'sy' }},
{op: 'YB_PAGE_EXIT', name: '首页载出', equals: { PAGE_ID: 'sy' }},
{op: 'YB_PAGE_ENTER', name: '首页载入', equals: { PAGE_ID: 'sy' }},
{op: 'YB_PAGE_EXIT', name: '首页载出', equals: { PAGE_ID: 'sy' }},
{op: 'YB_PAGE_ENTER', name: '首页载入', equals: { PAGE_ID: 'sy' }},
{op: 'YB_PAGE_EXIT', name: '首页载出', equals: { PAGE_ID: 'sy' }},
{op: 'YB_PAGE_ENTER', name: '首页载入', equals: { PAGE_ID: 'sy' }},
{op: 'YB_PAGE_EXIT', name: '首页载出', equals: { PAGE_ID: 'sy' }},
{op: 'YB_SHOW_MAIN_RECOMMEND', name: '首页猜你喜欢接口曝光1469', types:{DATA: Array}, equals: { SUB_C_ID:'1469'}},
{op: 'YB_SHOW_MAIN_RECOMMEND', name: '首页猜你喜欢接口曝光2073', types:{DATA: Array}, equals: { SUB_C_ID:'2073'}},
{op: 'YB_SHOW_MAIN_RECOMMEND', name: '首页猜你喜欢接口曝光1951', types:{DATA: Array}, equals: { SUB_C_ID:'1951'}},
{op: 'YB_SHOW_MAIN_RECOMMEND', name: '首页猜你喜欢接口曝光1', types:{DATA: Array}, equals: { SUB_C_ID:'1'}},
{op: 'YB_SHOW_MAIN_RECOMMEND', name: '首页猜你喜欢接口曝光2', types:{DATA: Array}, equals: { SUB_C_ID:'2'}},
{op: 'YB_SHOW_MAIN_RECOMMEND', name: '首页猜你喜欢接口曝光3', types:{DATA: Array}, equals: { SUB_C_ID:'3'}},
{op: 'YB_SHOW_EVENT',},
{op: 'YB_CHOOSE_FOR_YOU', name: '首页猜你喜欢接口曝光1469', equals: { SUB_C_ID:'1469'}},
{op: 'YB_CHOOSE_FOR_YOU', name: '首页猜你喜欢接口曝光2073', equals: { SUB_C_ID:'2073'}},
{op: 'YB_CHOOSE_FOR_YOU', name: '首页猜你喜欢接口曝光1951', equals: { SUB_C_ID:'1951'}},
{op: 'YB_CHOOSE_FOR_YOU', name: '首页猜你喜欢接口曝光1', equals: { SUB_C_ID:'1'}},
{op: 'YB_CHOOSE_FOR_YOU', name: '首页猜你喜欢接口曝光2', equals: { SUB_C_ID:'2'}},
{op: 'YB_CHOOSE_FOR_YOU', name: '首页猜你喜欢接口曝光3', equals: { SUB_C_ID:'3'}},
{op: 'YB_HOME_CHANNEL_TAB_C', name: '首次启动默认tab上报'},
{op: 'YB_HOME_CHANNEL_TAB_C', name: '首页内tab_channel1', equals: { CHANNEL_ID: '1', SUB_C_ID:'1'}},
{op: 'YB_HOME_CHANNEL_TAB_C', name: '首页内tab_channel2', equals: { CHANNEL_ID: '2', SUB_C_ID:'2'}},
{op: 'YB_HOME_CHANNEL_TAB_C', name: '首页内tab_channel3', equals: { CHANNEL_ID: '3', SUB_C_ID:'3'}},
{op: 'YB_HOME_CHANNEL_TAB_C', name: '首页内tab_channel2073', equals: { CHANNEL_ID: '2073', SUB_C_ID:'2073'}},
{op: 'YB_HOME_CHANNEL_TAB_C', name: '首页内tab_channel1951', equals: { CHANNEL_ID: '1951', SUB_C_ID:'1951'}},
{op: 'YB_HOME_CHANNEL_TAB_C', name: '首页内tab_channel1469', equals: { CHANNEL_ID: '1469', SUB_C_ID:'1469'}},
]
};
\ No newline at end of file
... ...
const {
ANDROID_MAINTAB_SWITCH
} = require('../../scene-types/scene-types');
module.exports = {
[ANDROID_MAINTAB_SWITCH]:[
{op: 'YB_LAUNCH_APP', name: '启动app', single: true},
{op: 'YB_ENTER_CHOICE', name: '性别男女入口', single: true, validate: (log) => {
return ((log.param.ENT_TYP === '1' && log.param.SUB_C_ID === '1' && log.param.C_ID === '1')
|| (log.param.ENT_TYP === '0' && log.param.SUB_C_ID === '2' && log.param.C_ID === '2'));
}},
{op: 'YB_MAIN_SHOW', name: '底部首页点击'},
{op: 'YB_PAGE_ENTER', name: '欢迎页载入', equals: { PAGE_ID: 'start' }},
{op: 'YB_PAGE_EXIT', name: '欢迎页载出', equals: { PAGE_ID: 'start' }},
{op: 'YB_PAGE_ENTER', name: '频道选择页载入', equals: { PAGE_ID: 'xbxzy' }},
{op: 'YB_PAGE_EXIT', name: '频道选择页载出', equals: { PAGE_ID: 'xbxzy' }},
{op: 'YB_PAGE_ENTER', name: '首页载入', equals: { PAGE_ID: 'sy' }},
{op: 'YB_PAGE_EXIT', name: '首页载出', equals: { PAGE_ID: 'sy' }},
{op: 'YB_PAGE_ENTER', name: '首页载入', equals: { PAGE_ID: 'sy' }},
{op: 'YB_PAGE_EXIT', name: '首页载出', equals: { PAGE_ID: 'sy' }},
{op: 'YB_PAGE_ENTER', name: '首页载入', equals: { PAGE_ID: 'sy' }},
{op: 'YB_PAGE_EXIT', name: '首页载出', equals: { PAGE_ID: 'sy' }},
{op: 'YB_PAGE_ENTER', name: '首页载入', equals: { PAGE_ID: 'sy' }},
{op: 'YB_PAGE_EXIT', name: '首页载出', equals: { PAGE_ID: 'sy' }},
{op: 'YB_PAGE_ENTER', name: '首页载入', equals: { PAGE_ID: 'sy' }},
{op: 'YB_PAGE_EXIT', name: '首页载出', equals: { PAGE_ID: 'sy' }},
{op: 'YB_PAGE_ENTER', name: '首页载入', equals: { PAGE_ID: 'sy' }},
{op: 'YB_PAGE_EXIT', name: '首页载出', equals: { PAGE_ID: 'sy' }},
{op: 'YB_SHOW_MAIN_RECOMMEND', name: '首页猜你喜欢接口曝光1469', types:{DATA: Array}, equals: { SUB_C_ID:'1469'}},
{op: 'YB_SHOW_MAIN_RECOMMEND', name: '首页猜你喜欢接口曝光2073', types:{DATA: Array}, equals: { SUB_C_ID:'2073'}},
{op: 'YB_SHOW_MAIN_RECOMMEND', name: '首页猜你喜欢接口曝光1951', types:{DATA: Array}, equals: { SUB_C_ID:'1951'}},
{op: 'YB_SHOW_MAIN_RECOMMEND', name: '首页猜你喜欢接口曝光1', types:{DATA: Array}, equals: { SUB_C_ID:'1'}},
{op: 'YB_SHOW_MAIN_RECOMMEND', name: '首页猜你喜欢接口曝光2', types:{DATA: Array}, equals: { SUB_C_ID:'2'}},
{op: 'YB_SHOW_MAIN_RECOMMEND', name: '首页猜你喜欢接口曝光3', types:{DATA: Array}, equals: { SUB_C_ID:'3'}},
{op: 'YB_SHOW_EVENT',},
{op: 'YB_CHOOSE_FOR_YOU', name: '首页猜你喜欢接口曝光1469', equals: { SUB_C_ID:'1469'}},
{op: 'YB_CHOOSE_FOR_YOU', name: '首页猜你喜欢接口曝光2073', equals: { SUB_C_ID:'2073'}},
{op: 'YB_CHOOSE_FOR_YOU', name: '首页猜你喜欢接口曝光1951', equals: { SUB_C_ID:'1951'}},
{op: 'YB_CHOOSE_FOR_YOU', name: '首页猜你喜欢接口曝光1', equals: { SUB_C_ID:'1'}},
{op: 'YB_CHOOSE_FOR_YOU', name: '首页猜你喜欢接口曝光2', equals: { SUB_C_ID:'2'}},
{op: 'YB_CHOOSE_FOR_YOU', name: '首页猜你喜欢接口曝光3', equals: { SUB_C_ID:'3'}},
{op: 'YB_HOME_CHANNEL_TAB_C', name: '首次启动默认tab上报'},
{op: 'YB_HOME_CHANNEL_TAB_C', name: '首页内tab_channel1', equals: { CHANNEL_ID: '1', SUB_C_ID:'1'}},
{op: 'YB_HOME_CHANNEL_TAB_C', name: '首页内tab_channel2', equals: { CHANNEL_ID: '2', SUB_C_ID:'2'}},
{op: 'YB_HOME_CHANNEL_TAB_C', name: '首页内tab_channel3', equals: { CHANNEL_ID: '3', SUB_C_ID:'3'}},
{op: 'YB_HOME_CHANNEL_TAB_C', name: '首页内tab_channel2073', equals: { CHANNEL_ID: '2073', SUB_C_ID:'2073'}},
{op: 'YB_HOME_CHANNEL_TAB_C', name: '首页内tab_channel1951', equals: { CHANNEL_ID: '1951', SUB_C_ID:'1951'}},
{op: 'YB_HOME_CHANNEL_TAB_C', name: '首页内tab_channel1469', equals: { CHANNEL_ID: '1469', SUB_C_ID:'1469'}},
]
};
\ No newline at end of file
... ...
const wd = require('wd');
const {describe} = require('../../libs/driver');
const {ANDROID_ORDER_CONFIRM} = require('../../scene-types/scene-types');
const {FIND_VIEW_OVER_TIME, ACTION_PAUSE_TIME} = require('../../config/constant');
describe(ANDROID_ORDER_CONFIRM, '下单', async(driver) => {
//点击首页的tab bar 分类按钮
let categoryTab = await driver.waitForElementById('com.yoho:id/tabMain_radioImage_sort_rl', FIND_VIEW_OVER_TIME);
await categoryTab.click();
//点击分类中的 其中一个分类
let category = await driver.waitForElementByXPath("/hierarchy/android.widget.FrameLayout/android.widget.FrameLayout/android.view.ViewGroup[1]/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.RelativeLayout/android.widget.FrameLayout[1]/android.widget.RelativeLayout/android.widget.FrameLayout/android.widget.RelativeLayout/android.widget.FrameLayout/android.widget.RelativeLayout/android.widget.LinearLayout/android.view.ViewGroup/android.support.v7.widget.RecyclerView/android.widget.LinearLayout[1]/android.widget.GridView/android.widget.RelativeLayout[1]/android.widget.ImageView", FIND_VIEW_OVER_TIME);
await category.click();
// 暂停
await driver.sleep(ACTION_PAUSE_TIME);
//点击其中的一个商品
let firstProduct = await driver.waitForElementByXPath("/hierarchy/android.widget.FrameLayout/android.widget.FrameLayout/android.view.ViewGroup[1]/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.RelativeLayout/android.widget.RelativeLayout/android.widget.ScrollView/android.widget.LinearLayout/android.support.v4.view.ViewPager/android.widget.RelativeLayout/android.widget.RelativeLayout/android.widget.RelativeLayout[1]/android.widget.LinearLayout/android.widget.FrameLayout/android.support.v7.widget.RecyclerView/android.widget.RelativeLayout[1]/android.widget.LinearLayout/android.widget.RelativeLayout/android.widget.ImageView[1]");
await firstProduct.click();
// 暂停
await driver.sleep(ACTION_PAUSE_TIME);
//点击加入购物车(弹出尺码选择框)
let addToCart = await driver.waitForElementById('com.yoho:id/product_detail_add', FIND_VIEW_OVER_TIME);
await addToCart.click();
//选择尺码
let chooseSize = await driver.waitForElementByXPath('/hierarchy/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.RelativeLayout/android.widget.LinearLayout/android.widget.ScrollView/android.widget.LinearLayout/android.widget.LinearLayout[2]/android.view.ViewGroup/android.widget.LinearLayout[1]/android.widget.TextView', FIND_VIEW_OVER_TIME);
await chooseSize.click();
// 暂停
await driver.sleep(ACTION_PAUSE_TIME);
//点击加入购物车
let add = await driver.waitForElementById('com.yoho:id/btn_pro_info_submit', FIND_VIEW_OVER_TIME);
await add.click();
//进入购物车
let goToShopCart = await driver.waitForElementById('com.yoho:id/activity_product_detail_sv', FIND_VIEW_OVER_TIME);
await goToShopCart.click();
// 暂停
await driver.sleep(ACTION_PAUSE_TIME);
// 去结算
let orderCreate = await driver.waitForElementById('com.yoho:id/common_shoppingcart_btn', FIND_VIEW_OVER_TIME);
await orderCreate.click();
// 暂停
await driver.sleep(ACTION_PAUSE_TIME);
// 确认结算
let orderConfirm = await driver.waitForElementById('com.yoho:id/make_sure_order', FIND_VIEW_OVER_TIME);
await orderConfirm.click();
// 暂停
await driver.sleep(ACTION_PAUSE_TIME);
});
... ...
const wd = require('wd');
const {describe} = require('../../libs/driver');
const {ANDROID_PRODUCT_DETAIL} = require('../../scene-types/scene-types');
const {FIND_VIEW_OVER_TIME, ACTION_PAUSE_TIME} = require('../../config/constant');
describe(ANDROID_PRODUCT_DETAIL, 'Android 商品详情进入用例', async(driver) => {
// 暂停
await driver.sleep(ACTION_PAUSE_TIME);
//点击首页的tab bar 分类按钮
let categoryTab = await driver.waitForElementById('com.yoho:id/tabMain_radioImage_sort_rl', 10000);
await categoryTab.click();
// 暂停
await driver.sleep(ACTION_PAUSE_TIME);
//点击分类中的第一个子分类:比如男装
let categorySubSortFirst = await driver.waitForElementByXPath("/hierarchy/android.widget.FrameLayout/android.widget.FrameLayout/android.view.ViewGroup[1]/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.RelativeLayout/android.widget.FrameLayout[1]/android.widget.RelativeLayout/android.widget.FrameLayout/android.widget.RelativeLayout/android.widget.LinearLayout/android.widget.LinearLayout[1]/android.widget.TextView", FIND_VIEW_OVER_TIME);
await categorySubSortFirst.click();
//点击分类中的 其中一个品类
let category = await driver.waitForElementByXPath("/hierarchy/android.widget.FrameLayout/android.widget.FrameLayout/android.view.ViewGroup[1]/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.RelativeLayout/android.widget.FrameLayout[1]/android.widget.RelativeLayout/android.widget.FrameLayout/android.widget.RelativeLayout/android.widget.FrameLayout/android.widget.RelativeLayout/android.widget.LinearLayout/android.view.ViewGroup/android.support.v7.widget.RecyclerView/android.widget.LinearLayout[1]/android.widget.GridView/android.widget.RelativeLayout[1]/android.widget.ImageView", FIND_VIEW_OVER_TIME);
await category.click();
// 暂停
await driver.sleep(ACTION_PAUSE_TIME);
//点击其中的一个商品
let firstProduct = await driver.waitForElementByXPath("/hierarchy/android.widget.FrameLayout/android.widget.FrameLayout/android.view.ViewGroup[1]/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.RelativeLayout/android.widget.RelativeLayout/android.widget.ScrollView/android.widget.LinearLayout/android.support.v4.view.ViewPager/android.widget.RelativeLayout/android.widget.RelativeLayout/android.widget.RelativeLayout[1]/android.widget.LinearLayout/android.widget.FrameLayout/android.support.v7.widget.RecyclerView/android.widget.RelativeLayout[1]/android.widget.LinearLayout/android.widget.RelativeLayout/android.widget.ImageView[1]");
await firstProduct.click();
// 暂停
await driver.sleep(ACTION_PAUSE_TIME);
//点击分享
let tapShare = await driver.waitForElementById('com.yoho:id/sharebtn', FIND_VIEW_OVER_TIME);
await tapShare.click();
//取消分享
let cancelShare = await driver.waitForElementById('com.yoho:id/share_cancle_lly', FIND_VIEW_OVER_TIME);
await cancelShare.click();
//点击加入购物车(弹出尺码选择框)
let addToCart = await driver.waitForElementById('com.yoho:id/product_detail_add', FIND_VIEW_OVER_TIME);
await addToCart.click();
//选择颜色
/*let chooseColor = await driver.waitForElementByXPath('/hierarchy/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.RelativeLayout/android.widget.LinearLayout/android.widget.ScrollView/android.widget.LinearLayout/android.widget.LinearLayout[1]/android.view.ViewGroup/android.widget.LinearLayout/android.widget.TextView', FIND_VIEW_OVER_TIME);
await chooseColor.click();*/
//选择尺码
let chooseSize = await driver.waitForElementByXPath('/hierarchy/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.RelativeLayout/android.widget.LinearLayout/android.widget.ScrollView/android.widget.LinearLayout/android.widget.LinearLayout[2]/android.view.ViewGroup/android.widget.LinearLayout[1]/android.widget.TextView', FIND_VIEW_OVER_TIME);
await chooseSize.click();
//加一下
let chooseAdd = await driver.waitForElementById('com.yoho:id/tv_pro_info_num_add', FIND_VIEW_OVER_TIME);
await chooseAdd.click();
//减一下
let chooseReduce = await driver.waitForElementById('com.yoho:id/tv_pro_info_num_sub', FIND_VIEW_OVER_TIME);
await chooseReduce.click();
//点击加入购物车
let add = await driver.waitForElementById('com.yoho:id/btn_pro_info_submit', FIND_VIEW_OVER_TIME);
await add.click();
//进入购物车
let goToShopCart = await driver.waitForElementById('com.yoho:id/activity_product_detail_sv', FIND_VIEW_OVER_TIME);
await goToShopCart.click();
// 暂停
await driver.sleep(ACTION_PAUSE_TIME);
//返回商品详情
let backPrdDetail = await driver.waitForElementById('com.yoho:id/back_imgbtn', FIND_VIEW_OVER_TIME);
await backPrdDetail.click();
});
... ...
const wd = require('wd');
const {describe} = require('../../libs/driver');
const {ANDROID_TAB_HOME} = require('../../scene-types/scene-types');
const {FIND_VIEW_OVER_TIME, ACTION_PAUSE_TIME} = require('../../config/constant');
describe(ANDROID_TAB_HOME,'安卓首页', async(driver) => {
// 首页tab
let touchTab = await driver.waitForElementById('com.yoho:id/tabMain_radioImage_home_rl',10000);
await touchTab.click();
// 暂停
await driver.sleep(ACTION_PAUSE_TIME);
//男装
touchTab = await driver.waitForElementByXPath('/hierarchy/android.widget.FrameLayout/android.widget.FrameLayout/android.view.ViewGroup[1]/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.RelativeLayout/android.widget.FrameLayout[1]/android.widget.RelativeLayout/android.view.ViewGroup/android.widget.LinearLayout/android.widget.HorizontalScrollView/android.widget.LinearLayout/android.view.ViewGroup[1]',5000);
await touchTab.click();
//女装
touchTab = await driver.waitForElementByXPath('/hierarchy/android.widget.FrameLayout/android.widget.FrameLayout/android.view.ViewGroup[1]/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.RelativeLayout/android.widget.FrameLayout[1]/android.widget.RelativeLayout/android.view.ViewGroup/android.widget.LinearLayout/android.widget.HorizontalScrollView/android.widget.LinearLayout/android.view.ViewGroup[2]', 5000);
await touchTab.click();
//球鞋
touchTab = await driver.waitForElementByXPath('/hierarchy/android.widget.FrameLayout/android.widget.FrameLayout/android.view.ViewGroup[1]/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.RelativeLayout/android.widget.FrameLayout[1]/android.widget.RelativeLayout/android.view.ViewGroup/android.widget.LinearLayout/android.widget.HorizontalScrollView/android.widget.LinearLayout/android.view.ViewGroup[3]',5000);
await touchTab.click();
//生活方式
touchTab = await driver.waitForElementByXPath('/hierarchy/android.widget.FrameLayout/android.widget.FrameLayout/android.view.ViewGroup[1]/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.RelativeLayout/android.widget.FrameLayout[1]/android.widget.RelativeLayout/android.view.ViewGroup/android.widget.LinearLayout/android.widget.HorizontalScrollView/android.widget.LinearLayout/android.view.ViewGroup[4]',5000);
await touchTab.click();
//高街BLK
touchTab = await driver.waitForElementByXPath('/hierarchy/android.widget.FrameLayout/android.widget.FrameLayout/android.view.ViewGroup[1]/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.RelativeLayout/android.widget.FrameLayout[1]/android.widget.RelativeLayout/android.view.ViewGroup/android.widget.LinearLayout/android.widget.HorizontalScrollView/android.widget.LinearLayout/android.view.ViewGroup[5]',5000);
await touchTab.click();
//潮童
touchTab = await driver.waitForElementByXPath('/hierarchy/android.widget.FrameLayout/android.widget.FrameLayout/android.view.ViewGroup[1]/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.RelativeLayout/android.widget.FrameLayout[1]/android.widget.RelativeLayout/android.view.ViewGroup/android.widget.LinearLayout/android.widget.HorizontalScrollView/android.widget.LinearLayout/android.view.ViewGroup[6]',5000);
await touchTab.click();
await new Promise(r => {
setTimeout(() => {
r()
}, 5000);
})
});
\ No newline at end of file
... ...
const wd = require('wd');
const {describe} = require('../../libs/driver');
const {ANDROID_MAINTAB_SWITCH} = require('../../scene-types/scene-types');
const {FIND_VIEW_OVER_TIME, ACTION_PAUSE_TIME} = require('../../config/constant');
describe(ANDROID_MAINTAB_SWITCH,'安卓首页TAB切换', async(driver) => {
// 首页tab
let touchTab = await driver.waitForElementById('com.yoho:id/tabMain_radioImage_home_rl',10000);
await touchTab.click();
// 暂停
await driver.sleep(ACTION_PAUSE_TIME);
// 分类tab
touchTab = await driver.waitForElementById('com.yoho:id/tabMain_radioImage_sort_rl',10000);
await touchTab.click();
// 暂停
await driver.sleep(ACTION_PAUSE_TIME);
// 社区tab
touchTab = await driver.waitForElementById('com.yoho:id/tabMain_radioImage_stroll_rl',10000);
await touchTab.click();
// 暂停
await driver.sleep(ACTION_PAUSE_TIME);
// 个人中心tab
touchTab = await driver.waitForElementById('com.yoho:id/tabMain_radioImage_my_rl',10000);
await touchTab.click();
// 暂停
await driver.sleep(ACTION_PAUSE_TIME);
touchTab = await driver.waitForElementById('com.yoho:id/tabMain_radioImage_ufo_rl',10000);
await touchTab.click();
// 暂停
await driver.sleep(ACTION_PAUSE_TIME);
});
\ No newline at end of file
... ...