| name | staf-ui-test |
|---|---|
| description | Creates or edits STAF UI tests (TestBaseClass, MSTest, Action classes, NavigateTo, ReportResult). Use when adding UI test methods, Parabank/Google flows, or refactoring tests away from raw WebDriver. |
- Check
docs/ai/ai-index.jsonfor existing Page/Action - If missing → use skill staf-page-action first (create Page → Action)
- Add
[TestMethod]inSTAFTests/Tests/{Feature}Tests.csinheritingTestBaseClass - Arrange:
NavigateTo(TestContext.Properties["purl"].ToString())or action that navigates - Act/Assert: Chain action methods only; no
By.*selectors in test - Test:
dotnet test --filter "FullyQualifiedName~YourNamespace.ClassName.MethodName" --settings STAFTests/testrunsetting.runsettings
[TestMethod]
public void LoginToApp_ValidCredentials_Success()
{
// Arrange
NavigateTo(TestContext.Properties["purl"].ToString());
// Act & Assert (actions handle assertions via ReportResult)
new Login(driver, TestContext)
.LoginToApplication(
TestContext.Properties["userName"].ToString(),
TestContext.Properties["password"].ToString())
.VerifyAccountsOverviewPageisLoaded();
}- Inherits
TestBaseClass(not custom base, notTestBaseAPI) - Uses
driverfrom base — never constructed in test - No
Thread.Sleep— useFindAppElement(auto-waits) - No raw
By.*selectors — reference page properties only - Assertions delegated to action methods (via
ReportResult) - Test is thin — primarily calls action methods
- Test method name:
{Action}_{Scenario}_{Expected}(e.g.,LoginToApp_ValidCredentials_Success) - No duplicate method names on actions
| Platform | How to Use | Setup |
|---|---|---|
| Visual Studio | GitHub Copilot chat | See .github/copilot-instructions.md |
| VS Code | Copilot Chat (Ctrl+Shift+I) |
See .vscode/README.md |
| Cursor | Composer or Cmd+K | Reference this skill by name |
- Test:
STAFTests/Tests/ParaTests.cs— Parabank login flows - Action:
STAFTests/Actions/Login.cs— Valid/invalid login, fluent returns - Page:
STAFTests/Pages/LoginPage.cs— Element locators
📖 Master documentation: docs/ai/AI_GUIDE.md
Templates & examples: reference.md