Authored by 陈林

增加UFO 浏览相关的自动化埋点用例,包括UFO首页、UFO品类、UFO系列列表、UFO商品详情页面。

//寻找View的超时时间
module.exports.FIND_VIEW_OVER_TIME = 5000;
//操作暂停时间
module.exports.ACTION_PAUSE_TIME = 3000;
... ...
... ... @@ -9,3 +9,4 @@ module.exports.iOS_TAB_GUANG = 'iOS_TAB_GUANG';
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';
\ No newline at end of file
... ...
/*
* UFO 浏览场景匹配规则,包括UFO首页、UFO品类、UFO系列列表、UFO商品详情页面
* author: chenlin
*
*/
const {
ANDROID_CASE_UFO_BROWSE
} = require('../../scene-types/scene-types');
module.exports = {
[ANDROID_CASE_UFO_BROWSE]:[
{ op: 'YB_UFO', name: 'TAB BAR 点击UFO'},
{ op: 'UFO_BROWSE_HOME', name: 'UFO首页浏览上报'},
{ op: 'UFO_MAIN_START', name: "UFO频道打开", single: true},
{ op: 'YB_SHOW_EVENT', name: "曝光事件", types: { DATA: Array } },
{ op: 'UFO_CATEGORY_C', name: "分类点击" },
{ op: 'YB_PAGE_ENTER', name: "进入分类页面", equals: {"TYPE_ID":"ufo_category"} },
{ op: 'YB_PAGE_EXIT', name: "退出分类页面", equals: {"TYPE_ID":"ufo_category"} },
{ op: 'UFO_MAIN_EVENT', name: "首页楼层点击" },
{ op: 'YB_PAGE_ENTER', name: "进入商品列表页面", equals: {"TYPE_ID":"ufo_productList"} },
{ op: 'UFO_PRD_LIST_L', name: "商品列表第一页商品ID曝光", types: { PRD_LIST: String } },
{ op: 'YB_PAGE_EXIT', name: "退出商品列表页面", equals: {"TYPE_ID":"ufo_productList"} },
{ op: 'UFO_MAIN_EVENT', name: "商品点击", types: { PRD_ID: String } },
{ op: 'YB_PAGE_ENTER', name: "进入商品详情页面", equals: {"TYPE_ID":"ufo_productDetail"} },
{ op: 'UFO_PRD_DT_INFO', name: "商品详情页面上报", equals: {"FP_NAME":"aFP_UFOHome"}, types: {PRD_ID: String} },
{ op: 'YB_PAGE_EXIT', name: "退出商品详情页面", equals: {"TYPE_ID":"ufo_productDetail"} },
]
};
\ No newline at end of file
... ...
/*
* UFO 浏览场景,包括UFO首页、UFO品类、UFO系列列表、UFO商品详情页面
* author: chenlin
*
*/
const wd = require('wd');
const {describe} = require('../../libs/driver');
const {ANDROID_CASE_UFO_BROWSE} = require('../../scene-types/scene-types');
const {FIND_VIEW_OVER_TIME, ACTION_PAUSE_TIME} = require('../../config/constant');
describe(ANDROID_CASE_UFO_BROWSE, 'Android UFO首页测试用例', async(driver) => {
//点击UFO tab,进入UFO首页
let ufoTab = await driver.waitForElementById('com.yoho:id/tabMain_radioImage_ufo_rl', FIND_VIEW_OVER_TIME);
await ufoTab.click();
// 暂停
await driver.sleep(ACTION_PAUSE_TIME);
//点击进入分类列表
let categoryView = 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.FrameLayout/android.view.ViewGroup/android.view.ViewGroup/android.view.ViewGroup/android.view.ViewGroup/android.view.ViewGroup[1]/android.view.ViewGroup[3]/android.widget.ImageView', FIND_VIEW_OVER_TIME);
await categoryView.click();
// 暂停
await driver.sleep(ACTION_PAUSE_TIME);
//退出分类列表
let quitCategoryView = await driver.waitForElementByXPath('/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.RelativeLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.view.ViewGroup/android.view.ViewGroup/android.view.ViewGroup/android.view.ViewGroup/android.view.ViewGroup[1]/android.view.ViewGroup/android.view.ViewGroup[1]/android.widget.ImageView', FIND_VIEW_OVER_TIME);
await quitCategoryView.click();
//点击进入系列列表
let searialView = 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.FrameLayout/android.view.ViewGroup/android.view.ViewGroup/android.view.ViewGroup/android.view.ViewGroup/android.view.ViewGroup[2]/android.view.ViewGroup/android.widget.ScrollView/android.view.ViewGroup/android.view.ViewGroup[2]/android.widget.ScrollView/android.view.ViewGroup/android.view.ViewGroup[3]/android.view.ViewGroup/android.view.ViewGroup/android.widget.ImageView', FIND_VIEW_OVER_TIME);
await searialView.click();
// 暂停
await driver.sleep(ACTION_PAUSE_TIME);
//退出系列列表
let quitSearialView = await driver.waitForElementByXPath('/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.RelativeLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.view.ViewGroup/android.view.ViewGroup/android.view.ViewGroup/android.view.ViewGroup/android.view.ViewGroup[2]/android.view.ViewGroup/android.view.ViewGroup/android.view.ViewGroup[1]/android.view.ViewGroup/android.widget.ImageView', FIND_VIEW_OVER_TIME);
await quitSearialView.click();
// 暂停
await driver.sleep(ACTION_PAUSE_TIME);
//进入商品详情
let goodsView = 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.FrameLayout/android.view.ViewGroup/android.view.ViewGroup/android.view.ViewGroup/android.view.ViewGroup/android.view.ViewGroup[2]/android.view.ViewGroup/android.widget.ScrollView/android.view.ViewGroup/android.view.ViewGroup[6]/android.view.ViewGroup', FIND_VIEW_OVER_TIME);
await goodsView.click();
// 暂停
await driver.sleep(ACTION_PAUSE_TIME);
//退出商品详情
let quitGoodsView = await driver.waitForElementById('com.yoho:id/back_btn', FIND_VIEW_OVER_TIME);
await quitGoodsView.click();
// 暂停
await driver.sleep(ACTION_PAUSE_TIME);
// await new Promise(r => {
// setTimeout(() => {
// r()
// }, 3000);
// })
});
... ...