selenium-ui-test-generatorlisted
Install: claude install-skill timwukp/agent-skills-best-practice
# Selenium UI Test Generator
**Cost warning:** UI tests cost 30-50 credits each (vs. 10-15 for unit tests). Always inform the user of this before generating.
## Instructions
### Step 1: Flow Selection
Ask the user to pick **2-3 critical flows maximum** (e.g., login, form submission, checkout). Provide cost comparison so they can make an informed choice.
### Step 2: Get Selectors Upfront
**This is critical for avoiding wasted iterations.** Ask the user to provide:
1. `data-testid` attributes (preferred)
2. Or element IDs/classes from browser dev tools
Without real selectors, tests will likely fail and waste credits. If the user cannot provide selectors, warn them of the higher failure risk before proceeding.
See `references/react-testid-guide.md` for the recommended `data-testid` pattern.
Load selectors from `assets/selectors-config.json` when available.
### Step 3: Generate ONE Test at a Time
Unlike unit/API skills, generate only **1 UI test per iteration** due to the high cost.
Use explicit waits and `data-testid` selectors:
```java
@Test
void testUserLogin() {
driver.get("http://localhost:3000/login");
WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(10));
wait.until(ExpectedConditions.presenceOfElementLocated(
By.cssSelector("[data-testid='login-form']")
));
driver.findElement(By.cssSelector("[data-testid='username-input']"))
.sendKeys("testuser@example.com");
driver.findElement(By.cssSelector("[data-tes