Authored by 李犇

订单、商品详情、首页、tab切换测试用例——review by 陈林

@@ -5,10 +5,22 @@ const {FIND_VIEW_OVER_TIME, ACTION_PAUSE_TIME} = require('../../config/constant' @@ -5,10 +5,22 @@ const {FIND_VIEW_OVER_TIME, ACTION_PAUSE_TIME} = require('../../config/constant'
5 5
6 describe(ANDROID_ORDER_CONFIRM, '下单', async(driver) => { 6 describe(ANDROID_ORDER_CONFIRM, '下单', async(driver) => {
7 7
  8 + // 暂停
  9 + await driver.sleep(ACTION_PAUSE_TIME);
  10 +
8 //点击首页的tab bar 分类按钮 11 //点击首页的tab bar 分类按钮
9 - let categoryTab = await driver.waitForElementById('com.yoho:id/tabMain_radioImage_sort_rl', FIND_VIEW_OVER_TIME); 12 + let categoryTab = await driver.waitForElementById('com.yoho:id/tabMain_radioImage_sort_rl', 10000);
10 await categoryTab.click(); 13 await categoryTab.click();
11 - //点击分类中的 其中一个分类 14 +
  15 + // 暂停
  16 + await driver.sleep(ACTION_PAUSE_TIME);
  17 +
  18 + //点击分类中的第一个子分类:比如男装
  19 + let categorySubSortFirst = 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.RelativeLayout/android.widget.LinearLayout/android.widget.LinearLayout[1]/android.widget.TextView", FIND_VIEW_OVER_TIME);
  20 + await categorySubSortFirst.click();
  21 +
  22 +
  23 + //点击分类中的 其中一个品类
12 let category = 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.RelativeLayout/android.widget.FrameLayout/android.widget.RelativeLayout/android.widget.LinearLayout/android.view.ViewGroup/android.support.v7.widget.RecyclerView/android.widget.LinearLayout[1]/android.widget.GridView/android.widget.RelativeLayout[1]/android.widget.ImageView", FIND_VIEW_OVER_TIME); 24 let category = 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.RelativeLayout/android.widget.FrameLayout/android.widget.RelativeLayout/android.widget.LinearLayout/android.view.ViewGroup/android.support.v7.widget.RecyclerView/android.widget.LinearLayout[1]/android.widget.GridView/android.widget.RelativeLayout[1]/android.widget.ImageView", FIND_VIEW_OVER_TIME);
13 await category.click(); 25 await category.click();
14 26
@@ -27,7 +39,7 @@ describe(ANDROID_ORDER_CONFIRM, '下单', async(driver) => { @@ -27,7 +39,7 @@ describe(ANDROID_ORDER_CONFIRM, '下单', async(driver) => {
27 await addToCart.click(); 39 await addToCart.click();
28 40
29 //选择尺码 41 //选择尺码
30 - let chooseSize = await driver.waitForElementByXPath('/hierarchy/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.RelativeLayout/android.widget.LinearLayout/android.widget.ScrollView/android.widget.LinearLayout/android.widget.LinearLayout[2]/android.view.ViewGroup/android.widget.LinearLayout[1]/android.widget.TextView', FIND_VIEW_OVER_TIME); 42 + let chooseSize = await driver.waitForElementByXPath('/hierarchy/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.RelativeLayout/android.widget.LinearLayout/android.widget.ScrollView/android.widget.LinearLayout/android.widget.LinearLayout[2]/android.view.ViewGroup/android.widget.LinearLayout[3]/android.widget.TextView', FIND_VIEW_OVER_TIME);
31 await chooseSize.click(); 43 await chooseSize.click();
32 44
33 // 暂停 45 // 暂停
@@ -26,6 +26,7 @@ describe(ANDROID_PRODUCT_DETAIL, 'Android 商品详情进入用例', async(drive @@ -26,6 +26,7 @@ describe(ANDROID_PRODUCT_DETAIL, 'Android 商品详情进入用例', async(drive
26 26
27 // 暂停 27 // 暂停
28 await driver.sleep(ACTION_PAUSE_TIME); 28 await driver.sleep(ACTION_PAUSE_TIME);
  29 +
29 //点击其中的一个商品 30 //点击其中的一个商品
30 let firstProduct = 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.RelativeLayout/android.widget.RelativeLayout/android.widget.ScrollView/android.widget.LinearLayout/android.support.v4.view.ViewPager/android.widget.RelativeLayout/android.widget.RelativeLayout/android.widget.RelativeLayout[1]/android.widget.LinearLayout/android.widget.FrameLayout/android.support.v7.widget.RecyclerView/android.widget.RelativeLayout[1]/android.widget.LinearLayout/android.widget.RelativeLayout/android.widget.ImageView[1]"); 31 let firstProduct = 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.RelativeLayout/android.widget.RelativeLayout/android.widget.ScrollView/android.widget.LinearLayout/android.support.v4.view.ViewPager/android.widget.RelativeLayout/android.widget.RelativeLayout/android.widget.RelativeLayout[1]/android.widget.LinearLayout/android.widget.FrameLayout/android.support.v7.widget.RecyclerView/android.widget.RelativeLayout[1]/android.widget.LinearLayout/android.widget.RelativeLayout/android.widget.ImageView[1]");
31 await firstProduct.click(); 32 await firstProduct.click();
@@ -44,7 +45,7 @@ describe(ANDROID_PRODUCT_DETAIL, 'Android 商品详情进入用例', async(drive @@ -44,7 +45,7 @@ describe(ANDROID_PRODUCT_DETAIL, 'Android 商品详情进入用例', async(drive
44 /*let chooseColor = await driver.waitForElementByXPath('/hierarchy/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.RelativeLayout/android.widget.LinearLayout/android.widget.ScrollView/android.widget.LinearLayout/android.widget.LinearLayout[1]/android.view.ViewGroup/android.widget.LinearLayout/android.widget.TextView', FIND_VIEW_OVER_TIME); 45 /*let chooseColor = await driver.waitForElementByXPath('/hierarchy/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.RelativeLayout/android.widget.LinearLayout/android.widget.ScrollView/android.widget.LinearLayout/android.widget.LinearLayout[1]/android.view.ViewGroup/android.widget.LinearLayout/android.widget.TextView', FIND_VIEW_OVER_TIME);
45 await chooseColor.click();*/ 46 await chooseColor.click();*/
46 //选择尺码 47 //选择尺码
47 - let chooseSize = await driver.waitForElementByXPath('/hierarchy/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.RelativeLayout/android.widget.LinearLayout/android.widget.ScrollView/android.widget.LinearLayout/android.widget.LinearLayout[2]/android.view.ViewGroup/android.widget.LinearLayout[1]/android.widget.TextView', FIND_VIEW_OVER_TIME); 48 + let chooseSize = await driver.waitForElementByXPath('/hierarchy/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.RelativeLayout/android.widget.LinearLayout/android.widget.ScrollView/android.widget.LinearLayout/android.widget.LinearLayout[2]/android.view.ViewGroup/android.widget.LinearLayout[2]/android.widget.TextView', FIND_VIEW_OVER_TIME);
48 await chooseSize.click(); 49 await chooseSize.click();
49 //加一下 50 //加一下
50 let chooseAdd = await driver.waitForElementById('com.yoho:id/tv_pro_info_num_add', FIND_VIEW_OVER_TIME); 51 let chooseAdd = await driver.waitForElementById('com.yoho:id/tv_pro_info_num_add', FIND_VIEW_OVER_TIME);