Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx agentmods add rules/antdigital-ai/agentic-ui/playwrightgit clone --depth 1 https://github.com/antdigital-ai/agentic-uiWhat it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5 | $0.00000 | $0.02559 |
| Opus 5 | $0.00000 | $0.01280 |
| Sonnet 5 | $0.00000 | $0.00512 |
| Haiku 4.5 | $0.00000 | $0.00256 |
Grade A, and why
playwright scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
How it starts
The opening of the file, as written. The whole thing — 236 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Playwright 自动化测试编写规范:构建高稳定性(Flaky-Free)的测试体系
1. 核心原则:为何测试会失败?
在制定规范前,需明确 Playwright 测试失败的三大核心根因。编写"高成功率"测试的本质,就是通过规范消除这三个变量:
竞态条件 (Race Conditions)
脚本执行速度快于页面渲染速度(如点击了尚未绑定事件的按钮)。
DOM 易变性 (DOM Volatility)
页面结构或样式变化导致选择器失效。
环境不确定性 (Environmental Flakiness)
网络延迟、API 500 错误或第三方服务宕机。
本规范将围绕**"确定性执行 (Deterministic Execution)"**这一目标展开。
2. 目录结构与命名规范 (TypeScript)
采用**领域驱动(Domain-Driven)**结构,将测试与业务逻辑解耦。推荐使用 TypeScript 以获得强类型支持,这直接关联到代码维护的稳定性。
2.1 推荐目录结构
tests/
├── e2e/
│ ├── auth.setup.ts # 全局认证设置(生成 storageState)
│ ├── checkout/ # 业务模块目录
│ │ ├── guest-checkout.spec.ts
│ │ └── payment-flow.spec.ts
│ └── dashboard/
│ └── analytics.spec.ts
├── fixtures/ # 自定义测试夹具 (Dependency Injection)
│ ├── db-fixture.ts # 数据库操作封装
│ └── page-fixture.ts # Page Object 自动注入
├── pages/ # Page Object Models (POM)
│ ├── CheckoutPage.ts
│ └── components/ # 可复用组件 (如 DatePicker, Modal)
├── test-data/ # 静态测试数据
├── playwright.config.ts # 全局配置
└── .eslintrc.json # 强制代码规范配置
2.2 命名规范
- 文件命名:使用 kebab-case,后缀为
.spec.ts。例如user-login.spec.ts。 - 类命名 (POM):使用 PascalCase。例如
LoginPage,ShoppingCartPage。 - 测试标题:必须表达业务价值而非操作细节。
- ❌
test('click button and check div') - ✅
test('should display order confirmation after successful payment')
- ❌
3. 高稳定性选择器策略 (Selector Strategy)
稳定性黄金法则:测试应当像用户一样通过"视觉"和"内容"来寻找元素,严禁依赖页面内部实现(CSS 类名、XPath)。
3.1 优先级金字塔
请严格按照以下顺序选用 Locator:
page.getByRole() (最高优先级)
理由:它是最稳定的选择器。它模拟用户和辅助技术(Screen Readers)的交互。如果页面样式变了但功能没变(例如"登录"按钮变成了一个图标但 ARIA 角色还是 button),测试依然通过。
示例:
await page.getByRole('button', { name: 'Submit' }).click();
page.getByText()
理由:适用于非交互性文本内容的验证。
示例:
await expect(page.getByText('Welcome, User')).toBeVisible();
page.getByTestId() (特定场景)
理由:当元素没有任何语义(如纯 div 容器)且必须定位时使用。需在前端代码中添加 data-testid 属性。
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 2d ago First seen · 236 lines · 2,559 tokens per session scan A b3ee73bf5cec
playwright is a cursor rule published in the GitHub repository antdigital-ai/agentic-ui (224 stars, last pushed 21d ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 2,559 tokens. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.
Other cursor rules, from other repositories
cursor
You are working on the checkout service. Preserve transaction integrity and auditability.
pro-deck-builder
Create polished HTML slide decks and PDF-ready documents for consulting deliverables. Uses the RRBC design system with warm light mode, dark mode cover pages, Lora/Inter/Roboto Mono typography, and data visualization palette. Trigger on 'deck', 'slides', 'presentation', 'pitch deck', 'keynote', 'report', or 'PDF'.
release-notes
Generate changelog entries and GitHub releases from git history. Categorizes commits into features, fixes, breaking changes, and docs. Supports conventional commits, PR-based grouping, and semantic versioning. Creates formatted CHANGELOG.md entries and GitHub releases.
facebook-ads
Meta Ads (Facebook & Instagram) platform expertise. Audit campaigns, audiences, creative strategy, pixel tracking, and CAPI. Use when the user asks about Facebook Ads, Instagram Ads, Meta Ads, social media advertising, Advantage+ campaigns, or Meta pixel/CAPI setup.
paddle-integration
Conventions for Paddle integration code.
faststore-faststore-storefront-ref-project-structure-routes-and-config
FastStore project structure, routes, CLI build pipeline, store configuration (discovery.config.js), and naming conventions. Use when understanding how a FastStore project is organized, how the @faststore/cli works, what files to create or modify, how routing works, or how to configure store settings like SEO, API…