Authored by 孟顺

iOS UFO首页自动化用例

@@ -6,6 +6,7 @@ module.exports.IOS_PRODUCT_CART = 'IOS_PRODUCT_CART'; @@ -6,6 +6,7 @@ module.exports.IOS_PRODUCT_CART = 'IOS_PRODUCT_CART';
6 module.exports.iOS_TAB_CATEGORY = 'iOS_TAB_CATEGORY'; 6 module.exports.iOS_TAB_CATEGORY = 'iOS_TAB_CATEGORY';
7 module.exports.iOS_TAB_GUANG = 'iOS_TAB_GUANG'; 7 module.exports.iOS_TAB_GUANG = 'iOS_TAB_GUANG';
8 module.exports.IOS_PRODUCT_DETAIL_GROUP = 'IOS_PRODUCT_DETAIL_GROUP'; 8 module.exports.IOS_PRODUCT_DETAIL_GROUP = 'IOS_PRODUCT_DETAIL_GROUP';
  9 +module.exports.iOS_TAB_UFOHOME = "iOS_TAB_UFOHOME";
9 10
10 module.exports.ANDROID_TAB_HOME = 'ANDROID_TAB_HOME'; 11 module.exports.ANDROID_TAB_HOME = 'ANDROID_TAB_HOME';
11 module.exports.ANDROID_TAB_CATEGORY = 'ANDROID_TAB_CATEGORY'; 12 module.exports.ANDROID_TAB_CATEGORY = 'ANDROID_TAB_CATEGORY';
@@ -4,6 +4,12 @@ const { @@ -4,6 +4,12 @@ const {
4 4
5 module.exports = { 5 module.exports = {
6 [iOS_TAB_UFOHOME]:[ 6 [iOS_TAB_UFOHOME]:[
7 - {} 7 + { op: 'YB_UFO', name: 'TAB BAR 点击UFO' },
  8 + { op: 'UFO_BROWSE_HOME', name: '浏览UFO首页' },
  9 + { op: 'UFO_MAIN_START', name: 'UFO首页打开' },
  10 + { op: 'YB_SHOW_EVENT', name: '曝光' , types:{DATA:Array}},
  11 + { op: 'UFO_PRD_DT_INFO', name: '进入UFO商品详情页', validate: (log) => { return log.param.PRD_ID.length > 0;}},
  12 + { op: 'UFO_PRD_COL_C', name: '点击收藏', validate: (log) => { return log.param.PRD_ID.length > 0; } },
  13 +
8 ] 14 ]
9 }; 15 };
@@ -19,7 +19,7 @@ describe(IOS_PRODUCT_DETAIL, '商品详情页埋点测试', async(driver) => { @@ -19,7 +19,7 @@ describe(IOS_PRODUCT_DETAIL, '商品详情页埋点测试', async(driver) => {
19 await goToShopCart.click(); 19 await goToShopCart.click();
20 console.log("进入购物车完成"); 20 console.log("进入购物车完成");
21 //返回商品详情 21 //返回商品详情
22 - let backPrdDetail = await driver.waitForElementByAccessibilityId('shared back icon', 3000); 22 + let backPrdDetail = await driver.waitForElementByAccessibilityId('yh_base_vc_back_btn', 3000);
23 await backPrdDetail.click(); 23 await backPrdDetail.click();
24 console.log("返回详情完成"); 24 console.log("返回详情完成");
25 //点击分享 25 //点击分享
1 const wd = require('wd'); 1 const wd = require('wd');
2 const {describe} = require('../../libs/driver'); 2 const {describe} = require('../../libs/driver');
3 const {iOS_TAB_UFOHOME} = require('../../scene-types/scene-types'); 3 const {iOS_TAB_UFOHOME} = require('../../scene-types/scene-types');
4 -  
5 -describe(iOS_TAB_UFOHOME,'UFO首页', async(driver) => {  
6 - 4 +const { FIND_VIEW_OVER_TIME, ACTION_PAUSE_TIME } = require('../../config/constant');
  5 +describe(iOS_TAB_UFOHOME, "球鞋市集", async (driver) => {
  6 + await driver.sleep(ACTION_PAUSE_TIME);
  7 + console.log("点击球鞋市集tab");
  8 + let tapView = await driver.waitForElementByXPath('//XCUIElementTypeApplication[@name="Yoho!Buy有货"]/XCUIElementTypeWindow[1]/XCUIElementTypeOther/XCUIElementTypeOther[1]/XCUIElementTypeOther[2]/XCUIElementTypeTabBar/XCUIElementTypeButton[3]', FIND_VIEW_OVER_TIME);
  9 + tapView.click();
  10 + await driver.sleep(ACTION_PAUSE_TIME);
  11 + console.log("点击首页tab");
  12 + tapView = await driver.waitForElementByXPath('//XCUIElementTypeApplication[@name="Yoho!Buy有货"]/XCUIElementTypeWindow[1]/XCUIElementTypeOther/XCUIElementTypeOther[1]/XCUIElementTypeOther[2]/XCUIElementTypeTabBar/XCUIElementTypeButton[1]', FIND_VIEW_OVER_TIME);
  13 + tapView.click();
  14 + await driver.sleep(ACTION_PAUSE_TIME);
  15 + console.log("点击首页搜索框");
  16 + tapView = await driver.waitForElementByAccessibilityId('homeSearch', FIND_VIEW_OVER_TIME);
  17 + tapView.click();
  18 + await driver.sleep(ACTION_PAUSE_TIME);
  19 + console.log("搜索框输入UFO");
  20 + tapView = await driver.waitForElementByAccessibilityId('yh_search_vc_search', FIND_VIEW_OVER_TIME);
  21 + tapView.sendKeys('ufo');
  22 + await driver.sleep(ACTION_PAUSE_TIME);
  23 + console.log("点击UFO");
  24 + tapView = await driver.waitForElementByXPath('//XCUIElementTypeStaticText[@name="ufo"]', FIND_VIEW_OVER_TIME);
  25 + tapView.click();
  26 + // await driver.sleep(ACTION_PAUSE_TIME);
  27 + // console.log("点击UFO店铺");
  28 + // 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);
  29 + // tapView.click();
  30 + // await driver.sleep(ACTION_PAUSE_TIME);
  31 + // console.log("点返回1");
  32 + // 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);
  33 + // tapView.click();
  34 + await driver.sleep(ACTION_PAUSE_TIME);
  35 + console.log("点击UFO商品");
  36 + 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);
  37 + tapView.click();
  38 + await driver.sleep(ACTION_PAUSE_TIME);
  39 + console.log("点击收藏");
  40 + tapView = await driver.waitForElementByAccessibilityId('yh_ufo_prd_detail_collect_btn', FIND_VIEW_OVER_TIME);
  41 + tapView.click();
  42 + await driver.sleep(ACTION_PAUSE_TIME);
  43 + console.log("取消收藏");
  44 + tapView = await driver.waitForElementByAccessibilityId('yh_ufo_prd_detail_collect_btn', FIND_VIEW_OVER_TIME);
  45 + tapView.click();
  46 + await driver.sleep(ACTION_PAUSE_TIME);
  47 + console.log("点返回搜索页");
  48 + tapView = await driver.waitForElementByAccessibilityId('yh_base_vc_back_btn', FIND_VIEW_OVER_TIME);
  49 + tapView.click();
  50 + await driver.sleep(ACTION_PAUSE_TIME);
  51 + console.log("点返回首页");
  52 + tapView = await driver.waitForElementByAccessibilityId('yh_base_vc_back_btn', FIND_VIEW_OVER_TIME);
  53 + tapView.click();
  54 + await driver.sleep(ACTION_PAUSE_TIME);
7 }); 55 });