case_ufo_browse.js 4.44 KB
/*
 * UFO 浏览场景,包括UFO首页、UFO品类、UFO系列列表、UFO商品详情页面
 * author: chenlin
 * 
 */

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

describe(ANDROID_CASE_UFO_BROWSE, '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 categoryView = 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[1]/android.view.ViewGroup[3]/android.widget.ImageView', FIND_VIEW_OVER_TIME);
  await categoryView.click();

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

  //退出分类列表
  let quitCategoryView = await driver.waitForElementByXPath('/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.RelativeLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.view.ViewGroup/android.view.ViewGroup/android.view.ViewGroup/android.view.ViewGroup/android.view.ViewGroup[1]/android.view.ViewGroup/android.view.ViewGroup[1]/android.widget.ImageView', FIND_VIEW_OVER_TIME);
  await quitCategoryView.click();

  //点击进入系列列表
  let searialView = 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[2]/android.widget.ScrollView/android.view.ViewGroup/android.view.ViewGroup[3]/android.view.ViewGroup/android.view.ViewGroup/android.widget.ImageView', FIND_VIEW_OVER_TIME);
  await searialView.click();

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

  //退出系列列表
  let quitSearialView = await driver.waitForElementByXPath('/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.RelativeLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.view.ViewGroup/android.view.ViewGroup/android.view.ViewGroup/android.view.ViewGroup/android.view.ViewGroup[2]/android.view.ViewGroup/android.view.ViewGroup/android.view.ViewGroup[1]/android.view.ViewGroup/android.widget.ImageView', FIND_VIEW_OVER_TIME);
  await quitSearialView.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 quitGoodsView = await driver.waitForElementById('com.yoho:id/back_btn', FIND_VIEW_OVER_TIME);
  await quitGoodsView.click();
  
  // 暂停
  await driver.sleep(ACTION_PAUSE_TIME);

  
  // await new Promise(r => {
  //   setTimeout(() => {
  //       r()
  //   }, 3000);
  // })



 
});