from __future__ import annotations

from pathlib import Path

from openpyxl import load_workbook


ROOT = Path(__file__).resolve().parents[1]
EXCEL_PATH = ROOT / "测试用例" / "SaaS_订阅邀请登录_测试功能点.xlsx"


TARGETS = {
    "流程用例-应用版本管理": [
        "APPVER-FLOW-001",
        "APPVER-FLOW-002",
        "APPVER-FLOW-003",
        "APPVER-FLOW-004",
    ],
    "流程用例-产品解决方案": ["PRODSOL-FLOW-001"],
}


def main() -> None:
    wb = load_workbook(EXCEL_PATH, read_only=True)
    for sheet_name, case_ids in TARGETS.items():
        ws = wb[sheet_name]
        rows = {row[0]: row for row in ws.iter_rows(min_row=2, values_only=True)}
        for case_id in case_ids:
            row = rows[case_id]
            has_step_tail = "操作日志收尾" in str(row[7])
            has_expected_tail = "操作日志收尾" in str(row[8])
            print(f"{case_id} step={has_step_tail} expected={has_expected_tail}")


if __name__ == "__main__":
    main()
