feat: 根目录文档、脚本、gitignore
This commit is contained in:
@@ -0,0 +1,57 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
"""可视化演示测试:真实浏览器窗口,慢速操作,供人工观看"""
|
||||
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:
|
||||
browser = p.chromium.launch(channel='chrome', headless=False, slow_mo=400, args=['--start-maximized'])
|
||||
page = browser.new_page(viewport={'width': 1500, 'height': 950})
|
||||
|
||||
print('>>> 1/6 打开登录页,自动登录 admin')
|
||||
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('>>> 2/6 研发需求详情 6566:逐区块浏览')
|
||||
page.goto(f'{BASE}/#/product-story-info/6566', wait_until='domcontentloaded')
|
||||
page.wait_for_timeout(5000)
|
||||
for anchor in ['需求 ID', 'AI 指标', '测试用例/测试报告模版', '提交测试报告', '代码审查报告', '工作日志']:
|
||||
try:
|
||||
page.locator(f'text={anchor}').first.scroll_into_view_if_needed()
|
||||
page.wait_for_timeout(1500)
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
print('>>> 3/6 点「复制」需求ID,看提示')
|
||||
page.locator('text=需求 ID').first.scroll_into_view_if_needed(); page.wait_for_timeout(800)
|
||||
page.locator('text=复制').first.click(); page.wait_for_timeout(1500)
|
||||
|
||||
print('>>> 4/6 代码审查报告:点「查看」看 MD 在线渲染')
|
||||
page.locator('text=代码审查报告').first.scroll_into_view_if_needed(); page.wait_for_timeout(1200)
|
||||
page.locator('text="查看"').first.click(); page.wait_for_timeout(5000)
|
||||
page.keyboard.press('Escape'); page.wait_for_timeout(1000)
|
||||
|
||||
print('>>> 5/6 工作日志:UI 上传一个 MD(看列表多出文件)')
|
||||
page.locator('text=工作日志').first.scroll_into_view_if_needed(); page.wait_for_timeout(1000)
|
||||
page.locator('text=工作日志').locator('xpath=following::input[@type="file"][1]').first.set_input_files('tmp/smoke_worklog.md')
|
||||
page.wait_for_timeout(5000)
|
||||
|
||||
print('>>> 6/6 会议详情(会议 83):附件区 MD 在线渲染')
|
||||
page.goto(f'{BASE}/#/product-meeting-info/83', wait_until='domcontentloaded')
|
||||
page.wait_for_timeout(5000)
|
||||
try:
|
||||
page.locator('text=附件').first.scroll_into_view_if_needed(); page.wait_for_timeout(1200)
|
||||
btn = page.locator('text="在线查看"').first
|
||||
if btn.count() == 0:
|
||||
btn = page.locator('text="查看"').first
|
||||
btn.click(); page.wait_for_timeout(5000)
|
||||
except Exception as e:
|
||||
print('会议预览步骤:', str(e)[:80])
|
||||
|
||||
print('>>> 演示结束:窗口停留 120 秒供查看,可随时手动关闭')
|
||||
page.wait_for_timeout(120000)
|
||||
browser.close()
|
||||
Reference in New Issue
Block a user