Authored by 孟顺

拼团商品详情自动测试用例

review by 枪兵
... ... @@ -11,21 +11,21 @@ module.exports = {
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_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;
// }
// },
// //套餐商品接口上报
// {
... ...
const {describe} = require('../../libs/driver');
const {IOS_PRODUCT_DETAIL} = require('../../scene-types/scene-types');
const { FIND_VIEW_OVER_TIME, ACTION_PAUSE_TIME } = require('../../config/constant');
describe(IOS_PRODUCT_DETAIL, '商品详情页埋点测试', async(driver) => {
//点击首页的tab bar 分类按钮
... ... @@ -11,7 +12,7 @@ describe(IOS_PRODUCT_DETAIL, '商品详情页埋点测试', async(driver) => {
console.log("点击分类完成");
//点击其中的一个商品
let firstProduct = 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[4]', 3000);
let firstProduct = await driver.waitForElementByAccessibilityId('yh_prd_cell_0_3', 3000);
await firstProduct.click();
console.log("点击其中一个商品完成");
//进入购物车
... ...
const wd = require('wd');
const { describe } = require('../../libs/driver');
const { IOS_PRODUCT_DETAIL_GROUP } = require('../../scene-types/scene-types');
const IOS_SLEEP_WAIT_TIME = 3000;
const { FIND_VIEW_OVER_TIME, ACTION_PAUSE_TIME } = require('../../config/constant');
describe(IOS_PRODUCT_DETAIL_GROUP, '拼团商品详情页埋点测试', async (driver) => {
//点击我的 tab
describe(IOS_PRODUCT_DETAIL_GROUP, '拼团商品详情页埋点测试(未登录)', async (driver) => {
console.log("点击TAB 我的");
let tapView = await driver.waitForElementByXPath('//XCUIElementTypeApplication[@name="Yoho!Buy有货"]/XCUIElementTypeWindow[1]/XCUIElementTypeOther/XCUIElementTypeOther[1]/XCUIElementTypeOther[2]/XCUIElementTypeTabBar/XCUIElementTypeButton[5]', 10000);
tapView.click();
//暂停
await driver.sleep(IOS_SLEEP_WAIT_TIME);
// //模拟向上滚动
// driver.execute('mobile: scroll', { direction: 'down'});
// await new Promise(r => {
// setTimeout(() => {
// r()
// }, 2000);
// });
//点击5折拼团
await driver.sleep(ACTION_PAUSE_TIME);
console.log("点击5折 拼团");
tapView = await driver.waitForElementByXPath('//XCUIElementTypeApplication[@name="Yoho!Buy有货"]/XCUIElementTypeWindow[1]/XCUIElementTypeOther/XCUIElementTypeOther[1]/XCUIElementTypeOther[2]/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeCollectionView/XCUIElementTypeCell[16]', 3000);
tapView.click();
//暂停
await driver.sleep(IOS_SLEEP_WAIT_TIME);
//点击19元专区
tapView = await driver.waitForElementByXPath('//XCUIElementTypeApplication[@name="Yoho!Buy有货"]/XCUIElementTypeWindow[1]/XCUIElementTypeOther/XCUIElementTypeOther[1]/XCUIElementTypeOther[2]/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeWebView/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther[3]', 3000);
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(IOS_SLEEP_WAIT_TIME);
//点击列表第一个
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/XCUIElementTypeOther/XCUIElementTypeOther[1]/XCUIElementTypeScrollView/XCUIElementTypeOther/XCUIElementTypeOther[1]', 3000);
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]', 10000);
tapView.click();
//暂停
await driver.sleep(IOS_SLEEP_WAIT_TIME);
// driver.execute('mobile: scroll', { direction: 'down' });
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("输入指定的拼团SKN");
tapView = await driver.waitForElementByAccessibilityId('yh_search_vc_search', FIND_VIEW_OVER_TIME);
tapView.sendKeys("51905716");
await driver.sleep(ACTION_PAUSE_TIME);
console.log("点击搜索");
tapView = await driver.waitForElementByAccessibilityId('Search', FIND_VIEW_OVER_TIME);
tapView.click();
await driver.sleep(ACTION_PAUSE_TIME);
console.log("点击指定的拼团商品");
tapView = await driver.waitForElementByAccessibilityId('yh_prd_cell_0_1', FIND_VIEW_OVER_TIME);
tapView.click();
await driver.sleep(ACTION_PAUSE_TIME);
console.log("点击分享");
tapView = await driver.waitForElementByAccessibilityId('shareActionBtn', 3000);
await tapView.click();
await driver.sleep(ACTION_PAUSE_TIME);
console.log("取消分享");
tapView = await driver.waitForElementByAccessibilityId('取消', 3000);
await tapView.click();
await driver.sleep(ACTION_PAUSE_TIME);
console.log("点击更多");
tapView = await driver.waitForElementByAccessibilityId('moreActionBtn', 3000);
tapView.click();
await driver.sleep(ACTION_PAUSE_TIME);
console.log("回到首页");
tapView = await driver.waitForElementByAccessibilityId('yh_quick_jump_menu_1', FIND_VIEW_OVER_TIME);
tapView.click();
await driver.sleep(ACTION_PAUSE_TIME);
});
\ No newline at end of file
... ...