Files
claude-config/skills/ssw-e2e-test/README.md
T
ssw b7bffc1bd8 v0.11+ Phase C: 改写 .claude/ 提示词 (26 文件) - form lint/validate/fixcolumndata/--fields 全删
26 文件改动:
- CLAUDE.md: 删 form validate/fixcolumndata/--fields 例子, 改 --ai-json
- commands/ssw-h5dev-flow.md: 删阶段 2.5 lint 硬关卡, 改 --ai-json 路径
- commands/ssw-onlinedev.md: --fields → --ai-json
- skills/dacli-ts/SKILL.md + 6 references: 删 form lint/validate/fixcolumndata 段, --fields → --ai-json
- skills/dacli-ts/examples/{create-simple,create-master-sub,create-workflow}.sh: --fields → --ai-json
- skills/dacli-ts/scripts/self-check.sh: 删 form validate 调用
- skills/form-development/SKILL.md: 删 6 盲点必查, --fields → --ai-json, 删 type=4 兜底
- skills/data-management/SKILL.md: --fields → --ai-json
- skills/ssw-e2e-test/SKILL.md + README.md: 删 03_forms.py / crud_e2e_template.py / jnpf_client.py 引用
- skills/workflow-development/SKILL.md: 删直接 curl /api/workflow/task, 改用 dacli workflow 命令
- skills/menu-configuration/SKILL.md: 删 Python requests /api/system/Menu 兜底
- skills/data-interface/SKILL.md: 删 Python requests /dataInterface, 改用 dacli di create
- skills/code-generator/SKILL.md: 删 form validate 段
- skills/platform-mechanism/SKILL.md + references/jnpf-form-data-model.md: 删 f_description 段
- skills/no-spa-page/templates/{entity.java,module.js}: f_version/f_description → v0.11+ 自动 / f_app_desc

未追踪 baseline + commands/v0.11-cleanup.md + references/playwright.md 不入 commit (历史档案)

体检报告: dacli/docs/v0.11-audit-report.md
执行计划: dacli/docs/v0.11-cleanup-execution-plan.md
回滚: git revert HEAD (单 commit 安全回滚)
2026-06-26 10:45:18 +08:00

5.0 KiB

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)
│   ├── dacli_web_session.py  # Web session login/restore (v0.11+ 保留)
│   ├── jnpf_browser_e2e.py   # Browser E2E helper (v0.11+ 保留)
│   ├── lib/                  # TS/Python 双语言标准库 (v0.11+ 保留)
│   └── 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+