tab_ufohome.js 4.5 KB
const wd = require('wd');
const {describe} = require('../../libs/driver');
const {iOS_TAB_UFOHOME} = require('../../scene-types/scene-types');
const { FIND_VIEW_OVER_TIME, ACTION_PAUSE_TIME } = require('../../config/constant');
describe(iOS_TAB_UFOHOME, "球鞋市集", async (driver) => {
    await driver.sleep(ACTION_PAUSE_TIME);
    console.log("点击球鞋市集tab");
    let tapView = await driver.waitForElementByXPath('//XCUIElementTypeApplication[@name="Yoho!Buy有货"]/XCUIElementTypeWindow[1]/XCUIElementTypeOther/XCUIElementTypeOther[1]/XCUIElementTypeOther[2]/XCUIElementTypeTabBar/XCUIElementTypeButton[3]', 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]', FIND_VIEW_OVER_TIME);
    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("搜索框输入UFO");
    tapView = await driver.waitForElementByAccessibilityId('yh_search_vc_search', FIND_VIEW_OVER_TIME);
    tapView.sendKeys('ufo');
    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("点击UFO店铺");
    // 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);
    // tapView.click();
    // await driver.sleep(ACTION_PAUSE_TIME);
    // console.log("点返回1");
    // 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);
    // tapView.click();
    await driver.sleep(ACTION_PAUSE_TIME);
    console.log("点击UFO商品");
    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);
    tapView.click();
    await driver.sleep(ACTION_PAUSE_TIME);
    console.log("点击收藏");
    tapView = await driver.waitForElementByAccessibilityId('yh_ufo_prd_detail_collect_btn', FIND_VIEW_OVER_TIME);
    tapView.click();
    await driver.sleep(4000);
    console.log("取消收藏");
    tapView = await driver.waitForElementByAccessibilityId('yh_ufo_prd_detail_collect_btn', FIND_VIEW_OVER_TIME);
    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("点返回首页");
    tapView = await driver.waitForElementByAccessibilityId('yh_base_vc_back_btn', FIND_VIEW_OVER_TIME);
    tapView.click();
    await driver.sleep(ACTION_PAUSE_TIME);
});