Exemplo n.º 1
0
def test_check_inventory():
    base.wait_element(base.find_xpath("显示0库存", "是"))
    time.sleep(1)
    base.wait_element_click(base.find_xpath("显示0库存", "是"))
    base.wait_table_refresh(base.find_xpath("组合查询"), 1, "货号")
    sku_code = base.wait_element(base.get_cell_xpath(1, "商家编码")).text
    base.wait_element_click(base.get_cell_xpath(1, "商家编码"))
    base.click_space()
    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(100)
    base.change_frame("库存查询框架")
    base.wait_element_click(base.find_xpath("新增盘点单", "提交并盘点"))
    base.wait_element(base.find_xpath("显示0库存", "全部"))
    time.sleep(1)
    base.wait_element_click(base.find_xpath("显示0库存", "全部"))
    base.wait_element(
        base.find_xpath_by_placeholder("商家编码")).send_keys(Keys.CONTROL + 'a')
    base.wait_element(
        base.find_xpath_by_placeholder("商家编码")).send_keys(sku_code)
    base.wait_table_refresh(base.find_xpath("组合查询"), 1, "货号")
    inventory = base.wait_element(
        base.get_cell_xpath(sku_code, ["库存预警值", "库存数"])).text
    assert inventory == '100'
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
Exemplo n.º 3
0
def test_warning_inventory():
    base.wait_element(base.find_xpath("显示0库存", "是"))
    time.sleep(1)
    base.wait_element_click(base.find_xpath("显示0库存", "是"))
    base.wait_table_refresh(base.find_xpath("组合查询"), 1, "货号")
    sku_code = base.wait_element(base.get_cell_xpath(1, "商家编码")).text
    base.wait_element_click(base.get_cell_xpath(1, "商家编码"))
    base.click_space()
    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(100)
    base.change_frame("库存查询框架")
    base.wait_element_click(base.find_xpath("新增盘点单", "提交并盘点"))
    base.wait_element(base.find_xpath("显示0库存", "全部"))
    time.sleep(1)
    base.wait_element_click(base.find_xpath("显示0库存", "全部"))
    base.wait_element(
        base.find_xpath_by_placeholder("商家编码")).send_keys(Keys.CONTROL + 'a')
    base.wait_element(
        base.find_xpath_by_placeholder("商家编码")).send_keys(sku_code)
    base.wait_table_refresh(base.find_xpath("组合查询"), 1, "货号")
    base.wait_element_click(base.get_cell_xpath(sku_code,
                                                "库存预警值")).send_keys(200)
    base.wait_element_click(base.find_xpath("库存告警", "是"))
    time.sleep(1)
    base.wait_table_refresh(base.find_xpath("组合查询"), 1, "货号")
    result_num = base.wait_element(base.find_xpath("已选择", "本页共")).text
    assert result_num == "本页共1条数据"
    base.wait_element_click(base.find_xpath("库存告警", "否"))
    base.wait_table_refresh(base.find_xpath("组合查询"), 1, "货号")
    result_num = base.wait_element(base.find_xpath("已选择", "本页共")).text
    assert result_num == "本页共0条数据"
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_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_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_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_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
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 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
Exemplo n.º 12
0
def test_multi_modify_bin():
    bin_name = setting_interface.get_random_bin("主仓库")["库位"]
    print(bin_name)
    base.wait_element_click(base.find_xpath("显示0库存", "是"))
    base.wait_table_refresh(base.find_xpath("组合查询"), 1, "货号")
    sku_code = base.wait_element(base.get_cell_xpath(1, "商家编码")).text
    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_by_placeholder("请输入完整库位编码")).send_keys(Keys.CONTROL +
                                                               'a')
    base.wait_element(
        base.find_xpath_by_placeholder("请输入完整库位编码")).send_keys(bin_name)
    base.wait_element_click(base.find_xpath("空值不修改", "确认"))
    base.wait_element_refresh(element, text)
    result = base.wait_element(base.get_cell_xpath(sku_code, "固定库位")).text
    bin_name_list = list(bin_name)
    bin_name_list.pop(bin_name.index("-"))
    result_bin_name = ''.join(bin_name_list)
    print(result_bin_name)
    assert result_bin_name in result
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
Exemplo n.º 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秒")
Exemplo n.º 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秒")
Exemplo n.º 17
0
def test_function_button():
    setting_info = {
        "记录会员上次交易价:手工单或者门店单保存时,记录会员的商品交易价格": "true",
        "记录会员上次交易价 同款同价:手工单或者门店单保存时,记录会员的商品交易价格 同款同价": "false",
        "只有手工修改售价才会记录预设价格": "true",
    }
    interface.save_order_setting(setting_info)
    print("非同款同价模式+修改才记录会员价设置完成,修改设置之后等5秒,让设置生效")
    time.sleep(5)
    print("先准备测试数据:")
    vip_name = "会员" + base.get_now_string()
    interface.new_vip(vip_name)
    print(f"新建会员{vip_name}")
    product_code = base.get_now_string()
    interface.new_product(product_code)
    print(f"新建货号{product_code}")
    sku_code = interface.get_sku_code(product_code)[0]
    interface.modify_sku_price(sku_code, "100")
    print(f"通过{sku_code}将{product_code}整款标准售价设置为100")
    interface.modify_vip_level(vip_name, "8折")
    print(f"修改会员{vip_name}的会员等级为:8折")
    interface.modify_preset_price(vip_name, product_code, 0, 200)
    print(f"修改会员{vip_name}的商品{product_code}预设价格为200")
    base.close_page("预设会员价明细")
    base.open_page("会员", "预设会员价明细", "预设会员价明细框架")
    base.wait_element_click(
        base.find_xpath_by_placeholder("商品货号")).send_keys(product_code)
    base.wait_table_refresh(base.find_xpath("组合查询"), 1, "货号")
    base.select_all()
    base.wait_element_click(base.find_xpath_with_spaces("批量修改预设价格"))
    base.wait_element_click("//input[@id='price']").clear()
    base.wait_element_click("//input[@id='price']").send_keys("300")
    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)
    print(f"修改商品的价格为300")
    print(f"验证所有商品的价格是300")
    result = base.get_column_text("预设价格")
    for i in result:
        assert i == "300"
    print(f"确定所有商品的价格是300")
    sku_code_list = interface.get_sku_code(product_code)
    for i in sku_code_list[0:3]:
        base.wait_element_click(base.get_cell_xpath(i, "会员名"))
        base.click_space()
    base.wait_element_click(base.find_xpath_with_spaces("批量删除预设价格"))
    time.sleep(1)
    base.wait_element_click(base.find_xpath("是否确认删除", "确认"))
    time.sleep(1)
    base.wait_table_refresh(base.find_xpath("组合查询"), 1, "商家编码")
    result = base.get_column_text("商家编码")
    assert result == sku_code_list[3:]
    print(result)
    print(sku_code_list[3:])
    print("修改设置再来")
    print("修改设置再来")
    setting_info = {
        "记录会员上次交易价:手工单或者门店单保存时,记录会员的商品交易价格": "true",
        "记录会员上次交易价 同款同价:手工单或者门店单保存时,记录会员的商品交易价格 同款同价": "true",
        "只有手工修改售价才会记录预设价格": "true",
    }
    interface.save_order_setting(setting_info)
    print("非同款同价模式+修改才记录会员价设置完成,修改设置之后等5秒,让设置生效")
    time.sleep(5)
    print("先准备测试数据:")
    vip_name = "会员" + base.get_now_string()
    interface.new_vip(vip_name)
    print(f"新建会员{vip_name}")
    product_code = base.get_now_string()
    interface.new_product(product_code)
    print(f"新建货号{product_code}")
    sku_code = interface.get_sku_code(product_code)[0]
    interface.modify_sku_price(sku_code, "100")
    print(f"通过{sku_code}将{product_code}整款标准售价设置为100")
    interface.modify_vip_level(vip_name, "8折")
    print(f"修改会员{vip_name}的会员等级为:8折")
    interface.modify_preset_price(vip_name, product_code, 0, 200)
    print(f"修改会员{vip_name}的商品{product_code}预设价格为200")
    base.close_page("预设会员价明细")
    base.open_page("会员", "预设会员价明细", "预设会员价明细框架")
    base.wait_element_click(
        base.find_xpath_by_placeholder("商品货号")).send_keys(product_code)
    base.wait_table_refresh(base.find_xpath("组合查询"), 1, "货号")
    base.select_all()
    base.wait_element_click(base.find_xpath_with_spaces("批量修改预设价格"))
    base.wait_element_click("//input[@id='price']").clear()
    base.wait_element_click("//input[@id='price']").send_keys("300")
    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)
    print(f"修改商品的价格为300")
    print(f"验证所有商品的价格是300")
    result = base.get_column_text("预设价格")
    for i in result:
        assert i == "300"
    print(f"确定所有商品的价格是300")
    base.select_all()
    base.wait_element_click(base.find_xpath_with_spaces("批量删除预设价格"))
    time.sleep(1)
    base.wait_element_click(base.find_xpath("是否确认删除", "确认"))
    base.wait_table_refresh(base.find_xpath("组合查询"), 1, "货号")
    base.wait_element(base.find_xpath("本页共0条数据"))
Exemplo n.º 18
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)