Files
claude-config/skills/ssw-e2e-test
ssw 4303cad485 tds2 阶段5B E2E: 28/28 TC PASS, 44 张截图
- scripts/e2e_browser.py: 浏览器层 B-TC (10) + Dashboard (7) + 11 阶段 E2E (11) = 28 TC
- e2e_report.md: 100% PASS 报告 + 5 盲点防御状态
- 44 截图归档: 30 B-TC + 3 DASH + 11 E2E
- BS-31 (label) PASS: 中文 label 正常渲染 (fonts-noto-cjk OK)
- BS-15/23/50/V2 PASS: 9 系统列 / 列数 ≤5 / columnList 自动 / dict 引用
- 防御已知 JNPF 缺陷: form create datePicker format 需手动 patch, dict enCode 冲突需唯一名
2026-06-21 10:46:44 +08:00
..
2026-05-18 09:28:27 +08:00
2026-05-18 09:28:27 +08:00
2026-05-18 09:28:27 +08:00
2026-05-18 09:28:27 +08:00

SSW E2E Test Skill

E2E testing toolkit for jnpf low-code platform using Playwright.

Installation

Prerequisite: Install webapp-testing skill first (ssw-e2e-test extends it):

# Clone webapp-testing skill
cd ~/.claude/skills
git clone https://github.com/anthropics/skills.git temp_skills
cp -r temp_skills/skills/webapp-testing .
rm -rf temp_skills

# Or manually download from:
# https://github.com/anthropics/skills/tree/main/skills/webapp-testing

Configuration

IMPORTANT: All configuration is via environment variables. Do not hardcode values.

# Required
export JNPF_HOST="192.168.1.18:13880"      # jnpf server address
export JNPF_APP_CODE="dr"                    # app code (dr, workSystem, etc.)
export JNPF_USERNAME="admin"                 # username
export JNPF_PASSWORD="123456"               # password

# Optional
export JNPF_TEMP_DIR="/tmp/jnpf_test"       # temp directory

Structure

ssw-e2e-test/
├── SKILL.md           # Main skill documentation
├── README.md          # This file
├── LICENSE.txt       # MIT License
├── scripts/
│   ├── config.py          # Configuration loader (env vars)
│   ├── jnpf_client.py     # High-level API client
│   └── with_server.py     # Server lifecycle (from webapp-testing)
├── examples/
│   ├── real_crud_test.py       # Full CRUD workflow
│   ├── use_vxe_selectors.py     # vxe-table selector patterns
│   ├── explore_login_and_menu.py # Login + menu exploration
│   └── analyze_add_modal.py     # Form field analysis
└── docs/
    └── 平台测试方法.md          # Platform testing methodology

Quick Start

from scripts.config import get_config
from scripts.jnpf_client import JnpfClient

# Load configuration
config = get_config()

# Use client
with JnpfClient() as client:
    client.login()
    client.click_menu("数据资产台账")
    client.crud.add("资产名称", "测试数据")

Run Examples

# Set environment variables first
export JNPF_HOST="192.168.1.18:13880"
export JNPF_APP_CODE="dr"
export JNPF_USERNAME="admin"
export JNPF_PASSWORD="123456"

# Run CRUD test
python examples/real_crud_test.py

# Run menu exploration
python examples/explore_login_and_menu.py

Key Patterns

Pattern Selector
vxe-table rows .vxe-body--row
Modal form .ant-modal
Delete confirm .ant-modal-confirm
Menu items .jnpf-menu-item
Click hidden element page.evaluate('el => el.click()', handle)
Dropdown (ant-select) .ant-select + .ant-select-dropdown:visible
Form field by ID input#f_field_name
Form field by label input[fullname="字段名称"]

API Testing

Token 通过 UI 登录自动获取,然后可用于 API 请求:

# See docs/api-testing.md for full API patterns
import os
from docs.api_testing import JnpfApiClient

# 方式1: 自动 UI 登录获取 token
client = JnpfApiClient.from_ui_login(
    host=os.environ["JNPF_HOST"],
    app_code=os.environ["JNPF_APP_CODE"]
)

# 方式2: 手动传入已获取的 token
client = JnpfApiClient(
    host=os.environ["JNPF_HOST"],
    app_code=os.environ["JNPF_APP_CODE"],
    token="bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9..."
)

# API 查询
result = client.query_list(model_id, menu_id)
print(f"Total: {result['data']['pagination']['total']}")

Hybrid approach: Use UI for login/navigation, API for data operations.

Critical Patterns Discovered Through Testing

1. Dropdown Selection (ant-select)

# Click the dropdown trigger
page.evaluate('el => el.click()', selects[0].element_handle())
time.sleep(1)

# Wait for and click the option
dropdown = page.locator('.ant-select-dropdown:visible')
dropdown.first.locator('.ant-select-item').nth(0).click()

2. Form Field Identification

# Fields have fullname attribute with Chinese label
input#f_asset_name
input#f_category_code
input#f_applicant

# Or use placeholder
input[placeholder="请输入申请人"]

3. Save Success Detection

# CRITICAL: Check BOTH modal closed AND data saved
initial_count = page.locator('.vxe-body--row').count()
save_btn.click()
time.sleep(3)

modal_closed = page.locator('.ant-modal').count() == 0
data_saved = page.locator('.vxe-body--row').count() > initial_count

if not modal_closed and data_saved:
    # This happens! Modal stays open but data IS saved
    print("Save succeeded but modal didn't close")

Known Issues

Issue Workaround
Dropdown click intercepted Use JS click via page.evaluate()
Modal doesn't close after save Check data saved, not just modal state
Unknown form field IDs Use fullname attribute or explore modal first
Partial menu text matches many Use exact menu name

Dependencies

  • playwright
  • Python 3.8+