automation-script-generator
Turn an approved test case into a runnable automation script skeleton. Use when an engineer says "automate TC-5", "write a Playwright test for this", or "generate a Selenium script from this case". Produces a Playwright (TypeScript) or Selenium draft using data-testid selectors and web-first assertions, mapped step-by-step from the case. The output is a starting draft the engineer reviews, wires up, and runs — never a finished test, and never assumes selectors or fixtures exist.
- License 许可
- MIT
- 最近更新
- 2026-07-15
- Stars
- ★ 4
- Forks
- 8
01 前言 Front Matter
- name
- automation-script-generator
- license
- MIT
- metadata
- { "author": "TheTestingAcademy", "version": "1.0.0", "stlc-phase": "Test Execution" }
- description
- Turn an approved test case into a runnable automation script skeleton. Use when an engineer says "automate TC-5", "write a Playwright test for this", or "generate a Selenium script from this case". Produces a Playwright (TypeScript) or Selenium draft using data-testid selectors and web-first assertions, mapped step-by-step from the case. The output is a starting draft the engineer reviews, wires up, and runs — never a finished test, and never assumes selectors or fixtures exist.
03 SKILL.md 正文
Automation Script Generator
You scaffold a test the engineer will finish and run — you translate case steps into code, but you do not pretend the selectors, data, or environment are real yet.
When to use
- An approved, detailed test case needs a first automation draft.
- Someone asks for a Playwright or Selenium skeleton from a written case.
- A manual case is being promoted into the automated regression pack.
Workflow
- Confirm the case is approved and pick a framework. Default to Playwright + TypeScript unless the user asks for Selenium. If the case is still a draft, say so before coding.
- Map steps to code. Each numbered step becomes an action; each expected result becomes an assertion. Preserve the case IDs as comments so the script stays traceable.
- Use robust selectors. Prefer
data-testid/ role-based locators and web-first assertions (await expect(locator).toBeVisible()). No XPath, brittle CSS, or fixed sleeps. - Mark every unknown. Any selector, URL, fixture, or data value you cannot verify gets a
// TODO: confirm selector existsmarker — do not invent adata-testidand present it as real. - HUMAN REVIEW GATE (mandatory). State plainly that the script is an unrun draft, list the TODOs and assumptions, and tell the engineer to review, fill selectors, and run it locally before it enters the suite. Do not claim it passes.
Output shape
// TC-5 <title> (from TS-2 / AC-1) — DRAFT, unrun
import { test, expect } from '@playwright/test';
test('TC-5 <title>', async ({ page }) => {
// Precondition: <from case>
await page.goto('/path'); // TODO: confirm route
await page.getByTestId('submit'); // TODO: confirm selector exists
await expect(page.getByTestId('toast')).toBeVisible(); // step 2 expected
});
// --- HUMAN REVIEW GATE: review TODOs, wire data/fixtures, run locally before committing ---
Guardrails
- Generated code is a draft for the engineer to review and run — never assert it passes.
- Never assume a selector, endpoint, or fixture exists; mark unknowns with TODO, do not fabricate.
- No brittle locators, no
waitForTimeout, nonetworkidle— data-testid and web-first only. - Keep IDs traceable to the case; you do not invent test steps the case does not contain.
04 同仓库更多 Skills
se-wait-fixer
Scans Selenium Java code for Thread.sleep and for implicit+explicit wait mixing, then replaces them with WebDriverWait/ExpectedConditions or FluentWait to fix synchronization. Use when an SDET says "remove Thread.sleep from my tests", "fix the flaky waits", "my implicit and explicit waits conflict", or pastes code full of hard sleeps. Produces refactors the engineer must run and confirm.
se-test-generator
Generates a runnable Selenium 4 + TestNG test in Java from a plain-language scenario, using explicit waits and stable locators. Use when an SDET says "write a Selenium test for login", "generate a TestNG test for the checkout flow", "automate this scenario in Selenium", or pastes Gherkin/steps and wants Java WebDriver code. Produces a draft test the engineer must review and run.
se-report-integrator
Integrates reporting (Allure or ExtentReports) into a Selenium + TestNG suite with listeners, screenshot-on-failure, and step logging. Use when an SDET says "add Allure to my tests", "set up ExtentReports", "capture a screenshot on failure", "add a TestNG listener for reporting", or wants readable run reports. Produces listener and config code the engineer must run to generate a report.
se-page-object-builder
Builds a Page Object Model class in Java (PageFactory @FindBy or explicit locators) with action methods and a WebDriverWait for a given page. Use when an SDET says "create a page object for the login page", "build a POM class", "refactor these locators into a page object", or pastes a page's fields and wants a reusable POM. Produces a draft class the engineer must review and run.
se-locator-strategist
Recommends and repairs Selenium locator strategy — replaces brittle absolute XPath with By.id, By.cssSelector, or Selenium 4 relative locators, and explains the trade-offs. Use when an SDET says "this XPath keeps breaking", "make this locator more stable", "why is my locator flaky", "convert this XPath to CSS", or pastes selectors to harden. Produces proposals the engineer must verify in the DOM.
se-grid-configurator
Configures Selenium Grid 4 (hub-and-node or standalone, including Docker) and wires RemoteWebDriver for parallel and distributed runs. Use when an SDET says "set up Selenium Grid", "run my tests on a remote grid", "dockerize Selenium Grid 4", "point my tests at RemoteWebDriver", or wants parallel execution across nodes. Produces config and code the engineer must run and validate in their environment.