Skip to content
Testing
Skill

/save-verify-strategy

表单保存后验证(Toast / 重定向 / 数据对比 / 富文本清空)。触发:保存验证、toast、重定向检测、Meta+A、保存成功判断。

From plugin
velocitai
15813 skills1 agent2 hooks

Claude Code

$ npx -y skills add danielsuo117/velocitai --skill save-verify-strategy --agent claude-code

SKILL.md

save-verify-strategy.SKILL.md
name: save-verify-strategy
description: 表单保存后验证(Toast / 重定向 / 数据对比 / 富文本清空)。触发:保存验证、toast、重定向检测、Meta+A、保存成功判断。

表单保存验证策略

---

一、macOS 富文本编辑器全选

macOS 上富文本编辑器的全选按键差异(Control+A 无效)→ [references/macos-select-all.md](./references/macos-select-all.md)

二、保存后验证策略:三级选择

| 保存后行为 | 验证方式 | 可靠性 | 适用场景 | |-----------|---------|--------|---------| | 显示 Toast | `is_visible(toast_locator)` — 必须在 networkidle 后**立即**检测 | 低(2-3s 消失) | 有明确 Toast 的场景 | | 页面重定向 | 检测编辑页特征元素消失 `wait_for(state="hidden")` | 中(持久状态) | 保存后自动跳转的场景 | | 无 UI 反馈 | 写入标记数据 → 重新打开 → 读取对比 | 高(数据级验证) | 无 Toast、不确定是否重定向 |

**原则**:三级可组合使用。优先用持久状态变更,Toast 仅作辅助。

2.1 Toast 时序陷阱

`click_save()` 方法中的 `wait_for_timeout()` 会消耗 Toast 存活时间。**必须**在 networkidle 后立即检测 Toast,不能先等待再检测。

❌ 反例:

def click_save(self):
    self.click(self.SAVE_BTN)
    self.page.wait_for_load_state("networkidle")
    self.page.wait_for_timeout(3000)   # Toast 在这 3s 内出现又消失了

# 调用方
assert page.is_visible(toast)          # Toast 已消失,永远 False

✅ 正例:

def click_save(self):
    self.click(self.SAVE_BTN)
    self.page.wait_for_load_state("networkidle")
    # 不加额外等待 — 让调用方立即检测 Toast

# 调用方
is_ok = page.is_visible(toast, timeout=10000)   # 立即开始等 Toast
page.wait_for_timeout(3000)                      # 检测完再等页面稳定

2.2 重定向检测

保存后页面可能重定向离开编辑页。通过检测编辑页**特征元素消失**来确认保存成功:

def is_save_success(self) -> bool:
    """编辑页 header 消失 = 保存成功并已离开编辑页"""
    try:
        self.page.locator(self.EDIT_PAGE_HEADER).first.wait_for(
            state="hidden", timeout=15000
        )
        return True
    except Exception:
        return False

2.3 重定向目的地不可假设

保存后的重定向目的地可能因**导航上下文**不同而异(直接 URL 访问 vs SPA 内跳转 vs 新 tab 中操作)。不要断言重定向到某个特定页面。

❌ 反例:

# 假设保存后一定重定向到首页
redirected_home = HomePage(page)
assert redirected_home.is_page_loaded()   # 实际可能跳到其他页面

✅ 正例:

# 只验证离开了编辑页,不假设去了哪里
assert edit_page.is_save_success()        # 编辑页 header 消失 = 保存成功

---

三、多 tab 保存后:关闭旧 tab,从原始 tab 重入

保存动作发生在新开 tab 中时的处理 → [references/multi-tab-reentry.md](./references/multi-tab-reentry.md)

四、数据对比验证模式(最终验证)

保存前后做数据比对的实现方式 → [references/data-comparison.md](./references/data-comparison.md)

Read more
@danielsuo117
Ships withvelocitai

Next-generation UI automation harness powered by Python & Playwright. Chat with AI Agents to seamlessly generate, architect, and execute enterprise-grade UI test code.

15813 skills1 agent
Get the whole plugin

Stars on GitHub

Momentum

stars in total
158
Star history of danielsuo117/velocitai on GitHub, a chart by star-history.com

Other skills on velocitai.

add-regression-point

add-regression-point

为已有 PageObject 增量添加回归测试点。触发:新增测试点、添加回归点、add test point、增加覆盖、扩展页面方法。

architecture

architecture

POM 分层与 context 共享决策树。触发:架构、分层、POM、Page Object、基类设计、新增角色。

browser-config

browser-config

浏览器 viewport / headless / 超时分层配置。触发:viewport、浏览器配置、导航超时、headless、slow_mo、incognito。

case-round-trip

case-round-trip

共享 page 下用例离开起点后必须 UI 返回并断言。触发:往返闭合、case round trip、复位超时、scope 共享 page。

code-review-graph

code-review-graph

AST 知识图谱:变更审查、探索、调试、重构。触发:知识图谱、代码审查、影响分析、爆炸半径、重构。

gen-page-test

gen-page-test

一键生成 PageObject + 配套测试。触发:新增页面、生成页面、gen page、create page、添加页面对象。

More skills from other plugins.

api-review

api-review

Produce the "Playwright 1.xx API Review" artifact for a range of commits - the public API additions and the breaking or behavior…

playwright13d100k
@microsoft@microsoftInstall Skill
add-e2e-selectors

add-e2e-selectors

Add reliable @grafana/e2e-selectors to interactive elements and key containers in the Grafana frontend. Use when adding e2e…

grafana13d78k
@grafana@grafanaInstall Skill
promptfoo-evals

promptfoo-evals

Write, refine, run, and QA promptfoo evaluation suites: promptfooconfig.yaml, prompts, providers, vars, tests, assertions,…

@promptfoo@promptfooInstall Skill
deepeval

deepeval

DeepEval evaluation workflow for AI agents and LLM applications. TRIGGER when the user wants to evaluate or improve an AI agent,…

@confident-ai@confident-aiInstall Skill

Questions about save-verify-strategy.

Which coding agents can use save-verify-strategy?
save-verify-strategy installs in Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, OpenCode and Windsurf with the skills CLI, using each agent's flag shown on this page. Flowy's auto-invocation, which fires a skill when your prompt matches, runs in Claude Code only.