Unified Cursor skills reference for STAF.UI.API automation. Links to all workflows and examples.
| Skill | When to Use | File | Details |
|---|---|---|---|
| UI Test | Adding test methods to existing actions | staf-ui-test/SKILL.md | Quick workflow for [TestMethod] in test classes |
| Page + Action | Creating new screen objects and flows | staf-page-action/SKILL.md | Full POM pattern: Page → Action → Test chain |
| API Test | REST API testing with RestSharp | staf-api-test/SKILL.md | Requests → DTOs → Test methods |
- Test:
STAFTests/Tests/ParaTests.cs— Login flow with multiple scenarios - Action:
STAFTests/Actions/Login.cs— Valid + invalid login, fluent returns - Pattern: Thin test calling action methods only
- Page:
STAFTests/Pages/LoginPage.cs— Locator definitions, XML docs - Action:
STAFTests/Actions/Login.cs+STAFTests/Actions/AboutUs.cs— Verification + navigation - Pattern: PageBaseClass → Action methods → Fluent chain returns
- Request:
STAFTests/Requests/CreateRequests.cs— Async RestSharp methods - DTO:
STAFTests/APIData/DummyJsonUsersDTO.cs— Response shapes - Test:
STAFTests/Tests/APITests.cs— MSTest + ReportResultAPI - Pattern: Request → Assert → Report
Single source of truth: docs/ai/AI_GUIDE.md
Contains:
- Full workflow descriptions (UI Test, Page+Action, API Test)
- Code patterns (navigation, finders, reporting, fluent chains)
- File structure reference
- Testing commands
- Framework class reference
- AI prompt examples
Quick start: docs/ai/QUICK_START.md
When: Adding a new test method.
Base Class: TestBaseClass
Files Created: STAFTests/Tests/{TestName}Tests.cs
[TestMethod]
public void LoginToApp_ValidCredentials_Success()
{
NavigateTo(TestContext.Properties["purl"].ToString());
new Login(driver, TestContext)
.LoginToApplication(user, pwd)
.VerifyAccountsOverviewPageisLoaded();
}See: staf-ui-test/SKILL.md | docs/ai/AI_GUIDE.md#workflow-1-ui-test
When: Creating a new screen / POM.
Base Classes: PageBaseClass (page), inherits page (action)
Files Created:
STAFTests/Pages/{Screen}Page.csSTAFTests/Actions/{Screen}.cs
Order:
- Page first (locators)
- Action second (flows)
- Update
docs/ai/ai-index.json
// Page
public class LoginPage : PageBaseClass
{
#region ObjectIdentifierValues
private string _tbUserName = "username";
#endregion
public IWebElement tbUserName => FindAppElement(By.Name(_tbUserName));
}
// Action
public class Login : LoginPage
{
public Login VerifyPageLoaded()
{
tbUserName.ReportElementIsDisplayed(Driver, context, nameof(VerifyPageLoaded), "Username field", false);
return this;
}
}See: staf-page-action/SKILL.md | docs/ai/AI_GUIDE.md#workflow-2-page--action
When: Testing REST APIs.
Base Class: TestBaseAPI
Files Created:
STAFTests/Requests/CreateRequests.cs(or extend)STAFTests/APIData/{ResponseShape}DTO.csSTAFTests/Tests/{Name}APITests.cs(or extendAPITests.cs)
Order:
- Request method (RestSharp async)
- DTO (response shape)
- Test method (arrange, act, assert + report)
// Request
public async Task<RestResponse<UsersDTO>> GetUsers(int page = 1)
{
var client = new RestClient("https://api.example.com");
var request = new RestRequest("/users", Method.Get);
request.AddParameter("page", page);
return await client.ExecuteAsync<UsersDTO>(request);
}
// DTO
public class UsersDTO
{
[JsonPropertyName("page")]
public int Page { get; set; }
}
// Test
[TestMethod]
public async Task GetUsers_Page1_ReturnsSuccess()
{
var response = await new CreateRequests().GetUsers(page: 1);
if (response.StatusCode != HttpStatusCode.OK)
{
ReportResultAPI.ReportResultFail(TestContext, nameof(GetUsers_Page1_ReturnsSuccess), "Expected 200");
Assert.Fail();
}
Assert.IsNotNull(response.Data);
ReportResultAPI.ReportResultPass(TestContext, nameof(GetUsers_Page1_ReturnsSuccess), "Success");
}See: staf-api-test/SKILL.md | docs/ai/AI_GUIDE.md#workflow-3-api-test
Starting a new task?
│
├─ "Create a test method"
│ └─→ UI Test Skill (staf-ui-test)
│ └─ Check: Page/Action already exists?
│ ├─ Yes: Just add [TestMethod] call existing actions
│ └─ No: First create Page+Action (see below)
│
├─ "Create a new screen / page object"
│ └─→ Page + Action Skill (staf-page-action)
│ └─ Create Page → Create Action → Update ai-index.json
│ └─ Then create tests (staf-ui-test)
│
├─ "Test a REST API"
│ └─→ API Test Skill (staf-api-test)
│ └─ Create Request → Create DTO → Create Test
│ └─ Report with ReportResultAPI
│
└─ "Refactor existing test away from raw WebDriver"
└─→ Page + Action Skill (staf-page-action)
└─ Extract locators → Create Page
└─ Create Action with flow methods
└─ Replace test with thin action calls
- ❌ No
new IWebDriver()in tests/pages — use inheriteddriver - ❌ No
Thread.Sleep(...)— useFindAppElement(auto-waits 10s) - ❌ No raw
By.*in tests — reference page properties only - ✅ Assertions in actions, not tests — tests call action methods
- ✅ File name = Class name —
LoginPage.cs→class LoginPage - ✅ Every step reports —
ReportResult(UI) orReportResultAPI(API) - ✅ Fluent returns — return
thisornew NextScreen(driver, context)
# Run specific test
dotnet test --filter "FullyQualifiedName~STAFTests.ParaTests.LoginToApp_ValidCredentials_Success" `
--settings STAFTests/testrunsetting.runsettings
# Run test class
dotnet test --filter "ClassName~MyTests" --settings STAFTests/testrunsetting.runsettings
# Build
dotnet build STAFTests/STAF.Selenium.Tests.csproj-
Reference a skill explicitly:
- "Using the staf-ui-test skill, create..."
- "Based on staf-page-action, add..."
-
Combine with golden files:
- "Use the pattern from
LoginPage.csandLogin.cs"
- "Use the pattern from
-
Ask for checklist:
- "Create a UI test. Before finishing, verify against the staf-ui-test checklist."
-
Cross-reference the guide:
- "Review docs/ai/AI_GUIDE.md#code-patterns for element finders"
-
Update
docs/ai/ai-index.json- Run:
pwsh tools/UpdateAiIndex.ps1 - Regenerates symbol index for agents
- Run:
-
Verify XML comments
- Public methods should have
/// <summary>blocks
- Public methods should have
-
Test locally
- Use commands above; verify pass/fail
-
Commit & push
- Files auto-update when merged to main
- This repository also has
.github/copilot-instructions.mdfor VS GitHub Copilot - Reference the same
docs/ai/AI_GUIDE.mdwhen using VS - All skills work identically across platforms
- Reference
.vscode/README.mdfor Copilot setup - Same skills as Cursor; use
Ctrl+Shift+Ifor Copilot Chat
- Cursor reads this folder (
.cursor/skills/) automatically - Use Cmd+K or Composer; reference skills by name
- Also reads
.cursor/cursor.rulesfor consistency rules
| Resource | Path | Purpose |
|---|---|---|
| Master AI Guide | docs/ai/AI_GUIDE.md | Comprehensive patterns, workflows, templates |
| Quick Start | docs/ai/QUICK_START.md | Platform navigation for new users |
| Symbol Index | docs/ai/ai-index.json |
Generated class/method reference |
| Cursor Rules | .cursor/cursor.rules | Consistency rules for Cursor |
| VS Code Setup | .vscode/README.md | GitHub Copilot config for VS Code |
| VS Instructions | .github/copilot-instructions.md | Visual Studio GitHub Copilot rules |
| NuGet Package | STAF.UI.API | Framework documentation |
- Check skill
.mdfiles are in.cursor/skills/{skill-name}/ - Ensure SKILL.md has proper frontmatter (name, description)
- Restart Cursor or reload the workspace
- Try typing skill name explicitly: "staf-ui-test: Create..."
- Check namespaces match existing code (
namespace STAFTests { }) - Verify
usingstatements are present (OpenQA.Selenium, STAF, STAF.CF) - Ensure inheritance is correct (TestBaseClass vs TestBaseAPI)
- Run
dotnet buildto get exact errors
- Verify element locators are correct (use browser DevTools)
- Check
testrunsetting.runsettingshas correct URL properties - Ensure
FindAppElementis used, notdriver.FindElement - Review
ReportResultcalls — they log errors
Last Updated: 2026-05-31
Framework Version: STAF.UI.API v4.4.0+
Target Framework: .NET 10
Applies To: Cursor, VS Code, Visual Studio