diff --git a/.cursor/skills/csharp-configuration/SKILL.md b/.cursor/skills/csharp-configuration/SKILL.md deleted file mode 100644 index 931343b..0000000 --- a/.cursor/skills/csharp-configuration/SKILL.md +++ /dev/null @@ -1,53 +0,0 @@ ---- -name: csharp-configuration -description: >- - C# application configuration management standards using Consul. Covers config - files, Consul key/value store, service discovery, machine name usage, what to - make configurable. Use when setting up application configuration, deciding - where to store settings, working with Consul, or managing environment-specific - config in C#/.NET projects. ---- - -# C# Configuration Standards - -## Config files: only for Consul bootstrap and secrets - -For new projects, `web/app.config` should only contain: - -- Settings to connect to Consul -- Sensitive data not allowed in Consul (e.g., production passwords) - -All other settings go in Consul. Existing projects should consider migrating. - -## Use Consul for configuration - -Consul is deployed in all datacenters for application settings. Use it for all new applications. Use the `config-consul` library for simplified bootstrapping, configuration hierarchy, audit trail, and resilience features. - -## Consul Key/Value store - -Use for anything that is not: - -- A server IP/hostname (use service discovery instead) -- Sensitive data like production passwords (use config files) - -## Use Consul service discovery for server addresses - -Server IPs and DNS entries must use Consul's service discovery feature, not the Key/Value store. - -## Do not use `MachineName` - -`MachineName` couples code to infrastructure naming which can change. Code should be environment/DC/cluster/server agnostic. Use Consul service discovery for environment-specific configuration. - -**Exception**: logging, where machine name helps identify the exact server. - -## If unlikely to change, don't make it configurable - -Values that won't change across environments or time should be constants, not config. - -```c# -// Don't — in config file - - -// Do — as constant -public const string SSR_PAGE_URL = "/{0}pages/agoda/default/DestinationSearchResult.aspx?asq={1}"; -``` diff --git a/.cursor/skills/csharp-gui-testing/SKILL.md b/.cursor/skills/csharp-gui-testing/SKILL.md deleted file mode 100644 index 541b00c..0000000 --- a/.cursor/skills/csharp-gui-testing/SKILL.md +++ /dev/null @@ -1,93 +0,0 @@ ---- -name: csharp-gui-testing -description: >- - C# GUI/Selenium testing standards. Covers CSS selectors over XPath, - data-selenium attributes for element identification, Page Object Model - pattern. Use when writing or reviewing Selenium-based GUI tests, browser - automation tests, or UI test infrastructure in C#. ---- - -# C# GUI Testing Standards - -## Use CSS selectors, not XPath - -XPath is unfamiliar to most developers and adds noise. Since we identify elements with `data-selenium`, CSS selectors are sufficient. - -```c# -// Don't -Driver.FindElements(By.XPath(".//*[@data-selenium='hotel-item']")); - -// Do -Driver.FindElements(By.CssSelector("[data-selenium=hotel-item]")); -``` - -## Use `data-selenium` attribute for element identification - -Decouple tests from HTML structure and CSS classes. Identify elements with a dedicated `data-selenium` attribute. - -```html - -
- -
-``` - -```c# -Driver.FindElement(By.CssSelector("form button.login-button")); -``` - -```html - -
- -
-``` - -```c# -Driver.FindElement(By.CssSelector("[data-selenium=login-button]")); -``` - -## Use Page Object Model - -Isolate test code from the GUI with the Page Object pattern. All selectors and page-specific interactions live in a Page Object class. - -```c# -// Don't — selectors and URLs hard-coded in tests -[Test] -public void LoginButton_WhenClicked_FocusesUsernameTextbox() -{ - Driver.Navigate().GoToUrl("https://qa-site/home.html"); - var button = Driver.FindElement(By.CssSelector("[data-selenium=show-login-button]")); - button.Click(); - // ... -} - -// Do — abstracted into a Page Object -public class HomePageObject : PageObjectBase -{ - private const string URL = "https://qa-site/home.html"; - - public void Navigate() => Navigate(URL); - - public IWebElement ShowLoginFormButton => - Driver.FindElement(By.CssSelector("[data-selenium=show-login-button]")); - - public IWebElement UsernameTextBox => - Driver.FindElement(By.CssSelector("[data-selenium=username-textbox]")); -} - -[Test] -public void LoginButton_WhenClicked_FocusesUsernameTextbox() -{ - var homePage = new HomePageObject(); - homePage.Navigate(); - homePage.ShowLoginFormButton.Click(); - Assert.IsTrue(homePage.IsFocused(homePage.UsernameTextBox)); -} -``` - -Benefits: - -- HTML/CSS changes only require Page Object updates, not test changes -- Clean, abstract API for interacting with pages -- Page Object should let a software client do anything a human can