P2-2部署尝试+compose通配符修复 / D2收尾(唯一单号+前后断言+H5回归17过) / P2-1 StorefrontAdmin真分页 / 后端511+PG4
This commit is contained in:
@@ -13,6 +13,12 @@ import urllib.request
|
||||
BASE = "http://127.0.0.1:18099"
|
||||
PAGE = "http://127.0.0.1:15173/static/#/salesman"
|
||||
|
||||
# D2收尾:残留隔离 —— 每次运行用时间戳唯一收款单号 + 前后计数断言,
|
||||
# 不再依赖固定 SMH50002(重复跑会撞唯一约束),且不删单(过账有副作用)。
|
||||
import time as _time
|
||||
RUN_TAG = _time.strftime("%m%d%H%M%S")
|
||||
RECEIPT_NO = f"SMH{ RUN_TAG }"
|
||||
|
||||
|
||||
def api(method, path, token=None, tenant="default", body=None):
|
||||
req = urllib.request.Request(
|
||||
@@ -47,6 +53,15 @@ async def main():
|
||||
s, custs = api("GET", "/api/v1/partner/customers/?page_size=200",
|
||||
token=token)
|
||||
assert s == 200 and custs["count"] >= 1, f"customers: {s}"
|
||||
# 前后计数基线:验证前后差值断言(残留隔离,不删单)
|
||||
s, _b0 = api("GET", "/api/v1/sales/bills/?page_size=1", token=token)
|
||||
assert s == 200, f"bills baseline: {s}"
|
||||
bills_before = _b0["count"]
|
||||
s, _r0 = api("GET", "/api/v1/finance/receipts/?page_size=1", token=token)
|
||||
assert s == 200, f"receipts baseline: {s}"
|
||||
receipts_before = _r0["count"]
|
||||
print(f"[pre] baseline bills={bills_before} receipts={receipts_before} "
|
||||
f"run_tag={RUN_TAG} receipt_no={RECEIPT_NO}")
|
||||
s, whs = api("GET", "/api/v1/inventory/warehouses/?page_size=200",
|
||||
token=token)
|
||||
assert s == 200 and whs["count"] >= 1, f"warehouses: {s}"
|
||||
@@ -162,7 +177,7 @@ async def main():
|
||||
# 关掉可能残留的下拉浮层后再填单号(Esc 关闭 popper)
|
||||
await page.keyboard.press("Escape")
|
||||
await page.wait_for_timeout(400)
|
||||
bill_no = "SMH50002"
|
||||
bill_no = RECEIPT_NO
|
||||
await page.locator("#pane-receipt input[placeholder]").nth(0).scroll_into_view_if_needed()
|
||||
await page.locator("#pane-receipt input[placeholder]").nth(0).fill(bill_no)
|
||||
amt_input = page.locator("#pane-receipt .el-input-number input")
|
||||
@@ -187,12 +202,21 @@ async def main():
|
||||
assert latest and latest["state"] == "confirmed", \
|
||||
f"expected confirmed bill, got {latest}"
|
||||
|
||||
s, found = api("GET", "/api/v1/finance/receipts/?page_size=50&search=SMH50002",
|
||||
s, found = api("GET", f"/api/v1/finance/receipts/?page_size=50&search={RECEIPT_NO}",
|
||||
token=token)
|
||||
assert s == 200, f"receipts: {s}"
|
||||
hit = [r for r in found["results"] if r["bill_no"] == "SMH50002"]
|
||||
assert hit, f"receipt SMH50002 not found: {[r['bill_no'] for r in found['results'][:5]]}"
|
||||
print(f"[9] receipt SMH50002 ok amount={hit[0]['amount']}")
|
||||
hit = [r for r in found["results"] if r["bill_no"] == RECEIPT_NO]
|
||||
assert hit, f"receipt {RECEIPT_NO} not found: {[r['bill_no'] for r in found['results'][:5]]}"
|
||||
print(f"[9] receipt {RECEIPT_NO} ok amount={hit[0]['amount']}")
|
||||
# 残留隔离断言:本次恰好新增 1 单 + 1 收款(可重复跑,不删单)
|
||||
s, _b1 = api("GET", "/api/v1/sales/bills/?page_size=1", token=token)
|
||||
assert s == 200 and _b1["count"] == bills_before + 1, \
|
||||
f"bills delta: before={bills_before} after={_b1['count']}"
|
||||
s, _r1 = api("GET", "/api/v1/finance/receipts/?page_size=1", token=token)
|
||||
assert s == 200 and _r1["count"] == receipts_before + 1, \
|
||||
f"receipts delta: before={receipts_before} after={_r1['count']}"
|
||||
print(f"[9b] delta ok: bills {bills_before}->{_b1['count']}, "
|
||||
f"receipts {receipts_before}->{_r1['count']}")
|
||||
|
||||
s, debts = api("GET", "/api/v1/finance/receivables/?page_size=50",
|
||||
token=token)
|
||||
|
||||
Reference in New Issue
Block a user