28 lines
1.6 KiB
Python
28 lines
1.6 KiB
Python
# -*- 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:
|
|
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(8000)
|
|
page.locator('.el-tabs__item:has-text("月报"):visible').first.click(); page.wait_for_timeout(15000)
|
|
page.locator('button:has-text("上月"):visible').first.click(); page.wait_for_timeout(1000)
|
|
page.locator('button:has-text("查询"):visible').first.click()
|
|
page.wait_for_selector('tr:has-text("孙庆方")', timeout=25000)
|
|
page.wait_for_timeout(2000)
|
|
row = page.locator('tr:has-text("孙庆方")').first
|
|
row.locator('button:has-text("绩效")').first.click(); page.wait_for_timeout(15000)
|
|
body = page.locator('body').inner_text()
|
|
keys = ['测试计划及时完成', '缺陷检出率', '线上BUG', '测试文档', '不规范行为']
|
|
miss = [k for k in keys if k not in body]
|
|
page.screenshot(path='tmp/pw_chg037_cs_sunqingfang.png', full_page=True)
|
|
print('[CS孙庆方]', 'PASS' if not miss else f'MISS:{miss}', '截图 tmp/pw_chg037_cs_sunqingfang.png')
|
|
b.close()
|
|
print('done')
|