case_ufo_sell.js
4.75 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
71
72
/*
* 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);
});