# -*- coding: utf-8 -*- """产品助理(XMZL 李语嫣)绩效弹窗验证:老版区块 vs 老版后端 对齐检查""" import io, sys from playwright.sync_api import sync_playwright sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8') BASE = 'http://localhost:8088' with sync_playwright() as p: b = p.chromium.launch(channel='chrome', headless=True) page = b.new_page(viewport={'width': 1600, 'height': 1000}) page.goto(BASE, wait_until='domcontentloaded'); page.wait_for_timeout(2500) page.locator('input[placeholder="用户名"]').fill('admin') page.locator('input[placeholder="密码"]').fill('123456') page.locator('text="登录"').first.click(); page.wait_for_timeout(8000) page.goto(f'{BASE}/#/worktime/count', wait_until='domcontentloaded'); page.wait_for_timeout(6000) page.locator('.el-tabs__item:has-text("月报"):visible').first.click(); page.wait_for_timeout(4000) try: page.locator('.el-select:visible').nth(1).click(); page.wait_for_timeout(1500) page.locator('.el-select-dropdown:visible li:has-text("145")').first.click(); page.wait_for_timeout(1000) except Exception as e: print('产品集选择失败:', str(e)[:80]) mi = page.locator('input[placeholder="选择月"]:visible').first mi.click(); page.wait_for_timeout(800) mi.fill('2026-06'); page.keyboard.press('Enter'); page.wait_for_timeout(1200) page.locator('button:has-text("查询"):visible').first.click() try: page.wait_for_selector('tr:has-text("李语嫣")', timeout=20000) except Exception: page.screenshot(path='tmp/pw_xmzl_nolist.png', full_page=True) print('6 月列表未找到李语嫣,截图 tmp/pw_xmzl_nolist.png'); b.close(); raise SystemExit(1) page.locator('tr:has-text("李语嫣")').first.locator('button:has-text("绩效")').first.click() page.wait_for_timeout(10000) body = page.locator('body').inner_text() page.screenshot(path='tmp/pw_xmzl_liyuyan.png', full_page=True) expect = ['需求部门对项目的及时验收', '及时验收数量', '会议管理'] missing = [k for k in expect if k not in body] stale = [k for k in ['需求PRD工作量指标完成率', '主动性与责任感'] if k in body] print('老版行缺失:', missing if missing else '无') print('新版残留:', stale if stale else '无') b.close()