product_detail_group.js 3.28 KB
const wd = require('wd');
const { describe } = require('../../libs/driver');
const { IOS_PRODUCT_DETAIL_GROUP } = require('../../scene-types/scene-types');
const { FIND_VIEW_OVER_TIME, ACTION_PAUSE_TIME } = require('../../config/constant');

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(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(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("点击首页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(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);
});