1
|
const wd = require('wd');
|
1
|
const wd = require('wd');
|
2
|
const { describe } = require('../../libs/driver');
|
2
|
const { describe } = require('../../libs/driver');
|
3
|
const { IOS_PRODUCT_DETAIL_GROUP } = require('../../scene-types/scene-types');
|
3
|
const { IOS_PRODUCT_DETAIL_GROUP } = require('../../scene-types/scene-types');
|
4
|
-const IOS_SLEEP_WAIT_TIME = 3000;
|
4
|
+const { FIND_VIEW_OVER_TIME, ACTION_PAUSE_TIME } = require('../../config/constant');
|
5
|
|
5
|
|
6
|
-describe(IOS_PRODUCT_DETAIL_GROUP, '拼团商品详情页埋点测试', async (driver) => {
|
|
|
7
|
- //点击我的 tab
|
6
|
+describe(IOS_PRODUCT_DETAIL_GROUP, '拼团商品详情页埋点测试(未登录)', async (driver) => {
|
|
|
7
|
+ console.log("点击TAB 我的");
|
8
|
let tapView = await driver.waitForElementByXPath('//XCUIElementTypeApplication[@name="Yoho!Buy有货"]/XCUIElementTypeWindow[1]/XCUIElementTypeOther/XCUIElementTypeOther[1]/XCUIElementTypeOther[2]/XCUIElementTypeTabBar/XCUIElementTypeButton[5]', 10000);
|
8
|
let tapView = await driver.waitForElementByXPath('//XCUIElementTypeApplication[@name="Yoho!Buy有货"]/XCUIElementTypeWindow[1]/XCUIElementTypeOther/XCUIElementTypeOther[1]/XCUIElementTypeOther[2]/XCUIElementTypeTabBar/XCUIElementTypeButton[5]', 10000);
|
9
|
tapView.click();
|
9
|
tapView.click();
|
10
|
- //暂停
|
|
|
11
|
- await driver.sleep(IOS_SLEEP_WAIT_TIME);
|
|
|
12
|
- // //模拟向上滚动
|
|
|
13
|
- // driver.execute('mobile: scroll', { direction: 'down'});
|
|
|
14
|
- // await new Promise(r => {
|
|
|
15
|
- // setTimeout(() => {
|
|
|
16
|
- // r()
|
|
|
17
|
- // }, 2000);
|
|
|
18
|
- // });
|
|
|
19
|
-
|
|
|
20
|
- //点击5折拼团
|
10
|
+ await driver.sleep(ACTION_PAUSE_TIME);
|
|
|
11
|
+ console.log("点击5折 拼团");
|
21
|
tapView = await driver.waitForElementByXPath('//XCUIElementTypeApplication[@name="Yoho!Buy有货"]/XCUIElementTypeWindow[1]/XCUIElementTypeOther/XCUIElementTypeOther[1]/XCUIElementTypeOther[2]/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeCollectionView/XCUIElementTypeCell[16]', 3000);
|
12
|
tapView = await driver.waitForElementByXPath('//XCUIElementTypeApplication[@name="Yoho!Buy有货"]/XCUIElementTypeWindow[1]/XCUIElementTypeOther/XCUIElementTypeOther[1]/XCUIElementTypeOther[2]/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeCollectionView/XCUIElementTypeCell[16]', 3000);
|
22
|
tapView.click();
|
13
|
tapView.click();
|
23
|
- //暂停
|
|
|
24
|
- await driver.sleep(IOS_SLEEP_WAIT_TIME);
|
|
|
25
|
- //点击19元专区
|
|
|
26
|
- tapView = await driver.waitForElementByXPath('//XCUIElementTypeApplication[@name="Yoho!Buy有货"]/XCUIElementTypeWindow[1]/XCUIElementTypeOther/XCUIElementTypeOther[1]/XCUIElementTypeOther[2]/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeWebView/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther[3]', 3000);
|
14
|
+ await driver.sleep(ACTION_PAUSE_TIME);
|
|
|
15
|
+ console.log("点击返回");
|
|
|
16
|
+ tapView = await driver.waitForElementByAccessibilityId('yh_base_vc_back_btn', FIND_VIEW_OVER_TIME);
|
27
|
tapView.click();
|
17
|
tapView.click();
|
28
|
- //暂停
|
|
|
29
|
- await driver.sleep(IOS_SLEEP_WAIT_TIME);
|
|
|
30
|
- //点击列表第一个
|
|
|
31
|
- tapView = await driver.waitForElementByXPath('//XCUIElementTypeApplication[@name="Yoho!Buy有货"]/XCUIElementTypeWindow[1]/XCUIElementTypeOther/XCUIElementTypeOther[1]/XCUIElementTypeOther[2]/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther[1]/XCUIElementTypeScrollView/XCUIElementTypeOther/XCUIElementTypeOther[1]', 3000);
|
18
|
+ await driver.sleep(ACTION_PAUSE_TIME);
|
|
|
19
|
+ console.log("点击首页TAB");
|
|
|
20
|
+ tapView = await driver.waitForElementByXPath('//XCUIElementTypeApplication[@name="Yoho!Buy有货"]/XCUIElementTypeWindow[1]/XCUIElementTypeOther/XCUIElementTypeOther[1]/XCUIElementTypeOther[2]/XCUIElementTypeTabBar/XCUIElementTypeButton[1]', 10000);
|
32
|
tapView.click();
|
21
|
tapView.click();
|
33
|
- //暂停
|
|
|
34
|
- await driver.sleep(IOS_SLEEP_WAIT_TIME);
|
|
|
35
|
- // driver.execute('mobile: scroll', { direction: 'down' });
|
|
|
36
|
-
|
22
|
+ await driver.sleep(ACTION_PAUSE_TIME);
|
|
|
23
|
+ console.log("点击首页顶部搜索框");
|
|
|
24
|
+ tapView = await driver.waitForElementByAccessibilityId('homeSearch', FIND_VIEW_OVER_TIME);
|
|
|
25
|
+ tapView.click();
|
|
|
26
|
+ await driver.sleep(ACTION_PAUSE_TIME);
|
|
|
27
|
+ console.log("输入指定的拼团SKN");
|
|
|
28
|
+ tapView = await driver.waitForElementByAccessibilityId('yh_search_vc_search', FIND_VIEW_OVER_TIME);
|
|
|
29
|
+ tapView.sendKeys("51905716");
|
|
|
30
|
+ await driver.sleep(ACTION_PAUSE_TIME);
|
|
|
31
|
+ console.log("点击搜索");
|
|
|
32
|
+ tapView = await driver.waitForElementByAccessibilityId('Search', FIND_VIEW_OVER_TIME);
|
|
|
33
|
+ tapView.click();
|
|
|
34
|
+ await driver.sleep(ACTION_PAUSE_TIME);
|
|
|
35
|
+ console.log("点击指定的拼团商品");
|
|
|
36
|
+ tapView = await driver.waitForElementByAccessibilityId('yh_prd_cell_0_1', FIND_VIEW_OVER_TIME);
|
|
|
37
|
+ tapView.click();
|
|
|
38
|
+ await driver.sleep(ACTION_PAUSE_TIME);
|
|
|
39
|
+ console.log("点击分享");
|
|
|
40
|
+ tapView = await driver.waitForElementByAccessibilityId('shareActionBtn', 3000);
|
|
|
41
|
+ await tapView.click();
|
|
|
42
|
+ await driver.sleep(ACTION_PAUSE_TIME);
|
|
|
43
|
+ console.log("取消分享");
|
|
|
44
|
+ tapView = await driver.waitForElementByAccessibilityId('取消', 3000);
|
|
|
45
|
+ await tapView.click();
|
|
|
46
|
+ await driver.sleep(ACTION_PAUSE_TIME);
|
|
|
47
|
+ console.log("点击更多");
|
|
|
48
|
+ tapView = await driver.waitForElementByAccessibilityId('moreActionBtn', 3000);
|
|
|
49
|
+ tapView.click();
|
|
|
50
|
+ await driver.sleep(ACTION_PAUSE_TIME);
|
|
|
51
|
+ console.log("回到首页");
|
|
|
52
|
+ tapView = await driver.waitForElementByAccessibilityId('yh_quick_jump_menu_1', FIND_VIEW_OVER_TIME);
|
|
|
53
|
+ tapView.click();
|
|
|
54
|
+ await driver.sleep(ACTION_PAUSE_TIME);
|
37
|
}); |
55
|
}); |