AgentSkillsCN

red-selenium

按照TDD(红灯阶段)编写一项用例测试。采用三层架构(测试类 → 语句 → 作用域)创建测试。在用户想要创建用例测试,或提及“/red-usecase”命令时使用此功能。

SKILL.md
--- frontmatter
name: red-selenium
description: Write ONE Selenium browser test following TDD (red phase). Creates test extending AbstractUiTest with @Tag("frontend"). Use when user wants to create Selenium UI tests or mentions /red-selenium command.

/red-selenium - Write Selenium Browser Test (Red Phase)

Orchestrates red-agent for selenium layer.

Usage

code
/red-selenium "Story name" "Scenario name"
/red-selenium 2 "User sees registration form"
/red-selenium                                          # Interactive selection

CRITICAL TDD RULE

Test MUST be run WITHOUT @Disabled first to verify failure. Only after confirming failure is correct, add @Disabled annotation.

Prerequisites

  • Backend must be running (/run-backend)
  • Frontend must be running (/run-frontend)

Workflow

  1. Parse user input (story, scenario)
  2. Load agent instructions from .claude/agents/red-agent.md
  3. Load layer template from .claude/templates/frontend/selenium-test.md
  4. Execute the following steps:
    • Read story spec and mockups from ProductSpecification/
    • Analyze existing tests in acceptance/app-acceptance/
    • Predict expected failure (document before writing test)
    • Write ONE test extending AbstractUiTest with @Tag("frontend") WITHOUT @Disabled
    • Run test using Skill tool: skill="test-acceptance", args="frontend {TestClassName}"
    • Verify failure matches prediction
    • Add @Disabled with actual failure reason
    • Verify test is now SKIPPED
  5. Return result summary with predicted vs actual failure

Key Rules

  • ONE test per invocation
  • MUST verify failure before disabling
  • Extend AbstractUiTest with @Tag("frontend")
  • Use data-testid locators for element selection
  • Test via browser only (no direct API calls in test)
  • Use Skill tool for test execution (not gradle directly)

Expected Failure Patterns

Current ImplementationExpected Test Failure
No page/componentElement not found / timeout
Missing data-testidNoSuchElementException
Wrong navigationURL assertion failure
Missing form handlingInteraction failure

Story Mapping

#Story
01Login/Logout
02Registration
03Password Reset
04Connect Calendar
05Create Task
06Edit Task
07Delete Task
08Archive/Restore Task
09Task Detail View
10Activity Log
11Dashboard
12Billing & Subscription

Next Step

After red phase: /green-selenium "Story name" "Scenario name"