Authored by 孟顺

iOS UFO首页自动化用例

... ... @@ -6,6 +6,7 @@ module.exports.IOS_PRODUCT_CART = 'IOS_PRODUCT_CART';
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.iOS_TAB_UFOHOME = "iOS_TAB_UFOHOME";
module.exports.ANDROID_TAB_HOME = 'ANDROID_TAB_HOME';
module.exports.ANDROID_TAB_CATEGORY = 'ANDROID_TAB_CATEGORY';
... ...
... ... @@ -4,6 +4,12 @@ const {
module.exports = {
[iOS_TAB_UFOHOME]:[
{}
{ op: 'YB_UFO', name: 'TAB BAR 点击UFO' },
{ op: 'UFO_BROWSE_HOME', name: '浏览UFO首页' },
{ op: 'UFO_MAIN_START', name: 'UFO首页打开' },
{ op: 'YB_SHOW_EVENT', name: '曝光' , types:{DATA:Array}},
{ op: 'UFO_PRD_DT_INFO', name: '进入UFO商品详情页', validate: (log) => { return log.param.PRD_ID.length > 0;}},
{ op: 'UFO_PRD_COL_C', name: '点击收藏', validate: (log) => { return log.param.PRD_ID.length > 0; } },
]
};
\ No newline at end of file
... ...
... ... @@ -19,7 +19,7 @@ describe(IOS_PRODUCT_DETAIL, '商品详情页埋点测试', async(driver) => {
await goToShopCart.click();
console.log("进入购物车完成");
//返回商品详情
let backPrdDetail = await driver.waitForElementByAccessibilityId('shared back icon', 3000);
let backPrdDetail = await driver.waitForElementByAccessibilityId('yh_base_vc_back_btn', 3000);
await backPrdDetail.click();
console.log("返回详情完成");
//点击分享
... ...
const wd = require('wd');
const {describe} = require('../../libs/driver');
const {iOS_TAB_UFOHOME} = require('../../scene-types/scene-types');
describe(iOS_TAB_UFOHOME,'UFO首页', async(driver) => {
const { FIND_VIEW_OVER_TIME, ACTION_PAUSE_TIME } = require('../../config/constant');
describe(iOS_TAB_UFOHOME, "球鞋市集", async (driver) => {
await driver.sleep(ACTION_PAUSE_TIME);
console.log("点击球鞋市集tab");
let tapView = await driver.waitForElementByXPath('//XCUIElementTypeApplication[@name="Yoho!Buy有货"]/XCUIElementTypeWindow[1]/XCUIElementTypeOther/XCUIElementTypeOther[1]/XCUIElementTypeOther[2]/XCUIElementTypeTabBar/XCUIElementTypeButton[3]', FIND_VIEW_OVER_TIME);
tapView.click();
await driver.sleep(ACTION_PAUSE_TIME);
console.log("点击首页tab");
tapView = await driver.waitForElementByXPath('//XCUIElementTypeApplication[@name="Yoho!Buy有货"]/XCUIElementTypeWindow[1]/XCUIElementTypeOther/XCUIElementTypeOther[1]/XCUIElementTypeOther[2]/XCUIElementTypeTabBar/XCUIElementTypeButton[1]', FIND_VIEW_OVER_TIME);
tapView.click();
await driver.sleep(ACTION_PAUSE_TIME);
console.log("点击首页搜索框");
tapView = await driver.waitForElementByAccessibilityId('homeSearch', FIND_VIEW_OVER_TIME);
tapView.click();
await driver.sleep(ACTION_PAUSE_TIME);
console.log("搜索框输入UFO");
tapView = await driver.waitForElementByAccessibilityId('yh_search_vc_search', FIND_VIEW_OVER_TIME);
tapView.sendKeys('ufo');
await driver.sleep(ACTION_PAUSE_TIME);
console.log("点击UFO");
tapView = await driver.waitForElementByXPath('//XCUIElementTypeStaticText[@name="ufo"]', FIND_VIEW_OVER_TIME);
tapView.click();
// await driver.sleep(ACTION_PAUSE_TIME);
// console.log("点击UFO店铺");
// tapView = await driver.waitForElementByXPath('//XCUIElementTypeApplication[@name="Yoho!Buy有货"]/XCUIElementTypeWindow[1]/XCUIElementTypeOther/XCUIElementTypeOther[1]/XCUIElementTypeOther[2]/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeCollectionView/XCUIElementTypeOther[1]/XCUIElementTypeOther/XCUIElementTypeCollectionView/XCUIElementTypeCell[1]/XCUIElementTypeOther', FIND_VIEW_OVER_TIME);
// tapView.click();
// await driver.sleep(ACTION_PAUSE_TIME);
// console.log("点返回1");
// tapView = await driver.waitForElementByXPath('//XCUIElementTypeApplication[@name="Yoho!Buy有货"]/XCUIElementTypeWindow[1]/XCUIElementTypeOther/XCUIElementTypeOther[1]/XCUIElementTypeOther[2]/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther[1]/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther[1]/XCUIElementTypeOther[1]/XCUIElementTypeOther/XCUIElementTypeOther[2]/XCUIElementTypeOther', FIND_VIEW_OVER_TIME);
// tapView.click();
await driver.sleep(ACTION_PAUSE_TIME);
console.log("点击UFO商品");
tapView = await driver.waitForElementByXPath('//XCUIElementTypeApplication[@name="Yoho!Buy有货"]/XCUIElementTypeWindow[1]/XCUIElementTypeOther/XCUIElementTypeOther[1]/XCUIElementTypeOther[2]/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeCollectionView/XCUIElementTypeCell[2]', FIND_VIEW_OVER_TIME);
tapView.click();
await driver.sleep(ACTION_PAUSE_TIME);
console.log("点击收藏");
tapView = await driver.waitForElementByAccessibilityId('yh_ufo_prd_detail_collect_btn', FIND_VIEW_OVER_TIME);
tapView.click();
await driver.sleep(ACTION_PAUSE_TIME);
console.log("取消收藏");
tapView = await driver.waitForElementByAccessibilityId('yh_ufo_prd_detail_collect_btn', FIND_VIEW_OVER_TIME);
tapView.click();
await driver.sleep(ACTION_PAUSE_TIME);
console.log("点返回搜索页");
tapView = await driver.waitForElementByAccessibilityId('yh_base_vc_back_btn', FIND_VIEW_OVER_TIME);
tapView.click();
await driver.sleep(ACTION_PAUSE_TIME);
console.log("点返回首页");
tapView = await driver.waitForElementByAccessibilityId('yh_base_vc_back_btn', FIND_VIEW_OVER_TIME);
tapView.click();
await driver.sleep(ACTION_PAUSE_TIME);
});
\ No newline at end of file
... ...