Authored by 朱小军

购物车脚本

const {
iOS_BUSINESS_SHOPPING
} = require('../../scene-types/scene-types');
module.exports = {
[iOS_BUSINESS_SHOPPING]:[
{ op: 'YB_SHOW_GLOBAL_SHOPCART', name: '全球购购物车', types: {GOODS_LIST: Array, SOLD_OUT_GOODS_LIST: Array}},
{ op: 'YB_CHOOSE_FOR_YOU', name: "看了此商品的人还买了", equals: { CART_TYPE: "1", REC_POSE: '100041'}},
{ op: 'YB_CHOOSE_FOR_YOU', name: "*[预售]看了此商品的人还买了", equals: { CART_TYPE: "2", REC_POSE: '100041' }},
{ op: 'YB_CHOOSE_FOR_YOU', name: "购物车猜你喜欢", equals: { REC_POSE: '100003'}},
{ op: 'YB_SC_MOD_ADD', name: "增加商品数量"},
{ op: 'YB_SC_MOD_SUB', name: "减少商品数量"},
{ op: 'YB_SC_EDIT', name: "编辑"},
// { op: 'YB_GDS_DT_SEL', name: "购物车内直接购买"},
]
};
\ No newline at end of file
... ...
... ... @@ -2,18 +2,48 @@ const wd = require('wd');
const {describe} = require('../../libs/driver');
const {iOS_BUSINESS_SHOPPING} = require('../../scene-types/scene-types');
describe(iOS_BUSINESS_SHOPPING,'购物车-下单', async(driver) => {
let touchTab = await driver.waitForElementByAccessibilityId('indicator_shoppingbag',10000);
describe(iOS_BUSINESS_SHOPPING,'购物车', async(driver) => {
// let touchTab = await driver.waitForElementByAccessibilityId('indicator_shoppingbag',10000);
let touchTab = await driver.waitForElementByXPath('//XCUIElementTypeApplication[@name="Yoho!Buy有货"]/XCUIElementTypeWindow[1]/XCUIElementTypeOther/XCUIElementTypeOther[1]/XCUIElementTypeOther[2]/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther[4]',5000);
await touchTab.click();
touchTab = await driver.waitForElementByAccessibilityId('全选');
touchTab = await driver.waitForElementByAccessibilityId('select',3000);//单选
await touchTab.click();
// await new Promise(r => {
// setTimeout(() => {
// r()
// }, 2000);
// })
touchTab = await driver.waitForElementByAccessibilityId('结算', 2000);
// touchTab = await driver.waitForElementByAccessibilityId('selectAll',3000);//全选
// await touchTab.click();
// touchTab = await driver.waitForElementByAccessibilityId('mealSelect',3000);//套餐
// await touchTab.click();
touchTab = await driver.waitForElementByAccessibilityId('editCart',5000);//编辑
await touchTab.click();
touchTab = await driver.waitForElementByAccessibilityId('shopcart_add',3000);//增加
await touchTab.click();
touchTab = await driver.waitForElementByAccessibilityId('shopcart_sub',3000);//减少
await touchTab.click();
touchTab = await driver.waitForElementByAccessibilityId('editCart',1000);//完成
await touchTab.click();
touchTab = await driver.waitForElementByAccessibilityId('submitAndPay', 2000);
await touchTab.click();
touchTab = await driver.waitForElementByAccessibilityId('确定', 2000);//下单
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 new Promise(r => {
setTimeout(() => {
r()
}, 2000);
})
});
\ No newline at end of file
... ...