Files
zentao-flow/tmp/pw_6566_layout.py

36 lines
1.6 KiB
Python

# -*- coding: utf-8 -*-
"""6566 研发详情:上传按钮位置验证(应在文件列表之后)"""
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=300, 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)
page.goto(f'{BASE}/#/product-story-info/6566', wait_until='domcontentloaded')
page.wait_for_timeout(6000)
# 滚动到「测试用例/测试报告模版」区块
sec = page.locator('.fs18.fw6:has-text("测试用例/测试报告模版")').first
sec.scroll_into_view_if_needed(); page.wait_for_timeout(1000)
page.screenshot(path='tmp/pw_6566_testcase_sec.png')
sec2 = page.locator('.fs18.fw6:has-text("提交测试报告")').first
sec2.scroll_into_view_if_needed(); page.wait_for_timeout(1000)
page.screenshot(path='tmp/pw_6566_submit_sec.png')
sec3 = page.locator('.fs18.fw6:has-text("代码审查报告")').first
sec3.scroll_into_view_if_needed(); page.wait_for_timeout(1000)
page.screenshot(path='tmp/pw_6566_review_sec.png')
print('>>> 截图完成,窗口停留 60s')
page.wait_for_timeout(60000)
b.close()