product_detail_group.js 2.67 KB
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;

describe(IOS_PRODUCT_DETAIL_GROUP, '拼团商品详情页埋点测试', async (driver) => {
    //点击我的 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折拼团
    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);
    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);
    tapView.click();
    //暂停
    await driver.sleep(IOS_SLEEP_WAIT_TIME);
    // driver.execute('mobile: scroll', { direction: 'down' });

});