tab_category.js 3.95 KB
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 分类按钮
    let tapView = await driver.waitForElementByXPath('//XCUIElementTypeApplication[@name="Yoho!Buy有货"]/XCUIElementTypeWindow[1]/XCUIElementTypeOther/XCUIElementTypeOther[1]/XCUIElementTypeOther[2]/XCUIElementTypeTabBar/XCUIElementTypeButton[2]', FIND_VIEW_OVER_TIME);
    await tapView.click();
    //选择左侧的分类点击 第二个
    await driver.sleep(ACTION_PAUSE_TIME);
    tapView = await driver.waitForElementByAccessibilityId('YH_LeftCategoryView_1', FIND_VIEW_OVER_TIME);
    await tapView.click();
    //选择左侧的分类点击 第三个
    await driver.sleep(ACTION_PAUSE_TIME);
    tapView = await driver.waitForElementByAccessibilityId('YH_LeftCategoryView_2', FIND_VIEW_OVER_TIME);
    await tapView.click();
    //选择左侧的分类点击 第四个
    await driver.sleep(ACTION_PAUSE_TIME);
    tapView = await driver.waitForElementByAccessibilityId('YH_LeftCategoryView_3', FIND_VIEW_OVER_TIME);
    await tapView.click();
    //选择 生活方式点击
    await driver.sleep(ACTION_PAUSE_TIME);
    tapView = await driver.waitForElementByAccessibilityId('yh_SlideSegmentControl_2', FIND_VIEW_OVER_TIME);
    await tapView.click();
    //选择 女装点击
    await driver.sleep(ACTION_PAUSE_TIME);
    tapView = await driver.waitForElementByAccessibilityId('yh_SlideSegmentControl_1', FIND_VIEW_OVER_TIME);
    await tapView.click();
    //选择 潮童点击
    await driver.sleep(ACTION_PAUSE_TIME);
    tapView = await driver.waitForElementByAccessibilityId('yh_SlideSegmentControl_3', FIND_VIEW_OVER_TIME);
    await tapView.click();
    //选择 高街BLK点击
    await driver.sleep(ACTION_PAUSE_TIME);
    tapView = await driver.waitForElementByAccessibilityId('yh_SlideSegmentControl_4', FIND_VIEW_OVER_TIME);
    await tapView.click();
    //选择 男装点击
    await driver.sleep(ACTION_PAUSE_TIME);
    tapView = await driver.waitForElementByAccessibilityId('yh_SlideSegmentControl_0', FIND_VIEW_OVER_TIME);
    await tapView.click();

    //点击分类中的 其中一个分类
    await driver.sleep(ACTION_PAUSE_TIME);
    tapView = await driver.waitForElementByAccessibilityId('yh_categoryCell_1', FIND_VIEW_OVER_TIME);
    await tapView.click();
    console.log("回到品类首页");
    await driver.sleep(ACTION_PAUSE_TIME);
    tapView = await driver.waitForElementByAccessibilityId('yh_base_vc_back_btn', FIND_VIEW_OVER_TIME);
    tapView.click();
    console.log("点击品牌");
    await driver.sleep(ACTION_PAUSE_TIME);
    tapView = await driver.waitForElementByAccessibilityId('yh_brand_nav_btn', FIND_VIEW_OVER_TIME);
    tapView.click();
    await driver.sleep(ACTION_PAUSE_TIME);
    tapView = await driver.waitForElementByAccessibilityId('yh_SlideSegmentControl_2', FIND_VIEW_OVER_TIME);
    tapView.click();
    await driver.sleep(ACTION_PAUSE_TIME);
    tapView = await driver.waitForElementByAccessibilityId('yh_SlideSegmentControl_4', FIND_VIEW_OVER_TIME);
    tapView.click();
    await driver.sleep(ACTION_PAUSE_TIME);
    tapView = await driver.waitForElementByAccessibilityId('yh_SlideSegmentControl_3', FIND_VIEW_OVER_TIME);
    tapView.click();
    await driver.sleep(ACTION_PAUSE_TIME);
    tapView = await driver.waitForElementByAccessibilityId('yh_SlideSegmentControl_1', FIND_VIEW_OVER_TIME);
    tapView.click();
    await driver.sleep(ACTION_PAUSE_TIME);
    tapView = await driver.waitForElementByAccessibilityId('yh_SlideSegmentControl_0', FIND_VIEW_OVER_TIME);
    tapView.click();
    await driver.sleep(ACTION_PAUSE_TIME);
    tapView = await driver.waitForElementByAccessibilityId('yh_category_nav_btn', FIND_VIEW_OVER_TIME);
    tapView.click();
    await driver.sleep(ACTION_PAUSE_TIME);

});