case_ufo_browse.js
4.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
/*
* 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);
// })
});