product-detail.js 1.74 KB
const {describe} = require('../../libs/driver');
const {IOS_PRODUCT_DETAIL} = require('../../scene-types/scene-types');

describe(IOS_PRODUCT_DETAIL, '商品详情页埋点测试', async(driver) => {
  let categoryTab = await driver.waitForElementByXPath('//XCUIElementTypeApplication[@name="Yoho!Buy有货"]/XCUIElementTypeWindow[1]/XCUIElementTypeOther/XCUIElementTypeOther[1]/XCUIElementTypeOther[2]/XCUIElementTypeOther/XCUIElementTypeTabBar/XCUIElementTypeButton[2]', 10000);

  await categoryTab.click();
 
  let category = await driver.waitForElementByXPath('//XCUIElementTypeApplication[@name="Yoho!Buy有货"]/XCUIElementTypeWindow[1]/XCUIElementTypeOther/XCUIElementTypeOther[1]/XCUIElementTypeOther[2]/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther[1]/XCUIElementTypeOther[3]/XCUIElementTypeCollectionView/XCUIElementTypeCell[1]/XCUIElementTypeOther', 10000);

  await category.click();

  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/XCUIElementTypeOther/XCUIElementTypeCollectionView/XCUIElementTypeCell[1]/XCUIElementTypeOther/XCUIElementTypeOther', 10000);

  await firstProduct.click();

  let addToCart = await driver.waitForElementByXPath('//XCUIElementTypeButton[@name="加入购物车"]', 10000);

  await addToCart.click();
});