case_ufo_sell.js 4.76 KB
/*
 * UFO 出售场景
 * author: chenlin
 * 
 */

const wd = require('wd');
const {describe} = require('../../libs/driver');
const {ANDROID_CASE_UFO_SELL} = require('../../scene-types/scene-types');
const {FIND_VIEW_OVER_TIME, ACTION_PAUSE_TIME} = require('../../config/constant');

describe(ANDROID_CASE_UFO_SELL, 'Android UFO商品出售', async(driver) => {

  /*//点击UFO tab,进入UFO首页
  let ufoTab = await driver.waitForElementById('com.yoho:id/tabMain_radioImage_ufo_rl', FIND_VIEW_OVER_TIME);
  await ufoTab.click();

  // 暂停
  await driver.sleep(ACTION_PAUSE_TIME);

  //进入商品详情
  let goodsView = await driver.waitForElementByXPath('/hierarchy/android.widget.FrameLayout/android.widget.FrameLayout/android.view.ViewGroup[1]/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.RelativeLayout/android.widget.FrameLayout[1]/android.widget.RelativeLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.view.ViewGroup/android.view.ViewGroup/android.view.ViewGroup/android.view.ViewGroup/android.view.ViewGroup[2]/android.view.ViewGroup/android.widget.ScrollView/android.view.ViewGroup/android.view.ViewGroup[6]/android.view.ViewGroup', FIND_VIEW_OVER_TIME);
  await goodsView.click();
  
  // 暂停
  await driver.sleep(ACTION_PAUSE_TIME);*/

  //商品详情出售按钮
  let sellView = await driver.waitForElementByXPath('/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.RelativeLayout[2]/android.widget.LinearLayout/android.widget.FrameLayout/android.view.ViewGroup/android.view.ViewGroup/android.view.ViewGroup/android.view.ViewGroup/android.view.ViewGroup/android.view.ViewGroup[1]/android.widget.TextView', FIND_VIEW_OVER_TIME);
  await sellView.click();
  
  // 暂停
  await driver.sleep(ACTION_PAUSE_TIME);

  //商品详情出售选择尺码
  let selectSizeView = await driver.waitForElementByXPath('/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.view.ViewGroup/android.view.ViewGroup/android.view.ViewGroup/android.view.ViewGroup[2]/android.widget.ScrollView/android.view.ViewGroup/android.view.ViewGroup/android.view.ViewGroup/android.view.ViewGroup/android.view.ViewGroup[2]', FIND_VIEW_OVER_TIME);
  await selectSizeView.click();

  // 暂停
  await driver.sleep(ACTION_PAUSE_TIME);

  //商品详情出售选择现货
  let selectNormalPrdAfterSizeView = await driver.waitForElementByXPath('/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.view.ViewGroup/android.view.ViewGroup/android.view.ViewGroup/android.view.ViewGroup[2]/android.view.ViewGroup[2]/android.view.ViewGroup[1]', FIND_VIEW_OVER_TIME);
  await selectNormalPrdAfterSizeView.click();

  // 暂停
  await driver.sleep(ACTION_PAUSE_TIME);

  //商品详情出售界面输入价格
  let sellPriceView = await driver.waitForElementByXPath('/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.RelativeLayout[2]/android.widget.LinearLayout/android.widget.FrameLayout/android.view.ViewGroup/android.view.ViewGroup/android.view.ViewGroup/android.view.ViewGroup/android.widget.ScrollView/android.view.ViewGroup/android.view.ViewGroup[2]/android.view.ViewGroup[1]/android.widget.EditText', FIND_VIEW_OVER_TIME);
  await sellPriceView.sendKeys("9");
  
  // 暂停
  await driver.sleep(ACTION_PAUSE_TIME);

  //商品详情出售界面勾选协议
  let sellProtolCheckView = await driver.waitForElementByXPath('/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.RelativeLayout[2]/android.widget.LinearLayout/android.widget.FrameLayout/android.view.ViewGroup/android.view.ViewGroup/android.view.ViewGroup/android.view.ViewGroup/android.view.ViewGroup/android.view.ViewGroup[2]/android.view.ViewGroup/android.widget.ImageView', FIND_VIEW_OVER_TIME);
  await sellProtolCheckView.click();
  
  // 暂停
  await driver.sleep(ACTION_PAUSE_TIME);

  //商品详情出售界面点击出售
  let sellProductView = await driver.waitForElementByXPath('/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.RelativeLayout[2]/android.widget.LinearLayout/android.widget.FrameLayout/android.view.ViewGroup/android.view.ViewGroup/android.view.ViewGroup/android.view.ViewGroup/android.view.ViewGroup/android.view.ViewGroup[3]/android.view.ViewGroup/android.widget.TextView', FIND_VIEW_OVER_TIME);
  await sellProductView.click();
  
  // 暂停
  await driver.sleep(ACTION_PAUSE_TIME);
  

 
});