def test_multi_split_with_weight(): vip_name = "会员" + base.get_now_string() vip_interface.new_vip(vip_name) print(f"{vip_name}") product_code = base.get_now_string() product_interface.new_product(product_code) sku_code = product_interface.get_sku_code(product_code)[0] product_interface.modify_sku_price(sku_code, "100") sku_id_list = product_interface.get_sku_id("", product_code) modify_info_dict = {"重量": "1.0"} product_interface.multi_modify_sku_info(sku_id_list, modify_info_dict) sku_info = [{'商家编码': sku_code, '数量': '10'}] print(f"商品信息是:{sku_info}") order_code = order_interface.new_order(vip_name, sku_info)["Code"] base.fuzzy_search("订单编码", order_code) base.wait_element_click(base.get_cell_xpath(1, "订单编码")) base.click_space() element = base.wait_element(base.get_cell_xpath(1, "订单状态")) text = element.text base.wait_element_click(base.find_xpath("拆单")) base.wait_element(base.find_xpath("拆单", "按重量拆包")) time.sleep(1) base.wait_element_click(base.find_xpath("拆单", "按重量拆包")) time.sleep(1) with base.operate_page("订单", "打印发货", "打印发货框架"): start = datetime.datetime.now() while (datetime.datetime.now() - start).seconds < 30: base.fuzzy_search("发货单号", order_code) product_num_list = base.get_column_text("商品数") if len(product_num_list) == 4: assert ['1', '3', '3', '3'] == product_num_list break
def test_multi_split_to_one_piece(): vip_name = "会员" + base.get_now_string() vip_interface.new_vip(vip_name) print(f"{vip_name}") product_code = base.get_now_string() product_interface.new_product(product_code) sku_code = product_interface.get_sku_code(product_code)[0] product_interface.modify_sku_price(sku_code, "100") sku_info = [{'商家编码': sku_code, '数量': '20'}, ] order_code = order_interface.new_order(vip_name, sku_info)["Code"] base.fuzzy_search("订单编码", vip_name) base.wait_element_click(base.get_cell_xpath(1, "订单编码")) base.click_space() element = base.wait_element(base.get_cell_xpath(1, "订单状态")) text = element.text base.wait_element_click(base.find_xpath("拆单")) base.wait_element(base.find_xpath("拆单", "批量拆分成单件")) time.sleep(1) base.wait_element_click(base.find_xpath("拆单", "批量拆分成单件")) base.wait_element(base.find_xpath("提示", "订单会被拆分成商品数量为1的发货单发货,是否继续操作?")) time.sleep(1) base.wait_element_click(base.find_xpath("提示", "确定")) with base.operate_page("订单", "打印发货", "打印发货框架"): start = datetime.datetime.now() while (datetime.datetime.now() - start).seconds < 30: base.fuzzy_search("发货单号", order_code) product_num_list = base.get_column_text("商品数") if len(product_num_list) == 20: for i in product_num_list: assert int(i) == 1 break
def test_multi_split_with_warehouse(): vip_name = "会员" + base.get_now_string() vip_interface.new_vip(vip_name) print(f"{vip_name}") product_code = base.get_now_string() product_interface.new_product(product_code) main_sku_code = product_interface.get_sku_code(product_code)[0] product_interface.modify_sku_price(main_sku_code, "100") sku_id_list = product_interface.get_sku_id("", product_code) modify_info_dict = {"优先出库仓": "主仓库"} product_interface.multi_modify_sku_info(sku_id_list, modify_info_dict) sku_info = [{'商家编码': main_sku_code, '数量': '2'}] product_code = base.get_now_string() product_interface.new_product(product_code) test_sku_code = product_interface.get_sku_code(product_code)[0] product_interface.modify_sku_price(test_sku_code, "100") sku_id_list = product_interface.get_sku_id("", product_code) modify_info_dict = {"优先出库仓": "测试仓"} product_interface.multi_modify_sku_info(sku_id_list, modify_info_dict) sku_info.append({'商家编码': test_sku_code, '数量': '2'}) print(f"商品信息是:{sku_info}") order_code = order_interface.new_order(vip_name, sku_info)["Code"] base.fuzzy_search("订单编码", order_code) base.wait_element_click(base.get_cell_xpath(1, "订单编码")) base.click_space() element = base.wait_element(base.get_cell_xpath(1, "订单状态")) text = element.text base.wait_element_click(base.find_xpath("拆单")) base.wait_element(base.find_xpath("拆单", "按仓库拆包")) time.sleep(1) base.wait_element_click(base.find_xpath("拆单", "按仓库拆包")) time.sleep(1) with base.operate_page("订单", "打印发货", "打印发货框架"): start = datetime.datetime.now() while (datetime.datetime.now() - start).seconds < 30: base.fuzzy_search("发货单号", order_code) base.scroll_to(2) warehouse_list = base.get_column_text("仓库") if len(warehouse_list) == 2: assert "主仓库" in warehouse_list assert "测试仓" in warehouse_list break base.scroll_to(0) base.wait_element_click(base.get_cell_xpath("主仓库", "商品信息")) sku_code_list = delivery_order.get_all_float_sku_info("商家编码") for i in sku_code_list: assert i == main_sku_code base.wait_element_click(base.get_cell_xpath("测试仓", "商品信息")) sku_code_list = delivery_order.get_all_float_sku_info("商家编码") for i in sku_code_list: assert i == test_sku_code
def test_multi_split_to_multi_sku_one_package(): vip_name = "会员" + base.get_now_string() vip_interface.new_vip(vip_name) print(f"{vip_name}") product_code = base.get_now_string() product_interface.new_product(product_code) enough_sku_code_list = product_interface.get_sku_code(product_code) product_interface.modify_sku_price(enough_sku_code_list[0], "100") sku_info = [] for enough_sku_code in enough_sku_code_list: sku_info.append({'商家编码': enough_sku_code, '数量': '3'}) print(f"商品信息是:{sku_info}") sku_info.append({'商家编码': "测试商品1-红色 XXXXXXL", '数量': '3'}) sku_info.append({'商家编码': "测试商品1-红色 6XL", '数量': '3'}) order_code = order_interface.new_order(vip_name, sku_info)["Code"] base.fuzzy_search("订单编码", order_code) base.wait_element_click(base.get_cell_xpath(1, "订单编码")) base.click_space() element = base.wait_element(base.get_cell_xpath(1, "订单状态")) text = element.text base.wait_element_click(base.find_xpath("拆单")) base.wait_element(base.find_xpath("拆单", "多件成包")) time.sleep(1) base.wait_element_click(base.find_xpath("拆单", "多件成包")) time.sleep(1) with base.operate_page("订单", "打印发货", "打印发货框架"): start = datetime.datetime.now() while (datetime.datetime.now() - start).seconds < 30: base.fuzzy_search("发货单号", order_code) product_num_list = base.get_column_text("商品数") if int(len(product_num_list)) == 2: break assert ["21", "6"].sort() == product_num_list.sort() print(f"{product_num_list.sort()}") for i in range(1, 3): product_num_text = base.wait_element(base.get_cell_xpath(i, "商品数")).text print(product_num_text) if product_num_text == "6": base.wait_element_click(base.get_cell_xpath(i, "商品信息")) result = delivery_order.get_all_float_sku_info("商家编码") print(result) assert ["测试商品1-红色 XXXXXXL", "测试商品1-红色 6XL"].sort() == result.sort() elif product_num_text == "21": base.wait_element_click(base.get_cell_xpath(i, "商品信息")) result = delivery_order.get_all_float_sku_info("商家编码") print(result) assert result.sort() == enough_sku_code_list.sort() else: assert 1 == 2, "单件成包拆包结果不符合预期,请核实"
def test_multi_split_with_inventory(): # TODO:(RUI):全部订单页面 按照库存拆单报错:当前数据可能被其他人操作了,请刷新后重试!,请排查下审核问题,数据:测试专用 测试 8888 订单编码:TD200925016 正常情况下不会报错 vip_name = "会员" + base.get_now_string() vip_interface.new_vip(vip_name) print(f"{vip_name}") product_code = base.get_now_string() product_interface.new_product(product_code) enough_sku_code_list = product_interface.get_sku_code(product_code) product_interface.modify_sku_price(enough_sku_code_list[0], "100") stock_in_sku_info = [] stock_in_num = 0 for enough_sku_code in enough_sku_code_list: stock_in_num += 2 stock_in_sku_info .append({'商家编码': enough_sku_code, '数量': stock_in_num}) stock_in_order_id = inventory_interface.new_stock_in_order("主仓库", "供应商1", stock_in_sku_info)["ID"] inventory_interface.stock_in_stock_in_order(stock_in_order_id) sku_info = [] for enough_sku_code in enough_sku_code_list: sku_info .append({'商家编码': enough_sku_code, '数量': '3'}) print(f"商品信息是:{sku_info}") product_code = base.get_now_string() product_interface.new_product(product_code) lack_sku_code_list = product_interface.get_sku_code(product_code) product_interface.modify_sku_price(lack_sku_code_list[0], "100") for lack_sku_code in lack_sku_code_list: sku_info.append({'商家编码': lack_sku_code, '数量': '5'}) print(f"商品信息是:{sku_info}") order_code = order_interface.new_order(vip_name, sku_info)["Code"] base.fuzzy_search("订单编码", order_code) base.wait_element_click(base.get_cell_xpath(1, "订单编码")) base.click_space() element = base.wait_element(base.get_cell_xpath(1, "订单状态")) text = element.text base.wait_element_click(base.find_xpath("拆单")) base.wait_element(base.find_xpath("拆单", "按库存拆包")) time.sleep(1) base.wait_element_click(base.find_xpath("拆单", "按库存拆包")) time.sleep(1) with base.operate_page("订单", "打印发货", "打印发货框架"): start = datetime.datetime.now() while (datetime.datetime.now() - start).seconds < 30: base.fuzzy_search("发货单号", order_code) product_num_list = base.wait_element(base.get_cell_xpath(vip_name, "商品数")).text if int(product_num_list) == 9: print(f"按库存拆分:库存充足的库存全部拆包配货,库存不足的留下") break
def new_pos_oder(vip_name, sku_info): """ 由于需要打开页面才能读取到NewId,所以必须使用try catch 包裹 vip_name :会员名称 sku_info:商品信息列表,商品信息字典,如下 sku_info = [ {'SkuCode': '测试商品1-红色 XS', 'Qty': '2', 'Price': "100"}, {'SkuCode': '测试商品1-红色 S', 'Qty': '2', 'Price': "100"}, {'SkuCode': '测试商品1-红色 M', 'Qty': '2', 'Price': "100"}, ] """ with base.operate_page("订单", "门店收银", "门店收银框架") as e: vip_info = vip_interface.get_vip_info(vip_name) js = " return model.NewId;" new_id = base.driver.execute_script(js) url = "http://gw.erp12345.com/api/Pos/Pos/SingleSettle?dto={" dto = { "VipId": vip_info["data"]["Items"][0]["VipId"], "ShopId": "7494440358269421036", "WarehouseId": "162573418911628622", "SalesManId": "7494505976142234005", "SalesManName": "测试", "ReceiverPhone": vip_info["data"]["Items"][0]["ReceiverPhone"], "ReceiverMobile": vip_info["data"]["Items"][0]["ReceiverMobile"], "ReceiverZip": vip_info["data"]["Items"][0]["ReceiverZip"], "ReceiverRegionId": vip_info["data"]["Items"][0]["ReceiverRegionId"], "ReceiverName": vip_info["data"]["Items"][0]["ReceiverName"], "ReceiverAddress": vip_info["data"]["Items"][0]["ReceiverAddress"], "SumQty": 2, "SumRefundQty": 0, "SumAmount": 200, "Memo": "", "PayType": "2341617839082309572", "PaidAmount": 200, "DiscountAmount": 0, "PlatformPayCode": "", "PayAccount": "", "OrderCode": "", "NewId": f"{new_id}" } for k, v in dto.items(): url += f'"{k}":"{v}",' # 用于存储商品信息 lines = [] line = {} for sku in sku_info: sku_id = product_interface.get_sku_info( sku["SkuCode"])["data"]["Items"][0]["Id"] line["Id"] = sku_id line["Qty"] = sku["Qty"] line["Price"] = sku["Price"] line["VipPrice"] = vip_interface.get_sku_price_by_vip_id( vip_name, sku["SkuCode"]) actual_amount = int(line["Price"]) * int(line["Qty"]) line["ActualAmount"] = actual_amount discount = int(line["Price"]) / int(line["VipPrice"]) line["Discount"] = discount lines.append(dict(line)) url += "Lines:[" for s in lines: url += "{" for k, v in s.items(): url += f"'{k}':'{v}'," url += "}," url += "]}" headers = {'cookie': base.cookies} response = requests.post(url, headers=headers) result = dict(response.json()) return result
def test_vip_price_detail(): # 先确定下设置 setting_info = { "记录会员上次交易价:手工单或者门店单保存时,记录会员的商品交易价格": "true", "记录会员上次交易价 同款同价:手工单或者门店单保存时,记录会员的商品交易价格 同款同价": "false", "只有手工修改售价才会记录预设价格": "true", } interface.save_order_setting(setting_info) print("这就为了换个行") print("非同款同价模式+修改才记录会员价设置完成,修改设置之后等5秒,让设置生效") time.sleep(5) base.close_page("预设会员价明细") base.open_page("会员", "预设会员价明细", "预设会员价明细框架") # 新建会员 vip_name = base.get_now_string() print(f"新建一个会员,会员名称:{vip_name}") interface.new_vip(vip_name) print(f"新建的会员:{vip_name}在预设会员价页面没有任何记录") # 查询确认新会员没有任何记录 base.wait_element(base.find_xpath_by_placeholder("会员")).click() base.change_frame("预设会员价明细框架") base.switch_to_frame(base.find_frame("选择会员")) base.chose_vip(vip_name) base.change_frame("预设会员价明细框架") base.wait_element(base.find_xpath("本页共0条数据")) print(f"新建会员:{vip_name}确定在预设会员价页面没有任何记录") # 新建商品 product_code = base.get_now_string() print(f"新建商品货号:{product_code}") # 新建商品 interface.new_product(product_code) # 获取一个sku_code查看会员价格 sku_code = interface.get_sku_code(product_code)[0] print(f"取出一个商品:{sku_code}查看售价,此时售价应该为0") with base.operate_page("订单", "门店收银", "门店收银框架") as e: base.change_frame("门店收银框架", "选择会员") base.chose_vip(vip_name) base.change_frame("门店收银框架") base.wait_element_focus(base.find_xpath_by_placeholder("请扫描商品条码")) base.wait_element( base.find_xpath_by_placeholder("商品货号")).send_keys(product_code) base.wait_element(base.find_xpath("搜索")).click() time.sleep(1) base.wait_element(base.find_xpath(product_code)).click() base.change_frame("门店收银框架") base.switch_to_frame(base.find_frame("商品选择")) price = base.wait_element( base.get_old_cell_input_xpath("红色 XS", "交易价格")).get_attribute("value") assert price == '0' print(f"确定{sku_code}的售价是0") # 设置商品的标准售价,第二价格,第三价格,第四价格 interface.modify_sku_price(sku_code, "100", "200", "300", "400") print(f"设置{sku_code}的价格分别为100,200,300,400,此时商品的价格应该是100") # 再次到门店开单页面查看售价是否是标准售价=100 with base.operate_page("订单", "门店收银", "门店收银框架") as e: base.change_frame("门店收银框架", "选择会员") base.chose_vip(vip_name) base.change_frame("门店收银框架") base.wait_element_focus(base.find_xpath_by_placeholder("请扫描商品条码")) base.wait_element( base.find_xpath_by_placeholder("商品货号")).send_keys(product_code) base.wait_element(base.find_xpath("搜索")).click() time.sleep(1) base.wait_element(base.find_xpath(product_code)).click() base.change_frame("门店收银框架") base.switch_to_frame(base.find_frame("商品选择")) price = base.wait_element( base.get_old_cell_input_xpath("红色 XS", "交易价格")).get_attribute("value") assert price == '100' print(f"确定{sku_code}的售价是100") # 设置会员等级为8折,再次查看售价是否是80 print(f"将会员{vip_name}的会员等级设置为8折,此时售价应该是100*0.8") vip_level = "8折" interface.modify_vip_level(vip_name, vip_level) with base.operate_page("订单", "门店收银", "门店收银框架") as e: base.change_frame("门店收银框架", "选择会员") base.chose_vip(vip_name) base.change_frame("门店收银框架") base.wait_element_focus(base.find_xpath_by_placeholder("请扫描商品条码")) base.wait_element( base.find_xpath_by_placeholder("商品货号")).send_keys(product_code) base.wait_element(base.find_xpath("搜索")).click() time.sleep(1) base.wait_element(base.find_xpath(product_code)).click() base.change_frame("门店收银框架") base.switch_to_frame(base.find_frame("商品选择")) price = base.wait_element( base.get_old_cell_input_xpath("红色 XS", "交易价格")).get_attribute("value") assert price == '80' print(f"确定会员:{vip_name}商品{sku_code}的售价是80") # 门店开单,不修改商品价格,还是没有记录 # sku_info_list 商品信息列表 sku_info_list = [] sku_info = {} product_info = interface.get_sku_info('', product_code) i = 1 for sku in product_info["data"]["Items"]: sku_info["SkuCode"] = sku["SkuCode"] i += 1 sku_info["Qty"] = i sku_info["Price"] = int(sku["StandardPrice"]) * int( interface.get_vip_level_info(vip_level)["data"]["Items"][0] ["Discount"]) / 10 sku_info_list.append(dict(sku_info)) print("不改变任何sku价格是商品明细列表信息:") for i in sku_info_list: print(i) print("不修改sku价格,预设会员价明细页面不应该有任何记录") # 商品数据确定之后直接开单 interface.new_pos_oder(vip_name, sku_info_list) # 再次核对预设会员价明细页面还是0 base.open_page("会员", "预设会员价明细", "预设会员价明细框架") base.wait_element(base.find_xpath_by_placeholder("会员")).click() base.change_frame("预设会员价明细框架") base.switch_to_frame(base.find_frame("选择会员")) base.chose_vip(vip_name) base.change_frame("预设会员价明细框架") time.sleep(1) base.wait_element(base.find_xpath("本页共0条数据")) print("确定不修改售价不会有任何记录") # 再次开单,修改其中一个规则的价格,必须有一条记录 # 修改商品信息 modify_info = {} for i in range(0, 1): modify_sku_code = sku_info_list[i]["SkuCode"] modify_price = sku_info_list[i]["Price"] + 10 sku_info_list[i]["Price"] = copy.copy(modify_price) modify_info[modify_sku_code] = modify_price for k, v in modify_info.items(): print(f"修改{k}的价格为{v}") for i in sku_info_list: print(i) print("修改一个商品的售价之后,预设会员价明细页面应该有一条记录") # 商品数据确定之后直接开单 interface.new_pos_oder(vip_name, sku_info_list) # 再次核对预设会员价明细页面有一条记录 base.open_page("会员", "预设会员价明细", "预设会员价明细框架") base.wait_element(base.find_xpath_by_placeholder("会员")).click() base.change_frame("预设会员价明细框架") base.switch_to_frame(base.find_frame("选择会员")) base.chose_vip(vip_name) base.change_frame("预设会员价明细框架") time.sleep(2) base.wait_element(base.find_xpath("本页共1条数据")) result = base.get_column_text("商家编码") assert len(result) == 1 for r in result: assert r in modify_info.keys() vip_price = base.wait_element(base.get_cell_xpath(r, "预设价格")).text assert float(modify_info[r]) == float(vip_price) print("修改一个商品的售价之后,预设会员价页面记录的只有一条记录,并且sku_code,预设价格核对无误") # 修改两个规格的价格,预设会员价明细页面会有两条明细 # 还是先修改商品价格 modify_info.clear() j = 10 for i in range(0, 2): modify_sku_code = sku_info_list[i]["SkuCode"] j += 7 modify_price = sku_info_list[i]["Price"] + j sku_info_list[i]["Price"] = modify_price modify_info[modify_sku_code] = modify_price for k, v in modify_info.items(): print(f"修改{k}的价格为{v}") print("修改两个sku价格之后的商品信息列表是:") for i in sku_info_list: print(i) print("修改两个商品价格之后开单,会员预设价页面应该有两条数据") # 商品数据确定之后直接开单 interface.new_pos_oder(vip_name, sku_info_list) # 再次核对预设会员价明细页面有两条记录 base.open_page("会员", "预设会员价明细", "预设会员价明细框架") base.wait_element(base.find_xpath_by_placeholder("会员")).click() base.change_frame("预设会员价明细框架") base.switch_to_frame(base.find_frame("选择会员")) base.chose_vip(vip_name) base.change_frame("预设会员价明细框架") time.sleep(1) base.wait_element(base.find_xpath("本页共2条数据")) result = base.get_column_text("商家编码") assert len(result) == 2 for r in result: assert r in modify_info.keys() vip_price = base.wait_element(base.get_cell_xpath(r, "预设价格")).text assert float(modify_info[r]) == float(vip_price) print("修改两个商品之后开单,会员预设价页面只有两条记录,商家编码,预设价格经核实无误") # 全部更改则需要显示全部该商品的全部记录 modify_info.clear() for i in sku_info_list: modify_sku_code = i["SkuCode"] j += 5 modify_price = i["Price"] + j i["Price"] = modify_price modify_info[modify_sku_code] = modify_price for k, v in modify_info.items(): print(f"修改{k}的价格为:{v}") print("修改全部商品价格之后的商品信息列表是:") for i in sku_info_list: print(i) print("修改全部商品的价格之后,预设会员价页面应该有该款所有商品的记录") # 商品数据确定之后直接开单 interface.new_pos_oder(vip_name, sku_info_list) # 再次核对预设会员价明细页面有两条记录 base.open_page("会员", "预设会员价明细", "预设会员价明细框架") base.wait_element(base.find_xpath_by_placeholder("会员")).click() base.change_frame("预设会员价明细框架") base.switch_to_frame(base.find_frame("选择会员")) base.chose_vip(vip_name) base.change_frame("预设会员价明细框架") time.sleep(1) base.wait_element(base.find_xpath(f"本页共{len(sku_info_list)}条数据")) result = base.get_column_text("商家编码") assert len(result) == len(sku_info_list) for r in result: assert r in modify_info.keys() vip_price = base.wait_element(base.get_cell_xpath(r, "预设价格")).text assert float(modify_info[r]) == float(vip_price) print("预设会员价页面有该款商品的全部记录,并且商家编码预设价格核对无误") print("在选择会员的情况下,核实下标准售价,第二价格,第三价格,第四价格,会员价格取值是否正确") result = base.get_column_text("标准售价") for r in result: print(f"标准售价应该是100实际是:{r},") assert r == '100' result = base.get_column_text("第二价格") for r in result: print(f"第二价格应该是200实际是:{r},") assert r == '200' result = base.get_column_text("第三价格") for r in result: print(f"第三价格应该是300实际是:{r},") assert r == '300' result = base.get_column_text("第四价格") for r in result: print(f"第四价格应该是400实际是:{r},") assert r == '400' result = base.get_column_text("会员价") for r in result: print(f"会员价应该是80实际是:{r},") assert r == '80' print("确定在选择会员的情况下,核实下标准售价,第二价格,第三价格,第四价格,会员价格取值是否正确") print("清空搜索条件之后,搜索货号,查看所有价格的取值是否正确") base.wait_table_refresh(base.find_xpath("清空"), 1, "货号") base.wait_element_click( base.find_xpath_by_placeholder("商品货号")).send_keys(product_code) base.wait_table_refresh(base.find_xpath("组合查询"), 1, "货号") result = base.get_column_text("标准售价") for r in result: print(f"标准售价应该是100实际是:{r},") assert r == '100' result = base.get_column_text("第二价格") for r in result: print(f"第二价格应该是200实际是:{r},") assert r == '200' result = base.get_column_text("第三价格") for r in result: print(f"第三价格应该是300实际是:{r},") assert r == '300' result = base.get_column_text("第四价格") for r in result: print(f"第四价格应该是400实际是:{r},") assert r == '400' result = base.get_column_text("会员价") for r in result: print(f"会员价应该是80实际是:{r},") assert r == '80' print("确定清空搜索条件之后,搜索货号,查看所有价格的取值是否正确") # 修改设置,再来一遍 print("修改设置为同款同价再跑一遍") print("修改设置为同款同价再跑一遍") print("修改设置为同款同价再跑一遍") setting_info = { "记录会员上次交易价:手工单或者门店单保存时,记录会员的商品交易价格": "true", "记录会员上次交易价 同款同价:手工单或者门店单保存时,记录会员的商品交易价格 同款同价": "true", "只有手工修改售价才会记录预设价格": "true", } interface.save_order_setting(setting_info) print("同款同价模式且只有修改时记录会员价格设置完成,") print("修改设置之后等待5秒等设置生效") time.sleep(5) base.close_page("预设会员价明细") base.open_page("会员", "预设会员价明细", "预设会员价明细框架") # 新建会员 vip_name = base.get_now_string() print(f"新建会员会员名称:{vip_name}") interface.new_vip(vip_name) # 查询确认新会员没有任何记录 base.wait_element(base.find_xpath_by_placeholder("会员")).click() base.change_frame("预设会员价明细框架") base.switch_to_frame(base.find_frame("选择会员")) base.chose_vip(vip_name) base.change_frame("预设会员价明细框架") base.wait_element(base.find_xpath("本页共0条数据")) # 新建商品 product_code = base.get_now_string() print(f"新建商品货号:{product_code}") # 解析出第一个skuCode print("验证没有设置价格时,售价为0") sku_code = interface.new_product( product_code)["data"]["ProductSkus"][0]["Code"] with base.operate_page("订单", "门店收银", "门店收银框架") as e: base.change_frame("门店收银框架", "选择会员") base.chose_vip(vip_name) base.change_frame("门店收银框架") base.wait_element_focus(base.find_xpath_by_placeholder("请扫描商品条码")) base.wait_element( base.find_xpath_by_placeholder("商品货号")).send_keys(product_code) base.wait_element(base.find_xpath("搜索")).click() time.sleep(1) base.wait_element(base.find_xpath(product_code)).click() base.change_frame("门店收银框架") base.switch_to_frame(base.find_frame("商品选择")) price = base.wait_element( base.get_old_cell_input_xpath("红色 XS", "交易价格")).get_attribute("value") assert price == '0' or price is None print("确定没有设置价格时,售价为0") # 设置商品的标准售价,第二价格,第三价格,第四价格 interface.modify_sku_price(sku_code, "100", "200", "300", "400") # 再次到门店开单页面查看售价是否是标准售价=100 print("验证标准售价设置为100,之后售价应该为100") with base.operate_page("订单", "门店收银", "门店收银框架") as e: base.change_frame("门店收银框架", "选择会员") base.chose_vip(vip_name) base.change_frame("门店收银框架") base.wait_element_focus(base.find_xpath_by_placeholder("请扫描商品条码")) base.wait_element( base.find_xpath_by_placeholder("商品货号")).send_keys(product_code) base.wait_element(base.find_xpath("搜索")).click() time.sleep(1) base.wait_element(base.find_xpath(product_code)).click() base.change_frame("门店收银框架") base.switch_to_frame(base.find_frame("商品选择")) price = base.wait_element( base.get_old_cell_input_xpath("红色 XS", "交易价格")).get_attribute("value") assert price == '100' print("确定标准售价设置为100,之后售价应该为100") print("验证会员等级设置为8折之后,售价应该是80") # 设置会员等级为8折,再次查看售价是否是80 vip_level = "8折" interface.modify_vip_level(vip_name, vip_level) with base.operate_page("订单", "门店收银", "门店收银框架") as e: base.change_frame("门店收银框架", "选择会员") base.chose_vip(vip_name) base.change_frame("门店收银框架") base.wait_element_focus(base.find_xpath_by_placeholder("请扫描商品条码")) base.wait_element( base.find_xpath_by_placeholder("商品货号")).send_keys(product_code) base.wait_element(base.find_xpath("搜索")).click() time.sleep(1) base.wait_element(base.find_xpath(product_code)).click() base.change_frame("门店收银框架") base.switch_to_frame(base.find_frame("商品选择")) price = base.wait_element( base.get_old_cell_input_xpath("红色 XS", "交易价格")).get_attribute("value") assert price == '80' print("确定会员等级设置为8折之后,售价应该是80") # 门店开单,不修改商品价格,还是没有记录 # sku_info_list 商品信息列表 sku_info_list = [] sku_info = {} product_info = interface.get_sku_info('', product_code) i = 1 for sku in product_info["data"]["Items"]: sku_info["SkuCode"] = sku["SkuCode"] i += 1 sku_info["Qty"] = i sku_info["Price"] = int(sku["StandardPrice"]) * int( interface.get_vip_level_info(vip_level)["data"]["Items"][0] ["Discount"]) / 10 sku_info_list.append(dict(sku_info)) print("不改变任何sku价格是商品明细列表信息:") for i in sku_info_list: print(i) print("验证不改变商品售价时,预设会员价页面没有记录") # 商品数据确定之后直接开单 interface.new_pos_oder(vip_name, sku_info_list) # 再次核对预设会员价明细页面还是0 base.open_page("会员", "预设会员价明细", "预设会员价明细框架") base.wait_element(base.find_xpath_by_placeholder("会员")).click() base.change_frame("预设会员价明细框架") base.switch_to_frame(base.find_frame("选择会员")) base.chose_vip(vip_name) base.change_frame("预设会员价明细框架") time.sleep(1) base.wait_element(base.find_xpath("本页共0条数据")) # 再次开单,修改其中一个规则的价格,必须有一条记录 print("确定不改变商品售价时,预设会员价页面没有记录") print("验证修改一个商品售价之后,预设会员价页面有该款记录") # 修改商品信息 modify_info = {} for i in range(0, 1): modify_sku_code = sku_info_list[i]["SkuCode"] modify_price = sku_info_list[i]["Price"] + 10 sku_info_list[i]["Price"] = copy.copy(modify_price) modify_info[modify_sku_code] = modify_price for k, v in modify_info.items(): print(f"修改{k}的价格为{v}") for i in sku_info_list: print(i) # 商品数据确定之后直接开单 interface.new_pos_oder(vip_name, sku_info_list) # 再次核对预设会员价明细页面有一条记录 base.open_page("会员", "预设会员价明细", "预设会员价明细框架") base.wait_element(base.find_xpath_by_placeholder("会员")).click() base.change_frame("预设会员价明细框架") base.switch_to_frame(base.find_frame("选择会员")) base.chose_vip(vip_name) base.change_frame("预设会员价明细框架") time.sleep(2) base.wait_element(base.find_xpath("本页共1条数据")) result = base.get_column_text("货号") assert len(result) == 1 for r in result: assert r == product_code vip_price = base.wait_element(base.get_cell_xpath(r, "预设价格")).text assert float(vip_price) in modify_info.values() print("确定修改一个商品售价之后,预设会员价页面有该款记录") print("修改整款商品价格之后,预设会员价页面也只有一个价格") # 修改所有商品价格 modify_info.clear() for i in sku_info_list: modify_sku_code = i["SkuCode"] j += 5 modify_price = 195 i["Price"] = modify_price modify_info[modify_sku_code] = modify_price for k, v in modify_info.items(): print(f"修改{k}的价格为:{v}") print("修改全部商品价格之后的商品信息列表是:") for i in sku_info_list: print(i) # 商品数据确定之后直接开单 interface.new_pos_oder(vip_name, sku_info_list) base.open_page("会员", "预设会员价明细", "预设会员价明细框架") base.wait_element(base.find_xpath_by_placeholder("会员")).click() base.change_frame("预设会员价明细框架") base.switch_to_frame(base.find_frame("选择会员")) base.chose_vip(vip_name) base.change_frame("预设会员价明细框架") time.sleep(1) base.wait_element(base.find_xpath("本页共1条数据")) result = base.get_column_text("货号") assert len(result) == 1 for r in result: assert r == product_code vip_price = base.wait_element(base.get_cell_xpath(r, "预设价格")).text assert float(vip_price) in modify_info.values() print("修改整款商品价格之后,预设会员价页面也只有一个价格") print("预设会员价页面有该款商品的全部记录,并且商家编码预设价格核对无误") print("在选择会员的情况下,核实下标准售价,第二价格,第三价格,第四价格,会员价格取值是否正确") result = base.get_column_text("标准售价") for r in result: print(f"标准售价应该是100实际是:{r},") assert r == '100' result = base.get_column_text("第二价格") for r in result: print(f"第二价格应该是200实际是:{r},") assert r == '200' result = base.get_column_text("第三价格") for r in result: print(f"第三价格应该是300实际是:{r},") assert r == '300' result = base.get_column_text("第四价格") for r in result: print(f"第四价格应该是400实际是:{r},") assert r == '400' result = base.get_column_text("会员价") for r in result: print(f"会员价应该是80实际是:{r},") assert r == '80' print("确定在选择会员的情况下,核实下标准售价,第二价格,第三价格,第四价格,会员价格取值是否正确") print("清空搜索条件之后,搜索货号,查看所有价格的取值是否正确") base.wait_table_refresh(base.find_xpath("清空"), 1, "货号") base.wait_element_click( base.find_xpath_by_placeholder("商品货号")).send_keys(product_code) base.wait_table_refresh(base.find_xpath("组合查询"), 1, "货号") result = base.get_column_text("标准售价") for r in result: print(f"标准售价应该是100实际是:{r},") assert r == '100' result = base.get_column_text("第二价格") for r in result: print(f"第二价格应该是200实际是:{r},") assert r == '200' result = base.get_column_text("第三价格") for r in result: print(f"第三价格应该是300实际是:{r},") assert r == '300' result = base.get_column_text("第四价格") for r in result: print(f"第四价格应该是400实际是:{r},") assert r == '400' result = base.get_column_text("会员价") for r in result: print(f"会员价应该是80实际是:{r},") assert r == '80' print("确定清空搜索条件之后,搜索货号,查看所有价格的取值是否正确")
def test_not_merge_approved_order(): setting_info = {"开启": "true", "不合并已配货订单": "false"} setting_interface.save_auto_merge_setting(setting_info) time.sleep(5) print(f"修改设置之后等待5秒") vip_name = "会员" + base.get_now_string() vip_interface.new_vip(vip_name) print(f"{vip_name}") product_code = base.get_now_string() product_interface.new_product(product_code) sku_code = product_interface.get_sku_code(product_code)[0] product_interface.modify_sku_price(sku_code, "100") sku_info = [ { '商家编码': sku_code, '数量': '2' }, ] order_code = order_interface.new_order(vip_name, sku_info, "主仓库", "邮政小包电子面单")["Code"] base.fuzzy_search("订单编码", vip_name) base.wait_element_click(base.get_cell_xpath(1, "订单编码")) base.click_space() element = base.wait_element(base.get_cell_xpath(1, "订单状态")) text = element.text base.wait_element_click(base.find_xpath("审核")) base.wait_element_refresh(element, text) merge_order_code = order_interface.new_order(vip_name, sku_info, "主仓库", "邮政小包电子面单")["Code"] base.fuzzy_search("订单编码", vip_name) base.wait_element_click(base.get_cell_xpath(1, "订单编码")) base.click_space() base.wait_element_click(base.find_xpath("审核")) base.wait_element(base.find_xpath("信息", "审核失败:存在已配货的待合并订单!")) time.sleep(1) base.wait_element_click(base.find_xpath("信息", "已配货的发货单")) base.wait_element_click(base.get_cell_xpath(order_code, "订单编号")) base.click_space() base.wait_element(base.find_xpath("已配货的发货单", "删除")) print(f"删除是将已审核的订单删回来,目前调用的是删除功能不是终止发货不会标记手工终止发货异常") time.sleep(1) base.wait_element_click(base.find_xpath("已配货的发货单", "删除")) base.wait_element(base.find_xpath("已配货的发货单", "取消")) time.sleep(1) base.wait_element_click(base.find_xpath("已配货的发货单", "取消")) base.fuzzy_search("订单编码", vip_name) base.wait_element_click(base.get_cell_xpath(1, "订单编码")) result = base.get_column_text("订单状态") for i in result: assert i == '待审核' base.select_all() element = base.wait_element(base.get_cell_xpath(1, "订单状态")) text = element.text base.wait_element_click(base.find_xpath("审核")) base.wait_element_refresh(element, text) with base.operate_page("订单", "打印发货", "打印发货框架") as e: base.fuzzy_search("发货单号", vip_name) base.scroll_to(6) merge_order_code_result = base.wait_element( base.get_cell_xpath(order_code, "订单编号")).text assert order_code in merge_order_code_result assert merge_order_code in merge_order_code_result print( f"----------------------------------再试下强制审核-----------------------------------------" ) base.open_page("订单", "全部订单", "全部订单框架") vip_name = "会员" + base.get_now_string() vip_interface.new_vip(vip_name) print(f"{vip_name}") product_code = base.get_now_string() product_interface.new_product(product_code) sku_code = product_interface.get_sku_code(product_code)[0] product_interface.modify_sku_price(sku_code, "100") sku_info = [ { '商家编码': sku_code, '数量': '2' }, ] order_code = order_interface.new_order(vip_name, sku_info, "主仓库", "邮政小包电子面单")["Code"] base.fuzzy_search("订单编码", vip_name) base.wait_element_click(base.get_cell_xpath(1, "订单编码")) base.click_space() element = base.wait_element(base.get_cell_xpath(1, "订单状态")) text = element.text base.wait_element_click(base.find_xpath("审核")) base.wait_element_refresh(element, text) merge_order_code = order_interface.new_order(vip_name, sku_info, "主仓库", "邮政小包电子面单")["Code"] base.fuzzy_search("订单编码", vip_name) base.wait_element_click(base.get_cell_xpath(1, "订单编码")) base.click_space() base.wait_element_click(base.find_xpath("审核")) base.wait_element(base.find_xpath("信息", "审核失败:存在已配货的待合并订单!")) time.sleep(1) base.wait_element_click(base.find_xpath("信息", "已配货的发货单")) base.wait_element_click(base.get_cell_xpath(order_code, "订单编号")) base.click_space() base.wait_element(base.find_xpath("已配货的发货单", "强制审核")) print(f"强制审核只是将待审核的订单审核过去,不合单") time.sleep(1) base.wait_element_click(base.find_xpath("已配货的发货单", "强制审核")) base.wait_element(base.find_xpath("已配货的发货单", "取消")) time.sleep(1) base.wait_element_click(base.find_xpath("已配货的发货单", "取消")) base.fuzzy_search("订单编码", vip_name) base.wait_element_click(base.get_cell_xpath(1, "订单编码")) result = base.get_column_text("订单状态") for i in result: assert i == '发货中' print(f"-------------------------开启不合并已配货订单之后不再有提示-------------------") setting_info = {"开启": "true", "不合并已配货订单": "true"} setting_interface.save_auto_merge_setting(setting_info) time.sleep(5) print(f"修改设置之后等待5秒") base.open_page("订单", "全部订单", "全部订单框架") vip_name = "会员" + base.get_now_string() vip_interface.new_vip(vip_name) print(f"{vip_name}") product_code = base.get_now_string() product_interface.new_product(product_code) sku_code = product_interface.get_sku_code(product_code)[0] product_interface.modify_sku_price(sku_code, "100") sku_info = [ { '商家编码': sku_code, '数量': '2' }, ] order_code = order_interface.new_order(vip_name, sku_info, "测试仓", "买家自提", "巨淘气", {"卖家备注": "111"})["Code"] base.fuzzy_search("订单编码", vip_name) base.wait_element_click(base.get_cell_xpath(1, "订单编码")) base.click_space() element = base.wait_element(base.get_cell_xpath(1, "订单状态")) text = element.text base.wait_element_click(base.find_xpath("审核")) base.wait_element_refresh(element, text) merge_order_code = order_interface.new_order(vip_name, sku_info, "测试仓", "买家自提", "巨淘气", {"卖家备注": "222"})["Code"] base.fuzzy_search("订单编码", vip_name) base.wait_element_click(base.get_cell_xpath(1, "订单编码")) base.click_space() element = base.wait_element(base.get_cell_xpath(1, "订单状态")) text = element.text base.wait_element_click(base.find_xpath("审核")) base.wait_element_refresh(element, text) base.fuzzy_search("订单编码", vip_name) order_status = base.get_column_text("订单状态") assert len(order_status) == 2 for i in order_status: assert "发货中" == i setting_info = {"开启": "true"} setting_interface.save_auto_merge_setting(setting_info) time.sleep(5) print(f"修改设置之后等待5秒")
def test_auto_merge_setting(): print(f"先修改设置,开启自动合单") setting_info = {"开启": "true"} setting_interface.save_auto_merge_setting(setting_info) time.sleep(5) print(f"修改设置之后等待5秒") vip_name = "会员" + base.get_now_string() vip_interface.new_vip(vip_name) print(f"{vip_name}") product_code = base.get_now_string() product_interface.new_product(product_code) sku_code = product_interface.get_sku_code(product_code)[0] product_interface.modify_sku_price(sku_code, "100") sku_info = [ { '商家编码': sku_code, '数量': '2' }, ] order_code = order_interface.new_order(vip_name, sku_info)["Code"] merge_order_code = order_interface.new_order(vip_name, sku_info)["Code"] base.fuzzy_search("订单编码", vip_name) base.wait_element_click(base.get_cell_xpath(1, "订单编码")) base.click_space() element = base.wait_element(base.get_cell_xpath(1, "订单状态")) text = element.text base.wait_element_click(base.find_xpath("审核")) base.wait_element_refresh(element, text) with base.operate_page("订单", "打印发货", "打印发货框架") as e: base.fuzzy_search("发货单号", vip_name) base.scroll_to(6) merge_order_code_result = base.wait_element( base.get_cell_xpath(order_code, "订单编号")).text assert order_code in merge_order_code_result assert merge_order_code in merge_order_code_result print(f"关闭设置之后不能合并") setting_info = {"开启": "false"} setting_interface.save_auto_merge_setting(setting_info) time.sleep(5) print(f"修改设置之后等待5秒") base.open_page("订单", "全部订单", "全部订单框架") vip_name = "会员" + base.get_now_string() vip_interface.new_vip(vip_name) print(f"{vip_name}") product_code = base.get_now_string() product_interface.new_product(product_code) sku_code = product_interface.get_sku_code(product_code)[0] product_interface.modify_sku_price(sku_code, "100") sku_info = [ { '商家编码': sku_code, '数量': '2' }, ] order_code = order_interface.new_order(vip_name, sku_info)["Code"] merge_order_code = order_interface.new_order(vip_name, sku_info)["Code"] base.fuzzy_search("订单编码", vip_name) base.wait_element_click(base.get_cell_xpath(1, "订单编码")) base.click_space() element = base.wait_element(base.get_cell_xpath(1, "订单状态")) text = element.text base.wait_element_click(base.find_xpath("审核")) base.wait_element_refresh(element, text) base.fuzzy_search("订单编码", vip_name) order_status = base.get_column_text("订单状态") assert len(order_status) == 2 assert "待审核" in order_status assert "发货中" in order_status print( f"""----------------------------------店铺相同-----------------------------------------------""" ) print(f"新建两个店铺不同的订单,开启设置之后不能合并") setting_info = {"开启": "true", "店铺相同": "false"} setting_interface.save_auto_merge_setting(setting_info) time.sleep(5) print(f"修改设置之后等待5秒") vip_name = "会员" + base.get_now_string() vip_interface.new_vip(vip_name) print(f"{vip_name}") product_code = base.get_now_string() product_interface.new_product(product_code) sku_code = product_interface.get_sku_code(product_code)[0] product_interface.modify_sku_price(sku_code, "100") sku_info = [ { '商家编码': sku_code, '数量': '2' }, ] order_code = order_interface.new_order(vip_name, sku_info)["Code"] merge_order_code = order_interface.new_order(vip_name, sku_info, "主仓库", "买家自提", "巨淘气")["Code"] base.fuzzy_search("订单编码", vip_name) base.wait_element_click(base.get_cell_xpath(1, "订单编码")) base.click_space() element = base.wait_element(base.get_cell_xpath(1, "订单状态")) text = element.text base.wait_element_click(base.find_xpath("审核")) base.wait_element_refresh(element, text) with base.operate_page("订单", "打印发货", "打印发货框架") as e: base.fuzzy_search("发货单号", vip_name) base.scroll_to(6) merge_order_code_result = base.wait_element( base.get_cell_xpath(order_code, "订单编号")).text assert order_code in merge_order_code_result assert merge_order_code in merge_order_code_result print(f"勾选店铺相同之后不能合并") setting_info = {"开启": "true", "店铺相同": "true"} setting_interface.save_auto_merge_setting(setting_info) time.sleep(5) print(f"修改设置之后等待5秒") base.open_page("订单", "全部订单", "全部订单框架") vip_name = "会员" + base.get_now_string() vip_interface.new_vip(vip_name) print(f"{vip_name}") product_code = base.get_now_string() product_interface.new_product(product_code) sku_code = product_interface.get_sku_code(product_code)[0] product_interface.modify_sku_price(sku_code, "100") sku_info = [ { '商家编码': sku_code, '数量': '2' }, ] order_code = order_interface.new_order(vip_name, sku_info)["Code"] merge_order_code = order_interface.new_order(vip_name, sku_info, "主仓库", "买家自提", "巨淘气")["Code"] base.fuzzy_search("订单编码", vip_name) base.wait_element_click(base.get_cell_xpath(1, "订单编码")) base.click_space() element = base.wait_element(base.get_cell_xpath(1, "订单状态")) text = element.text base.wait_element_click(base.find_xpath("审核")) base.wait_element_refresh(element, text) base.fuzzy_search("订单编码", vip_name) order_status = base.get_column_text("订单状态") assert len(order_status) == 2 assert "待审核" in order_status assert "发货中" in order_status print( f"----------------------------------------会员相同-------------------------------------------------------" ) print(f"新建两个会员不同的订单,不开启设置能合并") setting_info = {"开启": "true", "会员相同": "false"} setting_interface.save_auto_merge_setting(setting_info) time.sleep(5) print(f"修改设置之后等待5秒") rand_str = base.get_now_string() other_info = {"收货人": rand_str, "手机": rand_str, "地址": rand_str} vip_name = "会员" + base.get_now_string() vip_interface.new_vip(vip_name, other_info) print(f"{vip_name}") product_code = base.get_now_string() product_interface.new_product(product_code) sku_code = product_interface.get_sku_code(product_code)[0] product_interface.modify_sku_price(sku_code, "100") sku_info = [ { '商家编码': sku_code, '数量': '2' }, ] order_code = order_interface.new_order(vip_name, sku_info)["Code"] vip_name = "会员" + base.get_now_string() vip_interface.new_vip(vip_name, other_info) print(f"{vip_name}") merge_order_code = order_interface.new_order(vip_name, sku_info)["Code"] base.fuzzy_search("订单编码", vip_name) base.wait_element_click(base.get_cell_xpath(1, "订单编码")) base.click_space() element = base.wait_element(base.get_cell_xpath(1, "订单状态")) text = element.text base.wait_element_click(base.find_xpath("审核")) base.wait_element_refresh(element, text) with base.operate_page("订单", "打印发货", "打印发货框架") as e: base.wait_element(base.find_xpath("组合查询")) time.sleep(1) base.fuzzy_search("发货单号", order_code) base.scroll_to(6) merge_order_code_result = base.wait_element( base.get_cell_xpath(order_code, "订单编号")).text assert order_code in merge_order_code_result assert merge_order_code in merge_order_code_result print(f"勾选会员相同之后不能合并") setting_info = {"开启": "true", "会员相同": "true"} setting_interface.save_auto_merge_setting(setting_info) time.sleep(5) print(f"修改设置之后等待5秒") base.open_page("订单", "全部订单", "全部订单框架") rand_str = base.get_now_string() other_info = {"收货人": rand_str, "手机": rand_str, "地址": rand_str} vip_name = "会员" + base.get_now_string() vip_interface.new_vip(vip_name, other_info) print(f"{vip_name}") order_code = order_interface.new_order(vip_name, sku_info)["Code"] vip_name = "会员" + base.get_now_string() vip_interface.new_vip(vip_name, other_info) print(f"{vip_name}") merge_order_code = order_interface.new_order(vip_name, sku_info)["Code"] base.fuzzy_search("订单编码", vip_name) base.wait_element_click(base.get_cell_xpath(1, "订单编码")) base.click_space() element = base.wait_element(base.get_cell_xpath(1, "订单状态")) text = element.text base.wait_element_click(base.find_xpath("审核")) base.wait_element_refresh(element, text) base.fuzzy_search("订单编码", rand_str) order_status = base.get_column_text("订单状态") assert len(order_status) == 2 assert "待审核" in order_status assert "发货中" in order_status print( f"""----------------------------------快递相同-----------------------------------------------""" ) print(f"新建两个快递不同的订单,开启设置之后不能合并") setting_info = {"开启": "true", "快递相同": "false"} setting_interface.save_auto_merge_setting(setting_info) time.sleep(5) print(f"修改设置之后等待5秒") vip_name = "会员" + base.get_now_string() vip_interface.new_vip(vip_name) print(f"{vip_name}") product_code = base.get_now_string() product_interface.new_product(product_code) sku_code = product_interface.get_sku_code(product_code)[0] product_interface.modify_sku_price(sku_code, "100") sku_info = [ { '商家编码': sku_code, '数量': '2' }, ] order_code = order_interface.new_order(vip_name, sku_info)["Code"] merge_order_code = order_interface.new_order(vip_name, sku_info, "主仓库", "邮政小包电子面单")["Code"] base.fuzzy_search("订单编码", vip_name) base.wait_element_click(base.get_cell_xpath(1, "订单编码")) base.click_space() element = base.wait_element(base.get_cell_xpath(1, "订单状态")) text = element.text base.wait_element_click(base.find_xpath("审核")) base.wait_element_refresh(element, text) with base.operate_page("订单", "打印发货", "打印发货框架") as e: base.fuzzy_search("发货单号", vip_name) base.scroll_to(5) merge_order_code_result = base.wait_element( base.get_cell_xpath(order_code, "订单编号")).text assert order_code in merge_order_code_result assert merge_order_code in merge_order_code_result print(f"勾选店铺相同之后不能合并") setting_info = {"开启": "true", "快递相同": "true"} setting_interface.save_auto_merge_setting(setting_info) time.sleep(5) print(f"修改设置之后等待5秒") base.open_page("订单", "全部订单", "全部订单框架") vip_name = "会员" + base.get_now_string() vip_interface.new_vip(vip_name) print(f"{vip_name}") product_code = base.get_now_string() product_interface.new_product(product_code) sku_code = product_interface.get_sku_code(product_code)[0] product_interface.modify_sku_price(sku_code, "100") sku_info = [ { '商家编码': sku_code, '数量': '2' }, ] order_code = order_interface.new_order(vip_name, sku_info)["Code"] merge_order_code = order_interface.new_order(vip_name, sku_info, "主仓库", "邮政小包电子面单")["Code"] base.fuzzy_search("订单编码", vip_name) base.wait_element_click(base.get_cell_xpath(1, "订单编码")) base.click_space() element = base.wait_element(base.get_cell_xpath(1, "订单状态")) text = element.text base.wait_element_click(base.find_xpath("审核")) base.wait_element_refresh(element, text) base.fuzzy_search("订单编码", vip_name) order_status = base.get_column_text("订单状态") assert len(order_status) == 2 assert "待审核" in order_status assert "发货中" in order_status print( f"""----------------------------------仓库相同-----------------------------------------------""" ) print(f"新建两个店铺不同的订单,开启设置之后不能合并") setting_info = {"开启": "true", "仓库相同": "false"} setting_interface.save_auto_merge_setting(setting_info) time.sleep(5) print(f"修改设置之后等待5秒") vip_name = "会员" + base.get_now_string() vip_interface.new_vip(vip_name) print(f"{vip_name}") product_code = base.get_now_string() product_interface.new_product(product_code) sku_code = product_interface.get_sku_code(product_code)[0] product_interface.modify_sku_price(sku_code, "100") sku_info = [ { '商家编码': sku_code, '数量': '2' }, ] order_code = order_interface.new_order(vip_name, sku_info)["Code"] merge_order_code = order_interface.new_order(vip_name, sku_info, "测试仓")["Code"] base.fuzzy_search("订单编码", vip_name) base.wait_element_click(base.get_cell_xpath(1, "订单编码")) base.click_space() element = base.wait_element(base.get_cell_xpath(1, "订单状态")) text = element.text base.wait_element_click(base.find_xpath("审核")) base.wait_element_refresh(element, text) with base.operate_page("订单", "打印发货", "打印发货框架") as e: base.fuzzy_search("发货单号", vip_name) base.scroll_to(6) merge_order_code_result = base.wait_element( base.get_cell_xpath(order_code, "订单编号")).text assert order_code in merge_order_code_result assert merge_order_code in merge_order_code_result print(f"勾选店铺相同之后不能合并") setting_info = {"开启": "true", "仓库相同": "true"} setting_interface.save_auto_merge_setting(setting_info) time.sleep(5) print(f"修改设置之后等待5秒") base.open_page("订单", "全部订单", "全部订单框架") vip_name = "会员" + base.get_now_string() vip_interface.new_vip(vip_name) print(f"{vip_name}") product_code = base.get_now_string() product_interface.new_product(product_code) sku_code = product_interface.get_sku_code(product_code)[0] product_interface.modify_sku_price(sku_code, "100") sku_info = [ { '商家编码': sku_code, '数量': '2' }, ] order_code = order_interface.new_order(vip_name, sku_info)["Code"] merge_order_code = order_interface.new_order(vip_name, sku_info, "测试仓")["Code"] base.fuzzy_search("订单编码", vip_name) base.wait_element_click(base.get_cell_xpath(1, "订单编码")) base.click_space() element = base.wait_element(base.get_cell_xpath(1, "订单状态")) text = element.text base.wait_element_click(base.find_xpath("审核")) base.wait_element_refresh(element, text) base.fuzzy_search("订单编码", vip_name) order_status = base.get_column_text("订单状态") assert len(order_status) == 2 assert "待审核" in order_status assert "发货中" in order_status print( f"""----------------------------------有退款的搞不了-----------------------------------------------""" ) print( f"""----------------------------------不合并已配货订单-----------------------------------------------""" ) print(f"新建两个店铺不同的订单,开启设置之后不能合并") setting_info = {"开启": "true", "不合并已配货订单": "false"} setting_interface.save_auto_merge_setting(setting_info) time.sleep(5) print(f"修改设置之后等待5秒") vip_name = "会员" + base.get_now_string() vip_interface.new_vip(vip_name) print(f"{vip_name}") product_code = base.get_now_string() product_interface.new_product(product_code) sku_code = product_interface.get_sku_code(product_code)[0] product_interface.modify_sku_price(sku_code, "100") sku_info = [ { '商家编码': sku_code, '数量': '2' }, ] order_code = order_interface.new_order(vip_name, sku_info)["Code"] base.fuzzy_search("订单编码", vip_name) base.wait_element_click(base.get_cell_xpath(1, "订单编码")) base.click_space() element = base.wait_element(base.get_cell_xpath(1, "订单状态")) text = element.text base.wait_element_click(base.find_xpath("审核")) base.wait_element_refresh(element, text) merge_order_code = order_interface.new_order(vip_name, sku_info)["Code"] base.fuzzy_search("订单编码", vip_name) base.wait_element_click(base.get_cell_xpath(1, "订单编码")) base.click_space() base.wait_element_click(base.find_xpath("审核")) base.wait_element(base.find_xpath("信息", "审核失败:存在已配货的待合并订单!")) time.sleep(1) base.wait_element_click(base.find_xpath("信息", "确定")) print(f"勾选之后不再提示") setting_info = {"开启": "true", "不合并已配货订单": "true"} setting_interface.save_auto_merge_setting(setting_info) time.sleep(5) print(f"修改设置之后等待5秒") base.open_page("订单", "全部订单", "全部订单框架") vip_name = "会员" + base.get_now_string() vip_interface.new_vip(vip_name) print(f"{vip_name}") product_code = base.get_now_string() product_interface.new_product(product_code) sku_code = product_interface.get_sku_code(product_code)[0] product_interface.modify_sku_price(sku_code, "100") sku_info = [ { '商家编码': sku_code, '数量': '2' }, ] order_code = order_interface.new_order(vip_name, sku_info, "测试仓", "买家自提", "巨淘气", {"卖家备注": "111"})["Code"] base.fuzzy_search("订单编码", vip_name) base.wait_element_click(base.get_cell_xpath(1, "订单编码")) base.click_space() element = base.wait_element(base.get_cell_xpath(1, "订单状态")) text = element.text base.wait_element_click(base.find_xpath("审核")) base.wait_element_refresh(element, text) merge_order_code = order_interface.new_order(vip_name, sku_info, "测试仓", "买家自提", "巨淘气", {"卖家备注": "222"})["Code"] base.fuzzy_search("订单编码", vip_name) base.wait_element_click(base.get_cell_xpath(1, "订单编码")) base.click_space() element = base.wait_element(base.get_cell_xpath(1, "订单状态")) text = element.text base.wait_element_click(base.find_xpath("审核")) base.wait_element_refresh(element, text) base.fuzzy_search("订单编码", vip_name) order_status = base.get_column_text("订单状态") assert len(order_status) == 2 for i in order_status: assert "发货中" == i print( f"""----------------------------------合并买家/卖家备注不加平台单号------------------------------------------""" ) print(f"平台单号弄不出来,就看下卖家备注能否合并") setting_info = {"开启": "true", "合并买家/卖家备注不加平台单号": "false"} setting_interface.save_auto_merge_setting(setting_info) time.sleep(5) print(f"修改设置之后等待5秒") vip_name = "会员" + base.get_now_string() vip_interface.new_vip(vip_name) print(f"{vip_name}") product_code = base.get_now_string() product_interface.new_product(product_code) sku_code = product_interface.get_sku_code(product_code)[0] product_interface.modify_sku_price(sku_code, "100") sku_info = [ { '商家编码': sku_code, '数量': '2' }, ] order_code = order_interface.new_order(vip_name, sku_info, "测试仓", "买家自提", "巨淘气", {"卖家备注": "111"})["Code"] merge_order_code = order_interface.new_order(vip_name, sku_info, "测试仓", "买家自提", "巨淘气", {"卖家备注": "222"})["Code"] base.fuzzy_search("订单编码", vip_name) base.wait_element_click(base.get_cell_xpath(1, "订单编码")) base.click_space() element = base.wait_element(base.get_cell_xpath(1, "订单状态")) text = element.text base.wait_element_click(base.find_xpath("审核")) base.wait_element_refresh(element, text) with base.operate_page("订单", "打印发货", "打印发货框架") as e: base.fuzzy_search("发货单号", vip_name) merge_order_code_result = base.wait_element( base.get_cell_xpath(vip_name, "卖家备注")).text assert "111" in merge_order_code_result assert "222" in merge_order_code_result print(f"关闭设置") setting_info = {"开启": "false"} setting_interface.save_auto_merge_setting(setting_info) time.sleep(5)