# -*- coding: utf-8 -*- """8089 实测:用户需求 324 详情 → 会议纪要 tab → MD 按钮 → mavon 富文本预览""" import io, sys from playwright.sync_api import sync_playwright sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8') BASE = 'http://localhost:8089' with sync_playwright() as p: b = p.chromium.launch(channel='chrome', headless=False, slow_mo=400, args=['--start-maximized']) page = b.new_page(viewport={'width': 1500, 'height': 950}) page.goto(BASE, wait_until='domcontentloaded'); page.wait_for_timeout(2000) page.locator('input[placeholder="用户名"]').fill('admin') page.locator('input[placeholder="密码"]').fill('123456') page.locator('text="登录"').first.click(); page.wait_for_timeout(6000) print('>>> 打开用户需求 324 详情') page.goto(f'{BASE}/#/product-user-story-info/324', wait_until='domcontentloaded') page.wait_for_timeout(6000) print('>>> 点会议纪要 tab') tab = page.locator('.el-tabs__item:has-text("会议纪要")').first tab.click(); page.wait_for_timeout(4000) page.screenshot(path='tmp/pw_324_meeting_tab.png') print('>>> 点会议卡片上的 MD 按钮') btn = page.locator('button:has-text("MD")').first if btn.count() == 0: print('!!! 没找到 MD 按钮'); page.screenshot(path='tmp/pw_324_no_md_btn.png'); b.close(); sys.exit(1) btn.click(); page.wait_for_timeout(5000) dlg = page.locator('.el-dialog:visible').last # mavon 预览渲染判定:出现 markdown-body 且含表格/代码块 body = dlg.locator('.markdown-body') print('markdown-body 数量:', body.count()) html = body.first.inner_html() if body.count() else '' print('含表格:', '>> 截图已存 tmp/pw_324_meeting_tab.png / tmp/pw_324_md_preview.png,窗口停留 3 分钟') page.wait_for_timeout(180000) b.close()