feat: 根目录文档、脚本、gitignore
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
"""CHG-065 产品助理+UI 新 Excel 弹窗验证"""
|
||||
import io, sys
|
||||
from playwright.sync_api import sync_playwright
|
||||
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8')
|
||||
BASE = 'http://localhost:8088'
|
||||
TARGETS = [
|
||||
('李语嫣', ['需求PRD工作量指标完成率', '产品缺陷率', '主动性与责任感'], ['会议管理', '项目文档'], 'tmp/pw_chg065_xmzl.png'),
|
||||
('刘圣清', ['任务及时完成', '设计质量', '工作态度'], [], 'tmp/pw_chg065_ui.png'),
|
||||
]
|
||||
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)
|
||||
for cname, expect, stale, shot in TARGETS:
|
||||
page.goto(f'{BASE}/#/worktime/count', wait_until='domcontentloaded'); page.wait_for_timeout(5000)
|
||||
page.locator('.el-tabs__item:has-text("月报"):visible').first.click(); page.wait_for_timeout(4000)
|
||||
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(f'tr:has-text("{cname}")', timeout=20000)
|
||||
except Exception:
|
||||
print(f'[{cname}] 月报列表未找到(当前产品集),尝试切 145')
|
||||
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(800)
|
||||
page.locator('button:has-text("查询"):visible').first.click()
|
||||
page.wait_for_selector(f'tr:has-text("{cname}")', timeout=15000)
|
||||
except Exception:
|
||||
print(f'[{cname}] 仍未找到,跳过'); continue
|
||||
page.locator(f'tr:has-text("{cname}")').first.locator('button:has-text("绩效")').first.click()
|
||||
page.wait_for_timeout(10000)
|
||||
body = page.locator('body').inner_text()
|
||||
page.screenshot(path=shot, full_page=True)
|
||||
miss = [k for k in expect if k not in body]
|
||||
left = [k for k in stale if k in body]
|
||||
print(f'[{cname}] 期望行缺失:{miss if miss else "无"} 旧版残留:{left if left else "无"} 截图 {shot}')
|
||||
page.keyboard.press('Escape'); page.wait_for_timeout(1500)
|
||||
b.close()
|
||||
Reference in New Issue
Block a user