32 lines
1.9 KiB
Python
32 lines
1.9 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(5000)
|
|
page.locator('.el-select:visible').nth(1).click(); page.wait_for_timeout(1500)
|
|
page.locator('.el-select-dropdown:visible li:has-text("139")').first.click(); page.wait_for_timeout(1000)
|
|
page.locator('button:has-text("上月"):visible').first.click(); page.wait_for_timeout(1000)
|
|
page.locator('button:has-text("查询"):visible').first.click(); page.wait_for_timeout(8000)
|
|
row = page.locator('tr:has-text("魏冬霞")').first
|
|
if not row.count():
|
|
page.screenshot(path='tmp/pw_cpjl_139_list.png', full_page=True)
|
|
print('魏冬霞仍无行,列表截图 tmp/pw_cpjl_139_list.png')
|
|
b.close(); raise SystemExit(0)
|
|
row.locator('button:has-text("绩效")').first.click(); page.wait_for_timeout(15000)
|
|
body = page.locator('body').inner_text()
|
|
keys = ['需求PRD工作量指标完成率', '项目准时率', '产品缺陷率', '问题响应和解决']
|
|
miss = [k for k in keys if k not in body]
|
|
page.screenshot(path='tmp/pw_cpjl_weidongxia.png', full_page=True)
|
|
print('[CPJL魏冬霞]', 'PASS' if not miss else f'MISS:{miss}')
|
|
b.close()
|
|
print('done')
|