business_shopping.js
3.73 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
const wd = require('wd');
const {describe} = require('../../libs/driver');
const {iOS_BUSINESS_SHOPPING} = require('../../scene-types/scene-types');
const { FIND_VIEW_OVER_TIME, ACTION_PAUSE_TIME } = require('../../config/constant');
describe(iOS_BUSINESS_SHOPPING,'购物车', async(driver) => {
await driver.sleep(ACTION_PAUSE_TIME);
console.log("点击首页");
let touchTab = await driver.waitForElementByXPath('//XCUIElementTypeApplication[@name="Yoho!Buy有货"]/XCUIElementTypeWindow[1]/XCUIElementTypeOther/XCUIElementTypeOther[1]/XCUIElementTypeOther[2]/XCUIElementTypeTabBar/XCUIElementTypeButton[1]', FIND_VIEW_OVER_TIME);
await touchTab.click();
await driver.sleep(ACTION_PAUSE_TIME);
// let touchTab = await driver.waitForElementByAccessibilityId('indicator_shoppingbag',10000);
touchTab = await driver.waitForElementByXPath('//XCUIElementTypeApplication[@name="Yoho!Buy有货"]/XCUIElementTypeWindow[1]/XCUIElementTypeOther/XCUIElementTypeOther[1]/XCUIElementTypeOther[2]/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther[4]',FIND_VIEW_OVER_TIME);
await touchTab.click();
// driver.execute('mobile: scroll', {direction: 'down', element: element.value.'BF000000-0000-0000-922D-000000000000'});
// await driver.sleep(3000);
await driver.sleep(ACTION_PAUSE_TIME);
touchTab = await driver.waitForElementByAccessibilityId('select', FIND_VIEW_OVER_TIME);//单选
await touchTab.click();
//'selectAll' 全选 'mealSelect' 套餐
await driver.sleep(ACTION_PAUSE_TIME);
touchTab = await driver.waitForElementByAccessibilityId('editCart', FIND_VIEW_OVER_TIME);//编辑
await touchTab.click();
await driver.sleep(ACTION_PAUSE_TIME);
touchTab = await driver.waitForElementByAccessibilityId('shopcart_add', FIND_VIEW_OVER_TIME);//增加
await touchTab.click();
await driver.sleep(ACTION_PAUSE_TIME);
touchTab = await driver.waitForElementByAccessibilityId('shopcart_sub', FIND_VIEW_OVER_TIME);//减少
await touchTab.click();
await driver.sleep(ACTION_PAUSE_TIME);
touchTab = await driver.waitForElementByAccessibilityId('editCart', FIND_VIEW_OVER_TIME);//完成
await touchTab.click();
await driver.sleep(ACTION_PAUSE_TIME);
touchTab = await driver.waitForElementByAccessibilityId('submitAndPay', FIND_VIEW_OVER_TIME);
await touchTab.click();
await driver.sleep(ACTION_PAUSE_TIME);
touchTab = await driver.waitForElementByAccessibilityId('确定', FIND_VIEW_OVER_TIME);//下单
await touchTab.click();
await driver.sleep(ACTION_PAUSE_TIME);
touchTab = await driver.waitForElementByAccessibilityId('yh_base_vc_back_btn', FIND_VIEW_OVER_TIME);//返回
await touchTab.click();
await driver.sleep(ACTION_PAUSE_TIME);
touchTab = await driver.waitForElementByAccessibilityId('确认离开', FIND_VIEW_OVER_TIME);//返回
await touchTab.click();
await driver.sleep(ACTION_PAUSE_TIME);
touchTab = await driver.waitForElementByAccessibilityId('yh_base_vc_back_btn', FIND_VIEW_OVER_TIME);//返回
await touchTab.click();
////XCUIElementTypeApplication[@name="Yoho!Buy有货"]/XCUIElementTypeWindow[1]/XCUIElementTypeOther/XCUIElementTypeOther[1]/XCUIElementTypeOther[2]/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeTable/XCUIElementTypeCell[3]
// touchTab = await driver.waitForElementByAccessibilityId('yh_paymentcenter_checked', 2000);//下单
// await touchTab.click();
// touchTab = await driver.waitForElementByAccessibilityId('支 付', 2000);//拉起支付
// await touchTab.click();
await driver.sleep(ACTION_PAUSE_TIME);
});