Authored by 孟顺

iOS 自动测试化 用例

... ... @@ -27,13 +27,21 @@
"port": 4723
},
"cases": {
"ios": [{
"name": "商品详情页",
"scenes": ["IOS_UFO_PRODUCT_DETAIL"]
}, {
"name": "购物车",
"scenes": ["IOS_PRODUCT_DETAIL", "IOS_PRODUCT_CART"]
}],
"ios": [
{
"name": "有货iOS自动自测用例",
"scenes": [
"iOS_TAB_HOME",
"iOS_TAB_CATEGORY",
"iOS_TAB_UFOHOME",
"iOS_TAB_MINE",
"IOS_PRODUCT_DETAIL",
"IOS_PRODUCT_DETAIL_GROUP",
"iOS_TAB_GUANG",
"iOS_BUSINESS_SHOPPING"
]
}
],
"android": [{
"name": "商品详情页",
"scenes": ["ANDROID_UFO_PRODUCT_DETAIL"]
... ...
... ... @@ -2,4 +2,4 @@
module.exports.FIND_VIEW_OVER_TIME = 5000;
//操作暂停时间
module.exports.ACTION_PAUSE_TIME = 3000;
module.exports.ACTION_PAUSE_TIME = 2000;
... ...
... ... @@ -4,7 +4,7 @@ module.exports.IOS_PRODUCT_DETAIL = 'IOS_PRODUCT_DETAIL';
module.exports.IOS_UFO_PRODUCT_DETAIL = 'IOS_UFO_PRODUCT_DETAIL';
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_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.iOS_TAB_MINE = 'iOS_TAB_MINE';
... ...
... ... @@ -4,20 +4,6 @@ const {
module.exports = {
[iOS_TAB_CATEGORY]:[
{ op: 'YB_LAUNCH_APP', name: '启动APP' },
{ op: 'YB_PAGE_ENTER', name: '进入APP', equals: { PAGE_ID: "start" } },
{ op: 'YB_PAGE_ENTER', name: '进入广告启动页', equals: { PAGE_ID: "xbxzy" } },
{ op: 'YB_HOME_CHANNEL_TAB_C', name: '首页默认选中了某个tab选项' },
{ op: 'YB_PAGE_ENTER', name: '进入首页', equals: { PAGE_ID: "sy" } },
{ op: 'YB_PAGE_EXIT', name: '离开启动页', equals: { PAGE_ID: "start" } },
{ op: 'YB_PAGE_EXIT', name: '离开广告启动页', equals: { PAGE_ID: "xbxzy" } },
{ op: 'YB_ENTER_CHOICE', name: '选择了默认的频道选项' },
{ op: 'YB_CHOOSE_FOR_YOU', name: '猜你喜欢展现上报', types: { PRD_ID: String } },
{ op: 'YB_SHOW_MAIN_RECOMMEND', name: '首页推荐商品数据曝光', types: { DATA: Array } },
{ op: 'YB_CATEGORY_CLS_TAB', name: '主界面-分类-品类TAB'},
{ op: 'YB_CATEGORY', name: 'TAB BAR 点击品类'},
{ op: 'YB_AUTO_TRACK', name: '自动点击TAB品类上报', equals: { VIEW_PATH: "YH_TabBarViewController[0]\/UITabBar[0]\/Index[1]" } },
{ op: 'YB_PAGE_EXIT', name: "离开首页", equals: { PAGE_ID: "sy" } },
... ...
... ... @@ -5,16 +5,16 @@ const {
module.exports = {
[iOS_TAB_MINE]:[
{op: 'UFO_MY_ITEM_C', name: '我的收入'},
{op: 'UFO_MY_ITEM_C', name: '商家入驻'},
{op: 'UFO_MY_ITEM_C', name: '新的好物'},
{op: 'YB_PAGE_ENTER', name: '新的好物载入'},
{op: 'YB_PAGE_EXIT', name: '新的好物载出'},
{op: 'YB_PAGE_ENTER', name: '商家入驻载入'},
{op: 'YB_PAGE_EXIT', name: '商家入驻载出'},
// {op: 'UFO_MY_ITEM_C', name: '商家入驻'},
// {op: 'UFO_MY_ITEM_C', name: '新的好物'},
// {op: 'YB_PAGE_ENTER', name: '新的好物载入'},
// {op: 'YB_PAGE_EXIT', name: '新的好物载出'},
// {op: 'YB_PAGE_ENTER', name: '商家入驻载入'},
// {op: 'YB_PAGE_EXIT', name: '商家入驻载出'},
{op: 'YB_PAGE_ENTER', name: '我的收入载入'},
{op: 'YB_PAGE_EXIT', name: '我的收入载出'},
{op: 'YB_PAGE_ENTER', name: 'UFO载入'},
{op: 'YB_PAGE_ENTER', name: 'UFO载出'},
{op: 'YB_H5_PAGE_OPEN_', name: '新的好物url'},
// {op: 'YB_H5_PAGE_OPEN_', name: '新的好物url'},
]
};
\ No newline at end of file
... ...
const wd = require('wd');
const {describe} = require('../../libs/driver');
const {iOS_BUSINESS_SHOPPING} = require('../../scene-types/scene-types');
const { FIND_VIEW_OVER_TIME, ACTION_PAUSE_TIME } = require('../../config/constant');
describe(iOS_BUSINESS_SHOPPING,'购物车', async(driver) => {
await driver.sleep(ACTION_PAUSE_TIME);
console.log("点击首页");
let touchTab = await driver.waitForElementByXPath('//XCUIElementTypeApplication[@name="Yoho!Buy有货"]/XCUIElementTypeWindow[1]/XCUIElementTypeOther/XCUIElementTypeOther[1]/XCUIElementTypeOther[2]/XCUIElementTypeTabBar/XCUIElementTypeButton[1]', FIND_VIEW_OVER_TIME);
await touchTab.click();
await driver.sleep(ACTION_PAUSE_TIME);
// let touchTab = await driver.waitForElementByAccessibilityId('indicator_shoppingbag',10000);
let touchTab = await driver.waitForElementByXPath('//XCUIElementTypeApplication[@name="Yoho!Buy有货"]/XCUIElementTypeWindow[1]/XCUIElementTypeOther/XCUIElementTypeOther[1]/XCUIElementTypeOther[2]/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther[4]',5000);
touchTab = await driver.waitForElementByXPath('//XCUIElementTypeApplication[@name="Yoho!Buy有货"]/XCUIElementTypeWindow[1]/XCUIElementTypeOther/XCUIElementTypeOther[1]/XCUIElementTypeOther[2]/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther[4]',FIND_VIEW_OVER_TIME);
await touchTab.click();
// driver.execute('mobile: scroll', {direction: 'down', element: element.value.'BF000000-0000-0000-922D-000000000000'});
// await driver.sleep(3000);
touchTab = await driver.waitForElementByAccessibilityId('select',3000);//单选
await driver.sleep(ACTION_PAUSE_TIME);
touchTab = await driver.waitForElementByAccessibilityId('select', FIND_VIEW_OVER_TIME);//单选
await touchTab.click();
//'selectAll' 全选 'mealSelect' 套餐
touchTab = await driver.waitForElementByAccessibilityId('editCart',5000);//编辑
await driver.sleep(ACTION_PAUSE_TIME);
touchTab = await driver.waitForElementByAccessibilityId('editCart', FIND_VIEW_OVER_TIME);//编辑
await touchTab.click();
touchTab = await driver.waitForElementByAccessibilityId('shopcart_add',3000);//增加
await driver.sleep(ACTION_PAUSE_TIME);
touchTab = await driver.waitForElementByAccessibilityId('shopcart_add', FIND_VIEW_OVER_TIME);//增加
await touchTab.click();
touchTab = await driver.waitForElementByAccessibilityId('shopcart_sub',3000);//减少
await driver.sleep(ACTION_PAUSE_TIME);
touchTab = await driver.waitForElementByAccessibilityId('shopcart_sub', FIND_VIEW_OVER_TIME);//减少
await touchTab.click();
touchTab = await driver.waitForElementByAccessibilityId('editCart',1000);//完成
await driver.sleep(ACTION_PAUSE_TIME);
touchTab = await driver.waitForElementByAccessibilityId('editCart', FIND_VIEW_OVER_TIME);//完成
await touchTab.click();
touchTab = await driver.waitForElementByAccessibilityId('submitAndPay', 2000);
await driver.sleep(ACTION_PAUSE_TIME);
touchTab = await driver.waitForElementByAccessibilityId('submitAndPay', FIND_VIEW_OVER_TIME);
await touchTab.click();
touchTab = await driver.waitForElementByAccessibilityId('确定', 2000);//下单
await driver.sleep(ACTION_PAUSE_TIME);
touchTab = await driver.waitForElementByAccessibilityId('确定', FIND_VIEW_OVER_TIME);//下单
await touchTab.click();
touchTab = await driver.waitForElementByAccessibilityId('yh_base_vc_back_btn', 2000);//返回
await driver.sleep(ACTION_PAUSE_TIME);
touchTab = await driver.waitForElementByAccessibilityId('yh_base_vc_back_btn', FIND_VIEW_OVER_TIME);//返回
await touchTab.click();
touchTab = await driver.waitForElementByAccessibilityId('确认离开', 2000);//返回
await driver.sleep(ACTION_PAUSE_TIME);
touchTab = await driver.waitForElementByAccessibilityId('确认离开', FIND_VIEW_OVER_TIME);//返回
await touchTab.click();
touchTab = await driver.waitForElementByAccessibilityId('yh_base_vc_back_btn', 2000);//返回
await driver.sleep(ACTION_PAUSE_TIME);
touchTab = await driver.waitForElementByAccessibilityId('yh_base_vc_back_btn', FIND_VIEW_OVER_TIME);//返回
await touchTab.click();
////XCUIElementTypeApplication[@name="Yoho!Buy有货"]/XCUIElementTypeWindow[1]/XCUIElementTypeOther/XCUIElementTypeOther[1]/XCUIElementTypeOther[2]/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeTable/XCUIElementTypeCell[3]
// touchTab = await driver.waitForElementByAccessibilityId('yh_paymentcenter_checked', 2000);//下单
... ... @@ -47,9 +64,5 @@ describe(iOS_BUSINESS_SHOPPING,'购物车', async(driver) => {
// touchTab = await driver.waitForElementByAccessibilityId('支 付', 2000);//拉起支付
// await touchTab.click();
await new Promise(r => {
setTimeout(() => {
r()
}, 3000);
})
await driver.sleep(ACTION_PAUSE_TIME);
});
\ No newline at end of file
... ...
const wd = require('wd');
const {describe} = require('../../libs/driver');
const {iOS_TAB_CATEGORY} = require('../../scene-types/scene-types');
const { FIND_VIEW_OVER_TIME, ACTION_PAUSE_TIME } = require('../../config/constant');
describe(iOS_TAB_CATEGORY,'分类(品类&品牌)', async(driver) => {
//点击首页的tab bar 分类按钮
... ... @@ -31,16 +32,11 @@ describe(iOS_TAB_CATEGORY,'分类(品类&品牌)', async(driver) => {
tapView = await driver.waitForElementByXPath('//XCUIElementTypeApplication[@name="Yoho!Buy有货"]/XCUIElementTypeWindow[1]/XCUIElementTypeOther/XCUIElementTypeOther[1]/XCUIElementTypeOther[2]/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther[1]/XCUIElementTypeOther[1]/XCUIElementTypeCollectionView/XCUIElementTypeCell[1]', 3000);
await tapView.click();
//点击分类中的 其中一个分类
tapView = await driver.waitForElementByXPath('//XCUIElementTypeApplication[@name="Yoho!Buy有货"]/XCUIElementTypeWindow[1]/XCUIElementTypeOther/XCUIElementTypeOther[1]/XCUIElementTypeOther[2]/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther[1]/XCUIElementTypeOther[3]/XCUIElementTypeCollectionView/XCUIElementTypeCell[4]/XCUIElementTypeOther', 3000);
await tapView.click();
await new Promise(r => {
setTimeout(() => {
r()
}, 2000);
});
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
... ...
... ... @@ -33,32 +33,32 @@ describe(iOS_TAB_MINE,'我的', async(driver) => {
await driver.sleep(ACTION_PAUSE_TIME);
touchTab = await driver.waitForElementByAccessibilityId('商家入驻', FIND_VIEW_OVER_TIME);
await touchTab.click();
// touchTab = await driver.waitForElementByAccessibilityId('商家入驻', FIND_VIEW_OVER_TIME);
// await touchTab.click();
await driver.sleep(ACTION_PAUSE_TIME);
// await driver.sleep(ACTION_PAUSE_TIME);
let element = await driver.elementsByAccessibilityId("完善信息");
// let isDisplayed = await element.isDisplayed();
// if (isDisplayed){
touchTab = await driver.waitForElementByAccessibilityId('完善信息');
await touchTab.click();
// }
// let element = await driver.elementsByAccessibilityId("完善信息");
// // let isDisplayed = await element.isDisplayed();
// // if (isDisplayed){
// touchTab = await driver.waitForElementByAccessibilityId('完善信息');
// await touchTab.click();
// // }
await driver.sleep(ACTION_PAUSE_TIME);
// await driver.sleep(ACTION_PAUSE_TIME);
touchTab = await driver.waitForElementByAccessibilityId('yh_base_vc_back_btn', FIND_VIEW_OVER_TIME);
await touchTab.click();
// touchTab = await driver.waitForElementByAccessibilityId('yh_base_vc_back_btn', FIND_VIEW_OVER_TIME);
// await touchTab.click();
await driver.sleep(ACTION_PAUSE_TIME);
// await driver.sleep(ACTION_PAUSE_TIME);
touchTab = await driver.waitForElementByAccessibilityId('新的好物 没有你的好物?申请上架', FIND_VIEW_OVER_TIME);
await touchTab.click();
// touchTab = await driver.waitForElementByAccessibilityId('新的好物 没有你的好物?申请上架', FIND_VIEW_OVER_TIME);
// await touchTab.click();
await driver.sleep(ACTION_PAUSE_TIME);
// await driver.sleep(ACTION_PAUSE_TIME);
touchTab = await driver.waitForElementByAccessibilityId('yh_base_vc_back_btn', FIND_VIEW_OVER_TIME);
await touchTab.click();
// touchTab = await driver.waitForElementByAccessibilityId('yh_base_vc_back_btn', FIND_VIEW_OVER_TIME);
// await touchTab.click();
await driver.sleep(ACTION_PAUSE_TIME);
... ...