tab_home.js
2.59 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
73
74
75
76
77
78
79
80
81
82
const wd = require('wd');
const {describe} = require('../../libs/driver');
const {iOS_TAB_HOME} = require('../../scene-types/scene-types');
const { FIND_VIEW_OVER_TIME, ACTION_PAUSE_TIME } = require('../../config/constant');
describe(iOS_TAB_HOME,'首页', async(driver) => {
let touchTab = await driver.waitForElementByAccessibilityId('home drawer entrance',10000);
await touchTab.click();
await new Promise(r => {
setTimeout(() => {
r()
}, 2000);
})
await (new wd.TouchAction(driver))
.longPress({x: 300, y: 158})
.moveTo({x: 290, y: 162})
.release()
.perform()
// touchTab = await driver.waitForElementByAccessibilityId('homeSearch',5000);
// await touchTab.click();
// touchTab = await driver.waitForElementByAccessibilityId('home message center',10000);
// await touchTab.click();
// touchTab = await driver.waitForElementByAccessibilityId('qr home',10000);
// await touchTab.click();
touchTab = await driver.waitForElementByAccessibilityId('球鞋',5000);
await touchTab.click();
await driver.sleep(ACTION_PAUSE_TIME);
touchTab = await driver.waitForElementByAccessibilityId('男装', 5000);
await touchTab.click();
await driver.sleep(ACTION_PAUSE_TIME);
// 模拟scrollView的滚动
await (new wd.TouchAction(driver))
.longPress({ x: 200, y: 500 })
.moveTo({ x: 200, y: 200 })
.release()
.perform()
await driver.sleep(ACTION_PAUSE_TIME);
touchTab = await driver.waitForElementByAccessibilityId('女装',5000);
await touchTab.click();
await driver.sleep(ACTION_PAUSE_TIME);
touchTab = await driver.waitForElementByAccessibilityId('生活方式',5000);
await touchTab.click();
await driver.sleep(ACTION_PAUSE_TIME);
touchTab = await driver.waitForElementByAccessibilityId('高街BLK', 1000);
await touchTab.click();
await driver.sleep(ACTION_PAUSE_TIME);
touchTab = await driver.waitForElementByAccessibilityId('潮童',5000);
await touchTab.click();
await driver.sleep(ACTION_PAUSE_TIME);
touchTab = await driver.waitForElementByAccessibilityId('有食',5000);
await touchTab.click();
await driver.sleep(ACTION_PAUSE_TIME);
touchTab = await driver.waitForElementByXPath('//XCUIElementTypeApplication[@name="Yoho!Buy有货"]/XCUIElementTypeWindow[1]/XCUIElementTypeOther/XCUIElementTypeOther[1]/XCUIElementTypeOther[2]/XCUIElementTypeTabBar/XCUIElementTypeButton[1]',5000);
await touchTab.click();
await new Promise(r => {
setTimeout(() => {
r()
}, 5000);
})
});