You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
78 lines
3.7 KiB
78 lines
3.7 KiB
|
1 day ago
|
# -*- coding: utf-8 -*-
|
||
|
|
"""票 13 快验:工商联想 NO_HIT / 导入过滤 / POOL-CFG 占位卡 / P3-3 / D-G1 注记"""
|
||
|
|
import io, json, sys
|
||
|
|
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8')
|
||
|
|
from playwright.sync_api import sync_playwright
|
||
|
|
|
||
|
|
URL = 'file:///E:/code/crm-backend-matt/.scratch/customer-demo-ref/demo/index.html'
|
||
|
|
errors = []
|
||
|
|
out = {}
|
||
|
|
with sync_playwright() as p:
|
||
|
|
b = p.chromium.launch()
|
||
|
|
pg = b.new_page(viewport={'width': 1720, 'height': 1080})
|
||
|
|
pg.on('pageerror', lambda e: errors.append(str(e)))
|
||
|
|
pg.goto(URL)
|
||
|
|
pg.wait_for_timeout(600)
|
||
|
|
pg.fill('#uidInput', '739564171091247104')
|
||
|
|
pg.evaluate('loginByUid()')
|
||
|
|
pg.wait_for_timeout(2500)
|
||
|
|
out['token'] = pg.evaluate('!!localStorage.getItem("e2c_token")')
|
||
|
|
|
||
|
|
# 1) 工商联想 NO_HIT(#24 真请求:stub 恒空数组)
|
||
|
|
out['lookup_raw'] = pg.evaluate('''async () => {
|
||
|
|
const arr = await api('/api/customer/company-lookup?companyName=' + encodeURIComponent('恒信达'));
|
||
|
|
return Array.isArray(arr) ? arr : ('type=' + typeof arr);
|
||
|
|
}''')
|
||
|
|
pg.evaluate('dlgCreate()')
|
||
|
|
pg.wait_for_timeout(200)
|
||
|
|
pg.fill('#cLk', '恒信达')
|
||
|
|
pg.evaluate('doLookup()')
|
||
|
|
pg.wait_for_timeout(1200)
|
||
|
|
out['lookup_no_hit'] = pg.eval_on_selector('#cOut', 'e => e.textContent.includes("未查询到匹配企业")')
|
||
|
|
out['lookup_stub_note'] = pg.eval_on_selector_all('#cOut [data-defect="STUB-LOOKUP"]', 'els => els.length')
|
||
|
|
pg.keyboard.press('Escape')
|
||
|
|
pg.wait_for_timeout(200)
|
||
|
|
|
||
|
|
# 2) 导入任务过滤(#63 真请求)
|
||
|
|
pg.click('nav.tabs button[data-tab="import"]')
|
||
|
|
pg.evaluate('loadImportPage()')
|
||
|
|
pg.wait_for_timeout(1200)
|
||
|
|
out['imp_all'] = pg.eval_on_selector_all('#impBody tr', 'els => els.length')
|
||
|
|
pg.select_option('#impFStatus', '2')
|
||
|
|
pg.wait_for_timeout(1200)
|
||
|
|
out['imp_status2_rows'] = pg.evaluate('''() => {
|
||
|
|
const trs = [...document.querySelectorAll('#impBody tr')];
|
||
|
|
return { n: trs.length, allDone: trs.every(tr => tr.textContent.includes('已完成') || tr.textContent.includes('暂无')) };
|
||
|
|
}''')
|
||
|
|
pg.select_option('#impFStatus', '')
|
||
|
|
pg.select_option('#impFMode', 'UPSERT')
|
||
|
|
pg.wait_for_timeout(1200)
|
||
|
|
out['imp_mode_upsert'] = pg.evaluate('''() => {
|
||
|
|
const trs = [...document.querySelectorAll('#impBody tr')];
|
||
|
|
return { n: trs.length, allUpsert: trs.every(tr => tr.textContent.includes('UPSERT') || tr.textContent.includes('暂无')) };
|
||
|
|
}''')
|
||
|
|
out['p3_3_note'] = pg.eval_on_selector_all('#tab-import [data-defect="P3-3"]', 'els => els.length')
|
||
|
|
|
||
|
|
# 3) POOL-CFG 占位卡(设置页)
|
||
|
|
pg.click('nav.tabs button[data-tab="settings"]')
|
||
|
|
pg.wait_for_timeout(200)
|
||
|
|
out['pool_cfg'] = pg.eval_on_selector_all('#tab-settings [data-defect="POOL-CFG"]', 'els => els.length')
|
||
|
|
out['pool_disabled'] = pg.evaluate('''() => {
|
||
|
|
const inputs = [...document.querySelectorAll('#tab-settings [data-defect="POOL-CFG"]')];
|
||
|
|
const panel = inputs[0] ? inputs[0].closest('.panel') : null;
|
||
|
|
return panel ? [...panel.querySelectorAll('input')].every(i => i.disabled && i.readOnly) : false;
|
||
|
|
}''')
|
||
|
|
|
||
|
|
# 4) D-G1 注记(详情页签联系人工具栏)
|
||
|
|
pg.click('nav.tabs button[data-tab="detail"]')
|
||
|
|
pg.wait_for_timeout(200)
|
||
|
|
out['dg1_note'] = pg.eval_on_selector_all('[data-defect="D-G1"]', 'els => els.length')
|
||
|
|
# 5) F6 stub 钩子(列表 tab)
|
||
|
|
pg.click('nav.tabs button[data-tab="list"]')
|
||
|
|
pg.wait_for_timeout(200)
|
||
|
|
out['f6_stub_hook'] = pg.eval_on_selector_all('[data-defect="STUB-LOOKUP"]', 'els => els.length')
|
||
|
|
pg.screenshot(path='E:/code/crm-backend-matt/.scratch/customer-demo-ref/demo/shots/t13-quick-settings.png')
|
||
|
|
b.close()
|
||
|
|
out['pageerror'] = errors
|
||
|
|
print(json.dumps(out, ensure_ascii=False, indent=1))
|