def test_modify_address():
    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 = [{'商家编码': enough_sku_code_list[0], '数量': '3'}]
    first_order_code = order_interface.new_order(vip_name, sku_info)["Code"]
    second_order_code = order_interface.new_order(vip_name, sku_info)["Code"]
    base.fuzzy_search("订单编码", vip_name)
    base.wait_element_click(base.get_cell_xpath(first_order_code, "订单编码"))
    base.click_space()
    modify_seller_memo_info = {"备注": "修改地址显示卖家备注"}
    order.modify_seller_memo(first_order_code, modify_seller_memo_info)
    modify_info = {"收货地址": "江苏省南京市鼓楼区鼓楼大道1185号", "收货人名": "芮苏云", "联系电话": "02133668823", "联系手机": "13772839830",
                   "邮政编码": "211458", "核对备注": "修改地址显示卖家备注"}
    order.modify_address(first_order_code, modify_info)
    result = base.wait_element(base.get_cell_xpath(first_order_code, "收货地址")).text
    assert "鼓楼大道1185号" in result
    result = base.wait_element(base.get_cell_xpath(first_order_code, "省")).text
    assert "江苏省" in result
    result = base.wait_element(base.get_cell_xpath(first_order_code, "市")).text
    assert "南京市" in result
    result = base.wait_element(base.get_cell_xpath(first_order_code, "区")).text
    assert "鼓楼区" in result
    result = base.wait_element(base.get_cell_xpath(first_order_code, "收货人")).text
    assert "芮苏云" in result
    result = base.wait_element(base.get_cell_xpath(first_order_code, "手机号")).text
    assert "13772839830" in result
    base.select_all()
    print(f"----------------------------------试下勾选多个订单修改地址-------------------------------------")
    modify_info = {"选择地址": f"芮苏云,13772839830,江苏省 南京市 鼓楼区 鼓楼大道1185号"}
    order.modify_address(vip_name, modify_info)
    result_list = base.get_column_text('收货地址')
    for i in result_list:
        assert "江苏省 南京市 鼓楼区 鼓楼大道1185号" in i
    result_list = base.get_column_text('省')
    for i in result_list:
        assert "江苏省" in i
    result_list = base.get_column_text('市')
    for i in result_list:
        assert "南京市" in i
    result_list = base.get_column_text('区')
    for i in result_list:
        assert "鼓楼区" in i
    result_list = base.get_column_text('收货人')
    for i in result_list:
        assert "芮苏云" in i
    result_list = base.get_column_text('手机号')
    for i in result_list:
        assert "13772839830" in i
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_manual_split_order():# TODO:(RUI) 有BUG:全部订单页面,手工拆弹功能,拆包配货页面需要切换新表格组件,图片有问题,没做处理,当前重量字段应该是剩余可拆分数*商品重量,但是目前失效
    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(base.find_xpath("拆单", "手工拆单"))
    time.sleep(1)
    base.wait_element_click(base.find_xpath("拆单", "手工拆单"))
    base.change_frame("全部订单框架", "拆包配货")
    base.wait_element(base.get_old_cell_input_xpath(1, "拆分数量")).send_keys(Keys.CONTROL+'a')
    base.wait_element(base.get_old_cell_input_xpath(1, "拆分数量")).send_keys("1")
    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("提示", "确定"))
    base.change_frame("全部订单框架")
    base.wait_element_refresh(element, text)
    result = base.wait_element(base.get_cell_xpath(order_code, "订单状态")).text
    assert result == "部分审核"
    base.wait_element_click(base.get_cell_xpath(order_code, "商品信息"))
    other_info = order.get_float_sku_info_text(sku_code, "其他信息")
    assert "已审1件" in other_info
def test_turn_to_exception():
    """
    新建一个单子,先转异常然后再转正常如此反复
    """
    vip_name = "会员"+base.get_now_string()
    vip_interface.new_vip(vip_name)
    print(f"{vip_name}")
    sku_info = [{'商家编码': '测试商品1-红色 XS', '数量': '2'}, ]
    order_code = order_interface.new_order(vip_name, sku_info)["Code"]
    base.fuzzy_search("订单编码", order_code)
    base.select_all()
    order.turn_to_exception("黑名单")
    base.wait_text_locate(base.get_cell_xpath(order_code, "订单状态"), "黑名单")
    order.turn_to_normal("黑名单")
    base.wait_text_locate(base.get_cell_xpath(order_code, "订单状态"), "待审核")
    order.turn_to_exception("终结")
    base.wait_text_locate(base.get_cell_xpath(order_code, "订单状态"), "已终结")
    order.turn_to_normal("已终结")
    base.wait_text_locate(base.get_cell_xpath(order_code, "订单状态"), "待审核")
    order.turn_to_exception("标记异常", "手工标记异常测试")
    base.wait_text_locate(base.get_cell_xpath(order_code, "订单状态"), "手工标记异常测试")
    order.turn_to_normal("标记异常")
    base.wait_text_locate(base.get_cell_xpath(order_code, "订单状态"), "待审核")
    order.turn_to_exception("常用异常", "常用异常2")
    base.wait_text_locate(base.get_cell_xpath(order_code, "订单状态"), "常用异常2")
    order.turn_to_normal("标记异常")
    base.wait_text_locate(base.get_cell_xpath(order_code, "订单状态"), "待审核")
def test_multi_mark_memo_processed():
    setting_info = {"开启": "true", "会员相同": "true"}
    setting_interface.save_auto_merge_setting(setting_info)
    time.sleep(5)
    print(f"开启合单设置之后等待五秒生效")
    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 = [{'商家编码': enough_sku_code_list[0], '数量': '3'}]
    first_order_code = order_interface.new_order(vip_name, sku_info, "主仓库", "买家自提", "巨淘气", {"卖家备注": "111"})["Code"]
    second_order_code = order_interface.new_order(vip_name, sku_info, "主仓库", "买家自提", "巨淘气", {"买家备注": "222"})["Code"]
    third_order_code = order_interface.new_order(vip_name, sku_info)["Code"]
    base.wait_element_click(base.find_xpath("订单状态", "待审核(有备注)"))
    time.sleep(5)
    base.fuzzy_search("订单编码", vip_name)
    result = base.get_column_text("会员名")
    assert len(result) == 3
    base.wait_element_click(base.get_cell_xpath(first_order_code, "订单编码"))
    base.click_space()
    base.wait_element_click(base.find_xpath("修改&标记"))
    with base.wait_refresh(base.get_cell_xpath(first_order_code, "卖家备注")):
        base.wait_element_click(base.find_xpath("修改&标记", "标记备注已处理"))
    result = base.wait_element(base.get_cell_xpath(first_order_code, "卖家备注")).text
    print(f"{result}")
    assert result.replace("\n改", "").endswith("#")
    base.fuzzy_search("订单编码", vip_name)
    result = base.get_column_text("会员名")
    assert len(result) == 3
    base.wait_element_click(base.get_cell_xpath(second_order_code, "订单编码"))
    base.click_space()
    base.wait_element_click(base.find_xpath("修改&标记"))
    with base.wait_refresh(base.get_cell_xpath(second_order_code, "买家备注")):
        base.wait_element_click(base.find_xpath("修改&标记", "标记备注已处理"))
    result = base.wait_element(base.get_cell_xpath(second_order_code, "买家备注")).text
    print(f"{result}")
    assert result.replace("\n改", "").endswith("#")
    base.wait_element_click(base.find_xpath("订单状态", "待审核(有备注)"))
    base.wait_element_click(base.find_xpath("订单状态", "待审核(无备注)"))
    time.sleep(1)
    base.fuzzy_search("订单编码", vip_name)
    result = base.get_column_text("会员名")
    assert len(result) == 3
Пример #7
0
def test_new_order2():
    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"]
    print(order_code)
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
Пример #11
0
def test_new_order():
    name = base.get_now_string()
    print(name)
    interface.new_vip(name)
    sku_info = [{'商家编码': '测试商品1-红色 XS', '数量': '2'}, ]
    order_info = order_interface.new_order(name, sku_info)
    print(order_info)
    order_id = order_info["ID"]
    order_code = order_info["Code"]
    print(f"创建订单单号:{order_code}")
    result = order_interface.approve_order(order_id)
    print(result)
    time.sleep(1)
    delivery_order_id = delivery_interface.get_delivery_order_info({"模糊搜索": order_code}, ["ID"])[0]["ID"]
    print(f"发货单ID是{delivery_order_id}")
    delivery_interface.send_delivery(delivery_order_id)
    delivery_order_id = delivery_interface.get_delivered_order_info({"模糊搜索": name}, ["ID"])
    print(f"发货单ID是{delivery_order_id}")
def test_modify_warehouse_and_express():
    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 = [{'商家编码': enough_sku_code_list[0], '数量': '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()
    modify_info = {"仓库": "测试仓", "快递": "EMS", }
    order.modify_warehouse_and_express(order_code, modify_info)
    warehouse_name = base.wait_element(base.get_cell_xpath(order_code, "仓库")).text
    assert "测试仓" in warehouse_name
    express_name = base.wait_element(base.get_cell_xpath(order_code, "快递")).text
    assert "EMS" in express_name
Пример #13
0
def test_data_correctness():
    product_code = base.get_now_string()
    product_interface.new_product(product_code)
    print(f"先新建一个商品:{product_code}")
    base.wait_element(base.find_xpath_by_placeholder("货号")).send_keys(product_code)
    time.sleep(1)
    base.wait_table_refresh(base.find_xpath("组合查询"), 1, "货号")
    print(f"校验货号是不是{product_code}")
    result = base.get_column_text("货号")
    for i in result:
        assert i == product_code
    sku_name_list = [
        "红色 XS",
        "红色 S",
        "红色 M",
        "红色 L",
        "红色 XL",
        "红色 2XL",
        "红色 3XL",
    ]
    print(f"通过规格名称数,和规格名称是不是在规格名称列表中验证规格名称")
    result = base.get_column_text("规格名称")
    assert len(result) == len(sku_name_list)
    for i in result:
        assert i in sku_name_list
    sku_code_list = []
    for i in sku_name_list:
        sku_code_list.append(product_code + "-" + i)
    print(f"通过商家编码数量和商家编码是否在商家编码列表中验证商家编码是否正确")
    product_interface.modify_sku_price(sku_code_list[0], "100", "200", "300", "400")
    print(f"修改标准售价为100,第二价格为200,第三价格为300,第四价格为400")
    result = base.get_column_text("商家编码")
    for i in result:
        assert i in sku_code_list
    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)
    print(f"修改商品的简称为简称,再刷新一次简称是否能正常显示")
    base.wait_table_refresh(base.find_xpath("组合查询"), 1, "货号")
    result = base.get_column_text("商品简称")
    for i in result:
        assert i == "简称"
    sku_info_list = []
    for i in sku_code_list:
        sku_info_list.append({"商家编码": i, "单价": "20", "数量": "100"})
    purchase_order_id = purchase_interface.new_purchase_order("主仓库", "供应商1", sku_info_list)["ID"]
    purchase_interface.approve_and_stock_in_purchase_order(purchase_order_id)
    base.wait_table_refresh(base.find_xpath("组合查询"), 1, "货号")
    base.scroll_to(4)
    marketability_inventory = 0
    inventory = 0
    balance = 0
    temporary_inventory = 0
    bin_inventory = 0
    purchase_num = 0
    sales_num = 0
    occupy_num = 0
    marketability_inventory += 100
    print(f"可销售库存是{marketability_inventory}")
    inventory += 100
    print(f"库存是{inventory}")
    balance += 2000
    print(f"余额是{balance}")
    temporary_inventory += 100
    print(f"暂存位库存是{temporary_inventory}")
    purchase_price = 20
    print(f"最新进价是{purchase_price}")
    cost_price = 20
    print(f"成本单价是{cost_price}")
    check_data(bin_inventory, marketability_inventory, inventory, balance, temporary_inventory, purchase_price,
               cost_price, purchase_num, sales_num, occupy_num)
    print(f"每个规格采购100个,单价20,验证可销库存数是100,库存数是100,余额是2000.00,暂存位库存是100,最新进价是20.00,成本单价是20.00")
    stock_in_order_id = inventory_interface.new_stock_in_order("主仓库", "供应商1", sku_info_list)["ID"]
    inventory_interface.stock_in_stock_in_order(stock_in_order_id)
    base.wait_table_refresh(base.find_xpath("组合查询"), 1, "可销库存数")
    marketability_inventory += 100
    print(f"可销售库存是{marketability_inventory}")
    inventory += 100
    print(f"库存是{inventory}")
    balance += 2000
    print(f"余额是{balance}")
    temporary_inventory += 100
    print(f"暂存位库存是{temporary_inventory}")
    purchase_price = 20
    print(f"最新进价是{purchase_price}")
    cost_price = 20
    print(f"成本单价是{cost_price}")
    check_data(bin_inventory, marketability_inventory, inventory, balance, temporary_inventory, purchase_price,
               cost_price, purchase_num, sales_num, occupy_num)
    print(f"每个规格入库100个,验证可销售库存是200,库存是200,余额是4000, 暂存位库存是200, 最新进价 20, 成本单价是20")
    stock_out_info = []
    for i in sku_code_list:
        stock_out_info.append({"商家编码": i, "单价": "20", "数量": "50"})
    result = inventory_interface.new_stock_out_order("主仓库", "供应商1", stock_out_info)
    stock_out_order_id = result["ID"]
    inventory_interface.stock_out_stock_out_order(stock_out_order_id)
    base.wait_table_refresh(base.find_xpath("组合查询"), 1, "可销库存数")
    marketability_inventory -= 50
    print(f"可销售库存是{marketability_inventory}")
    inventory -= 50
    print(f"库存是{inventory}")
    balance -= 1000
    print(f"余额是{balance}")
    temporary_inventory -= 50
    print(f"暂存位库存是{temporary_inventory}")
    purchase_price = 20
    print(f"最新进价是{purchase_price}")
    cost_price = 20
    print(f"成本单价是{cost_price}")
    check_data(bin_inventory, marketability_inventory, inventory, balance, temporary_inventory, purchase_price,
               cost_price, purchase_num, sales_num, occupy_num)
    print(f"每个规格出库50个,验证可销售库存150个,库存150个, 余额3000, 暂存位库存15, ")
    result = inventory_interface.new_refund_out_order("主仓库", "供应商1", stock_out_info)
    refund_out_order_id = result["ID"]
    inventory_interface.stock_out_stock_out_order(refund_out_order_id)
    base.wait_table_refresh(base.find_xpath("组合查询"), 1, "可销库存数")
    marketability_inventory -= 50
    print(f"可销售库存是{marketability_inventory}")
    inventory -= 50
    print(f"库存是{inventory}")
    balance -= 1000
    print(f"余额是{balance}")
    temporary_inventory -= 50
    print(f"暂存位库存是{temporary_inventory}")
    purchase_price = 20
    print(f"最新进价是{purchase_price}")
    cost_price = 20
    print(f"成本单价是{cost_price}")
    check_data(bin_inventory, marketability_inventory, inventory, balance, temporary_inventory, purchase_price,
               cost_price, purchase_num, sales_num, occupy_num)
    print(f"每个规格退货出库50个,验证可销售库存100个,库存100个, 余额2000, 暂存位库存100, ")
    purchase_order_id = purchase_interface.new_purchase_order("主仓库", "供应商1", stock_out_info)["ID"]
    purchase_interface.approve_purchase_order(purchase_order_id)
    base.wait_table_refresh(base.find_xpath("组合查询"), 1, "可销库存数")
    purchase_num = 0
    purchase_num += 50
    check_data(bin_inventory, marketability_inventory, inventory, balance, temporary_inventory, purchase_price,
               cost_price, purchase_num, sales_num, occupy_num)
    print(f"每个规格采购50个,不入库,验证可销售库存100个,库存100个, 余额2000, 暂存位库存100, 采购在途数是50")
    vip_name = base.get_now_string()
    vip_interface.new_vip(vip_name)
    sku_info = []
    # 还是通过sku_inf_list生成需要的商品信息列表
    for i in sku_code_list:
        sku_info.append({"商家编码": i, "数量": "10"})
    print(f"商品信息是{sku_info}")
    order_info = order_interface.new_order(vip_name, sku_info)
    order_id = order_info["ID"]
    order_code = order_info["Code"]
    print(f"创建订单单号:{order_code}")
    result = order_interface.approve_order(order_id)
    print(f"审核订单的信息是:{result}")
    delivery_order_id = delivery_interface.get_delivery_order_info({"模糊搜索": order_code}, ["ID"])[0]["ID"]
    print(f"发货单ID是{delivery_order_id}")
    delivery_interface.send_delivery(delivery_order_id)
    print(f"订单发货出库")
    sales_num = 10
    base.wait_table_refresh(base.find_xpath("组合查询"), 1, "可销库存数")
    marketability_inventory -= 10
    print(f"可销售库存是{marketability_inventory}")
    inventory -= 10
    print(f"库存是{inventory}")
    balance -= 200
    print(f"余额是{balance}")
    temporary_inventory -= 10
    print(f"暂存位库存是{temporary_inventory}")
    purchase_price = 20
    print(f"最新进价是{purchase_price}")
    cost_price = 20
    print(f"成本单价是{cost_price}")
    check_data(bin_inventory, marketability_inventory, inventory, balance, temporary_inventory, purchase_price,
               cost_price, purchase_num, sales_num, occupy_num)
    print(f"新建订单:{order_code},并发货出库,此时每个规格可销售库存减10,库存减10,余额减200,暂存位库存减10,销量加10,")
    print(f"再次新建订单,单不发货只审核,验证占用数增加10,销量增加10,其他不变")
    vip_name = base.get_now_string()
    vip_interface.new_vip(vip_name)
    print(f"商品信息是{sku_info}")
    order_info = order_interface.new_order(vip_name, sku_info)
    order_id = order_info["ID"]
    order_code = order_info["Code"]
    print(f"创建订单单号:{order_code}")
    result = order_interface.approve_order(order_id)
    print(f"审核订单的信息是:{result}")
    base.wait_table_refresh(base.find_xpath("组合查询"), 1, "可销库存数")
    marketability_inventory -= 10
    sales_num += 10
    occupy_num = 10
    check_data(bin_inventory, marketability_inventory, inventory, balance, temporary_inventory, purchase_price,
               cost_price, purchase_num, sales_num, occupy_num)
    print(f"再次新建订单,不审核,验证占用数增加10,销量增加10,其他不变")
    vip_name = base.get_now_string()
    vip_interface.new_vip(vip_name)
    print(f"商品信息是{sku_info}")
    order_info = order_interface.new_order(vip_name, sku_info)
    order_id = order_info["ID"]
    order_code = order_info["Code"]
    print(f"创建订单单号:{order_code}")
    base.wait_table_refresh(base.find_xpath("组合查询"), 1, "可销库存数")
    marketability_inventory -= 10
    sales_num += 10
    occupy_num += 10
    check_data(bin_inventory, marketability_inventory, inventory, balance, temporary_inventory, purchase_price,
               cost_price, purchase_num, sales_num, occupy_num)
    print(f"通过快速上架功能每个规格上架10个,验证库位库存是否是10,可销售库存加10,库存数加10,库存余额加200")
    print(f"先生成条码")
    sku_id_list = product_interface.get_sku_id(product_code)
    product_interface.new_create_sku_bar_code(sku_id_list)
    bin_sku_mapping = {}
    for i in sku_info:
        bin_name = setting_interface.get_random_bin("主仓库")["库位"]
        print(f"主仓库库位名称是{bin_name}")
        bin_sku_mapping[i["商家编码"]] = bin_name
        barcode = product_interface.get_sku_bar_code(i["商家编码"])[0]
        pda_interface.quick_put_away(bin_name, barcode, i["数量"])
    base.wait_table_refresh(base.find_xpath("组合查询"), 1, "可销库存数")
    bin_inventory = 10
    marketability_inventory += 10
    inventory += 10
    balance += 200
    check_data(bin_inventory, marketability_inventory, inventory, balance, temporary_inventory, purchase_price,
               cost_price, purchase_num, sales_num, occupy_num)
    print(f"通过快速下架,每个规格下架5个,验证库位库存是否减5,可销售库存加减5,库存数加减5,库存余额减100")
    for i in sku_info:
        barcode = product_interface.get_sku_bar_code(i["商家编码"])[0]
        num = int(i["数量"])-5
        pda_interface.quick_sold_out(bin_sku_mapping[i["商家编码"]], barcode, num)
    base.wait_table_refresh(base.find_xpath("组合查询"), 1, "可销库存数")
    bin_inventory -= 5
    marketability_inventory -= 5
    inventory -= 5
    balance -= 100
    check_data(bin_inventory, marketability_inventory, inventory, balance, temporary_inventory, purchase_price,
               cost_price, purchase_num, sales_num, occupy_num)
    print(f"换成测试仓再来一次")
    print(f"测试仓每个规格采购入库100")
    purchase_order_id = purchase_interface.new_purchase_order("测试仓", "供应商1", sku_info_list)["ID"]
    purchase_interface.approve_and_stock_in_purchase_order(purchase_order_id)
    print(f"测试仓每个规格入库100")
    stock_in_order_id = inventory_interface.new_stock_in_order("测试仓", "供应商1", sku_info_list)["ID"]
    inventory_interface.stock_in_stock_in_order(stock_in_order_id)
    print(f"测试仓每个规格出库50个")
    result = inventory_interface.new_stock_out_order("测试仓", "供应商1", stock_out_info)
    stock_out_order_id = result["ID"]
    inventory_interface.stock_out_stock_out_order(stock_out_order_id)
    print(f"测试仓每个规格退货出库50个")
    result = inventory_interface.new_refund_out_order("测试仓", "供应商1", stock_out_info)
    refund_out_order_id = result["ID"]
    inventory_interface.stock_out_stock_out_order(refund_out_order_id)
    print(f"测试仓每个规格采购100个,不入库")
    purchase_order_id = purchase_interface.new_purchase_order("测试仓", "供应商1", stock_out_info)["ID"]
    purchase_interface.approve_purchase_order(purchase_order_id)
    print(f"发货出库10个")
    vip_name = base.get_now_string()
    vip_interface.new_vip(vip_name)
    order_info = order_interface.new_order(vip_name, sku_info, "测试仓")
    order_id = order_info["ID"]
    order_code = order_info["Code"]
    print(f"创建订单单号:{order_code}")
    result = order_interface.approve_order(order_id)
    print(f"审核订单的信息是:{result}")
    delivery_order_id = delivery_interface.get_delivery_order_info({"模糊搜索": order_code}, ["ID"])[0]["ID"]
    print(f"发货单ID是{delivery_order_id}")
    delivery_interface.send_delivery(delivery_order_id)
    print(f"订单发货出库")
    print(f"创建并审核10个")
    vip_name = base.get_now_string()
    vip_interface.new_vip(vip_name)
    print(f"商品信息是{sku_info}")
    order_info = order_interface.new_order(vip_name, sku_info, "测试仓")
    order_id = order_info["ID"]
    order_code = order_info["Code"]
    print(f"创建订单单号:{order_code}")
    result = order_interface.approve_order(order_id)
    print(f"审核订单的信息是:{result}")
    print(f"创建订单不审核")
    vip_name = base.get_now_string()
    vip_interface.new_vip(vip_name)
    print(f"商品信息是{sku_info}")
    order_info = order_interface.new_order(vip_name, sku_info, "测试仓")
    order_code = order_info["Code"]
    print(f"创建订单单号:{order_code}")
    print(f"每个规格上架10个")
    pda_interface.cookies = pda_interface.change_warehouse("测试仓")
    bin_sku_mapping = {}
    for i in sku_info:
        bin_name = setting_interface.get_random_bin("测试仓")["库位"]
        print(f"库位名称是{bin_name}")
        bin_sku_mapping[i["商家编码"]] = bin_name
        barcode = product_interface.get_sku_bar_code(i["商家编码"])[0]
        pda_interface.quick_put_away(bin_name, barcode, i["数量"])
    print(f"每个规格下架5个")
    for i in sku_info:
        barcode = product_interface.get_sku_bar_code(i["商家编码"])[0]
        num = int(i["数量"]) - 5
        pda_interface.quick_sold_out(bin_sku_mapping[i["商家编码"]], barcode, num)
    base.wait_table_refresh(base.find_xpath("组合查询"), 1, "可销库存数")
    bin_inventory *= 2
    marketability_inventory *= 2
    inventory *= 2
    balance *= 2
    temporary_inventory *= 2
    sales_num *= 2
    purchase_num *= 2
    occupy_num *= 2
    check_data(bin_inventory, marketability_inventory, inventory, balance, temporary_inventory, purchase_price,
               cost_price, purchase_num, sales_num, occupy_num)
    print(f"选择主仓库搜索搜索出具数值减半")
    bin_inventory /= 2
    marketability_inventory /= 2
    inventory /= 2
    balance /= 2
    temporary_inventory /= 2
    sales_num /= 2
    purchase_num /= 2
    occupy_num /= 2
    base.wait_element_click(base.find_xpath_by_placeholder("请选择仓库"))
    base.wait_element_click(base.find_xpath("主仓库"))
    base.wait_table_refresh(base.find_xpath("组合查询"), 1, "可销库存数")
    check_data(bin_inventory, marketability_inventory, inventory, balance, temporary_inventory, purchase_price,
               cost_price, purchase_num, sales_num, occupy_num)
    base.wait_element_click(base.find_xpath_by_placeholder("请选择仓库"))
    base.wait_element_click(base.find_xpath("主仓库"))
    base.wait_element_click(base.find_xpath("测试仓"))
    base.wait_table_refresh(base.find_xpath("组合查询"), 1, "可销库存数")
    check_data(bin_inventory, marketability_inventory, inventory, balance, temporary_inventory, purchase_price,
               cost_price, purchase_num, sales_num, occupy_num)
def test_check_out_of_stock():
    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 += 10
        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)
    enough_sku_info = [{'商家编码': enough_sku_code_list[0], '数量': '3'}]
    print(f"商品信息是:{enough_sku_info}")
    enough_order_code = order_interface.new_order(vip_name, enough_sku_info)["Code"]
    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")
    lack_sku_info = [{'商家编码': lack_sku_code_list[0], '数量': '5'}]
    print(f"商品信息是:{lack_sku_info}")
    lack_order_code = order_interface.new_order(vip_name, lack_sku_info)["Code"]
    part_lack_sku_info = [{'商家编码': enough_sku_code_list[0], '数量': '3'}, {'商家编码': lack_sku_code_list[0], '数量': '5'}]
    part_lack_order_code = order_interface.new_order(vip_name, part_lack_sku_info)["Code"]
    print(f"检查缺货之后订单需要标记缺货状态")
    base.scroll_to(5)
    with base.wait_refresh(base.get_cell_xpath(1, "缺货")):
        base.wait_element_click(base.find_xpath("修改&标记", "其他"))
        base.wait_element(base.find_xpath_with_spaces("全部检查缺货"))
        time.sleep(1)
        base.wait_element_click(base.find_xpath_with_spaces("全部检查缺货"))
    result = base.wait_element(base.get_cell_xpath(1, "缺货")).text
    assert result == "部分缺货"
    vip_name = "会员" + base.get_now_string()
    vip_interface.new_vip(vip_name)
    print(f"{vip_name}")
    enough_order_code = order_interface.new_order(vip_name, enough_sku_info)["Code"]
    with base.wait_refresh(base.get_cell_xpath(1, "缺货")):
        base.wait_element_click(base.find_xpath("修改&标记", "其他"))
        base.wait_element(base.find_xpath_with_spaces("全部检查缺货"))
        time.sleep(1)
        base.wait_element_click(base.find_xpath_with_spaces("全部检查缺货"))
    result = base.wait_element(base.get_cell_xpath(1, "缺货")).text
    assert result == "库存充足"
    vip_name = "会员" + base.get_now_string()
    vip_interface.new_vip(vip_name)
    print(f"{vip_name}")
    lack_order_code = order_interface.new_order(vip_name, lack_sku_info)["Code"]
    with base.wait_refresh(base.get_cell_xpath(1, "缺货")):
        base.wait_element_click(base.find_xpath("修改&标记", "其他"))
        base.wait_element(base.find_xpath_with_spaces("全部检查缺货"))
        time.sleep(1)
        base.wait_element_click(base.find_xpath_with_spaces("全部检查缺货"))
    result = base.wait_element(base.get_cell_xpath(1, "缺货")).text
    assert result == "全部缺货"
    vip_name = "会员" + base.get_now_string()
    vip_interface.new_vip(vip_name)
    print(f"{vip_name}")
    part_lack_order_code = order_interface.new_order(vip_name, part_lack_sku_info)["Code"]
    with base.wait_refresh(base.get_cell_xpath(1, "缺货")):
        base.wait_element_click(base.find_xpath("修改&标记", "其他"))
        base.wait_element(base.find_xpath_with_spaces("全部检查缺货"))
        time.sleep(1)
        base.wait_element_click(base.find_xpath_with_spaces("全部检查缺货"))
    result = base.wait_element(base.get_cell_xpath(1, "缺货")).text
    assert result == "部分缺货"
Пример #15
0
def test_approve_button():
    print(f"把异常全部点击一遍,有异常的审核,看能否正常报错")
    exception_list = {
        "黑名单": "黑名单",
        "线上改商品": "线上改商品",
        "标记异常": "标记异常",
        "线上修改地址": "线上修改地址",
        "未设置仓库": "未设置仓库",
        "未设置快递": "未设置快递",
        "收货信息不完整": "收货信息不完整",
        "手工终止发货": "手工终止发货",
        "商品未匹配": "商品未匹配",
        "付款异常": "付款异常",
        "全部退款": "全部退款",
        "部分退款": "部分退款",
        "无商品信息": "无商品信息",
        "其他ERP已发货": "其他ERP已发货",
        "线上锁定": "线上锁定",
    }
    base.wait_element(base.find_xpath("异常", "未审核有异常"))
    time.sleep(1)
    base.wait_element_click(base.find_xpath("异常", "未审核有异常"))
    for k, v in exception_list.items():
        base.wait_element_click(base.find_xpath("未审核有异常", k))
        element = base.wait_element(base.find_xpath("本页共", "加载"))
        text = element.text
        base.wait_element_click(base.find_xpath("组合查询"))
        base.wait_element_refresh(element, text)
        num_text = base.wait_element(base.find_xpath("已选择", "本页共")).text
        print(num_text)
        if num_text == "本页共0条数据":
            print(f"黑名单异常没有数据,不用查看")
            base.wait_element_click(base.find_xpath("未审核有异常", k))
            continue
        else:
            base.wait_element_click(base.get_cell_xpath(1, "订单编码"))
            base.click_space()
            base.wait_element_click(base.find_xpath("审核"))
            try:
                base.wait_element(base.find_xpath("信息", v))
            except AssertionError as ae:
                print(ae)
                assert 1 == 2, f"全部订单页面审核有{k}异常的订单不能正常弹窗报错"
            base.wait_element(base.find_xpath("信息", "确定"))
            time.sleep(1)
            base.wait_element_click(base.find_xpath("信息", "确定"))
            base.wait_element_click(base.find_xpath("未审核有异常", k))
    print(f"新建会员,转异常,验证是否能正常报错")
    print(f"先修改设置开启自动合单设置")
    setting_info = {"开启": "true"}
    setting_interface.save_auto_merge_setting(setting_info)
    time.sleep(5)
    print(f"修改设置之后等待5秒")
    base.wait_element_click(base.find_xpath("清空"))
    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"]
    print(order_code)
    base.fuzzy_search("订单编码", order_code)
    base.wait_element_click(base.get_cell_xpath(order_code, "订单编码"))
    base.select_all()
    print(f"先测试 黑名单,终结, 标记异常审核时系统能否正常报错")
    order.turn_to_exception("黑名单")
    base.wait_text_locate(base.get_cell_xpath(order_code, "订单状态"), "黑名单")
    base.wait_element_click(base.find_xpath("审核"))
    try:
        base.wait_element(base.find_xpath("信息", f"订单:/{order_code}有异常:黑名单"))
    except AssertionError as e:
        print(e)
        assert 1 == 2, f"全部订单页面审核标记异常订单不能正常弹窗报错"
    time.sleep(1)
    base.wait_element_click(base.find_xpath("信息", "确定"))
    print(f"审核待合并订单,则需要报错待合并订单异常")
    base.fuzzy_search("订单编码", merge_order_code)
    base.select_all()
    base.wait_element_click(base.find_xpath("审核"))
    try:
        base.wait_element(base.find_xpath("信息", f"待合并订单:/{order_code}有异常:黑名单"))
    except AssertionError as e:
        print(e)
        assert 1 == 2, f"全部订单页面审核标记异常订单不能正常弹窗报错"
    time.sleep(1)
    base.wait_element_click(base.find_xpath("信息", "确定"))
    base.fuzzy_search("订单编码", order_code)
    base.select_all()
    order.turn_to_normal("黑名单")
    base.wait_text_locate(base.get_cell_xpath(order_code, "订单状态"), "待审核")
    # TODO:(RUI)全部订单页面审核已终结的订单报错:当前数据可能被其他人操作了,请刷新后重试!,需要优化下报错,比如 订单:/TD200918013有异常:标记异常 常用异常2
    # order.turn_to_exception("终结")
    # base.wait_text_locate(base.get_cell_xpath(order_code, "订单状态"), "已终结")
    # order.turn_to_normal("已终结")
    # base.wait_text_locate(base.get_cell_xpath(order_code, "订单状态"), "待审核")
    base.fuzzy_search("订单编码", order_code)
    base.select_all()
    order.turn_to_exception("标记异常", "异常测试")
    base.wait_text_locate(base.get_cell_xpath(order_code, "订单状态"), "异常测试")
    base.wait_element_click(base.find_xpath("审核"))
    try:
        base.wait_element(
            base.find_xpath("信息", f"订单:/{order_code}有异常:标记异常 异常测试"))
    except AssertionError as e:
        print(e)
        assert 1 == 2, f"全部订单页面审核标记异常订单不能正常弹窗报错"
    time.sleep(1)
    base.wait_element_click(base.find_xpath("信息", "确定"))
    print(f"审核待合并订单,则需要报错待合并订单异常")
    base.fuzzy_search("订单编码", merge_order_code)
    base.select_all()
    base.wait_element_click(base.find_xpath("审核"))
    try:
        base.wait_element(
            base.find_xpath("信息", f"待合并订单:/{order_code}有异常:标记异常 异常测试"))
    except AssertionError as e:
        print(e)
        assert 1 == 2, f"全部订单页面审核标记异常订单不能正常弹窗报错"
    time.sleep(1)
    base.wait_element_click(base.find_xpath("信息", "确定"))
    base.fuzzy_search("订单编码", order_code)
    base.select_all()
    order.turn_to_normal("标记异常")
    base.wait_text_locate(base.get_cell_xpath(order_code, "订单状态"), "待审核")
    order.turn_to_exception("常用异常", "常用异常2")
    base.wait_text_locate(base.get_cell_xpath(order_code, "订单状态"), "常用异常2")
    base.wait_element_click(base.find_xpath("审核"))
    try:
        base.wait_element(
            base.find_xpath("信息", f"订单:/{order_code}有异常:标记异常 常用异常2"))
    except AssertionError as e:
        print(e)
        assert 1 == 2, f"全部订单页面审核标记异常订单不能正常弹窗报错"
    time.sleep(1)
    base.wait_element_click(base.find_xpath("信息", "确定"))
    print(f"审核待合并订单,则需要报错待合并订单异常")
    base.fuzzy_search("订单编码", merge_order_code)
    base.select_all()
    base.wait_element_click(base.find_xpath("审核"))
    try:
        base.wait_element(
            base.find_xpath("信息", f"待合并订单:/{order_code}有异常:标记异常 常用异常2"))
    except AssertionError as e:
        print(e)
        assert 1 == 2, f"全部订单页面审核标记异常订单不能正常弹窗报错"
    time.sleep(1)
    base.wait_element_click(base.find_xpath("信息", "确定"))
    base.fuzzy_search("订单编码", order_code)
    base.select_all()
    order.turn_to_normal("标记异常")
    base.wait_text_locate(base.get_cell_xpath(order_code, "订单状态"), "待审核")
    print(f"先设置不允许负库存,然后审核报错,再设置允许负库存,审核订单")
    setting_info = {"允许负库存": "false"}
    setting_interface.save_base_setting(setting_info)
    time.sleep(5)
    print(f"设置不允许负库存之后,等待5秒设置生效")
    base.fuzzy_search("订单编码", order_code)
    base.select_all()
    base.wait_element_click(base.find_xpath("审核"))
    base.wait_element(base.find_xpath("信息", "库存不足,不允许审核"))
    time.sleep(1)
    base.wait_element_click(base.find_xpath("信息", "确定"))
    setting_info = {"允许负库存": "true"}
    setting_interface.save_base_setting(setting_info)
    time.sleep(5)
    print(f"设置不允许负库存之后,等待5秒设置生效")
    element = base.wait_element(base.get_cell_xpath(order_code, "订单状态"))
    text = element.text
    base.wait_element_click(base.find_xpath("审核"))
    base.wait_element_refresh(element, text)
    order_status = base.wait_element(base.get_cell_xpath(order_code,
                                                         "订单状态")).text
    assert order_status == '发货中'
    setting_info = {"开启": "false"}
    setting_interface.save_auto_merge_setting(setting_info)
    time.sleep(5)
    print(f"修改设置之后等待5秒")
Пример #16
0
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_modify_note():
    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 = [{'商家编码': enough_sku_code_list[0], '数量': '3'}]
    first_order_code = order_interface.new_order(vip_name, sku_info)["Code"]
    second_order_code = order_interface.new_order(vip_name, sku_info)["Code"]
    base.fuzzy_search("订单编码", vip_name)
    base.wait_element_click(base.get_cell_xpath(first_order_code, "订单编码"))
    base.click_space()
    modify_info = {"便签": "第一次", "追加": False}
    order.modify_note(first_order_code, modify_info)
    result = base.wait_element(base.get_cell_xpath(first_order_code, "便签")).text
    assert "第一次" in result
    modify_info = {"便签": "第二次", "追加": True}
    order.modify_note(first_order_code, modify_info)
    result = base.wait_element(base.get_cell_xpath(first_order_code, "便签")).text
    assert "第二次" in result
    assert "第一次" in result
    print(f"再测试常用便签")
    modify_info = {"常用便签": "常用便签1", "追加": False}
    order.modify_note(first_order_code, modify_info)
    result = base.wait_element(base.get_cell_xpath(first_order_code, "便签")).text
    assert "常用便签1" in result
    assert "第二次" not in result
    assert "第一次" not in result
    print(f"再测试系统标签")
    modify_info = {"系统便签": "爆款订单", "追加": True}
    order.modify_note(first_order_code, modify_info)
    result = base.wait_element(base.get_cell_xpath(first_order_code, "便签")).text
    assert "常用便签1" in result
    assert "爆款订单" in result
    base.select_all()
    print(f"----------------------------------试下勾选多个订单修改备注-------------------------------------")
    modify_info = {"便签": "第三次", "追加": False}
    order.modify_note(first_order_code, modify_info)
    result = base.get_column_text("便签")
    for i in result:
        assert "第三次" in i
    modify_info = {"便签": "第四次", "追加": True}
    order.modify_note(first_order_code, modify_info)
    result = base.get_column_text("便签")
    for i in result:
        assert "第四次" in i
        assert "第三次" in i
    print(f"再测试常用便签")
    modify_info = {"常用便签": "常用便签2", "追加": False}
    order.modify_note(first_order_code, modify_info)
    result = base.get_column_text("便签")
    for i in result:
        assert "常用便签2" in i
    print(f"再测试系统便签")
    modify_info = {"系统便签": "装车拦截", "追加": True}
    order.modify_note(first_order_code, modify_info)
    result = base.get_column_text("便签")
    for i in result:
        assert "常用便签2" in i
        assert "装车拦截" in i
def test_modify_seller_memo():
    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 = [{'商家编码': enough_sku_code_list[0], '数量': '3'}]
    first_order_code = order_interface.new_order(vip_name, sku_info)["Code"]
    second_order_code = order_interface.new_order(vip_name, sku_info)["Code"]
    base.fuzzy_search("订单编码", vip_name)
    base.wait_element_click(base.get_cell_xpath(first_order_code, "订单编码"))
    base.click_space()
    modify_info = {"旗帜": "红旗", "备注": "第一次"}
    order.modify_seller_memo(first_order_code, modify_info)
    result = base.wait_element(base.get_cell_xpath(first_order_code, "卖家备注")).text
    assert "第一次" in result
    result = base.wait_element(base.get_cell_xpath(first_order_code, "旗帜")).text
    assert "红旗" in result
    modify_info = {"旗帜": "绿旗", "备注": "第二次", "追加": True}
    order.modify_seller_memo(first_order_code, modify_info)
    result = base.wait_element(base.get_cell_xpath(first_order_code, "卖家备注")).text
    assert "第二次" in result
    assert "第一次" in result
    result = base.wait_element(base.get_cell_xpath(first_order_code, "旗帜")).text
    assert "绿旗" in result
    print(f"再测试常用备注")
    modify_info = {"旗帜": "黄旗", "常用备注": "常用备注1"}
    order.modify_seller_memo(first_order_code, modify_info)
    result = base.wait_element(base.get_cell_xpath(first_order_code, "卖家备注")).text
    assert "常用备注1" in result
    assert "第二次" in result
    assert "第一次" in result
    result = base.wait_element(base.get_cell_xpath(first_order_code, "旗帜")).text
    assert "黄旗" in result
    base.select_all()
    print(f"----------------------------------试下勾选多个订单修改备注-------------------------------------")
    modify_info = {"旗帜": "蓝旗", "备注": "第三次"}
    order.modify_seller_memo(first_order_code, modify_info)
    result = base.get_column_text("卖家备注")
    for i in result:
        assert "第三次" in i
    result = base.get_column_text("旗帜")
    for i in result:
        assert "蓝旗" in result
    modify_info = {"旗帜": "紫旗", "备注": "第四次", "追加": True}
    order.modify_seller_memo(first_order_code, modify_info)
    result = base.get_column_text("卖家备注")
    for i in result:
        assert "第四次" in i
        assert "第三次" in i
    result = base.get_column_text("旗帜")
    for i in result:
        assert "紫旗" in result
    print(f"再测试常用备注")
    modify_info = {"旗帜": "黄旗", "常用备注": "常用备注2"}
    order.modify_seller_memo(first_order_code, modify_info)
    result = base.get_column_text("卖家备注")
    for i in result:
        assert "常用备注2" in i
    result = base.get_column_text("旗帜")
    for i in result:
        assert "黄旗" in result
Пример #19
0
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)