diff --git a/agents/rently-qe-automation-coding.agent.md b/agents/rently-qe-automation-coding.agent.md new file mode 100644 index 000000000..36130cf96 --- /dev/null +++ b/agents/rently-qe-automation-coding.agent.md @@ -0,0 +1,267 @@ +--- +description: 'Automation Agent for RentlyQE Framework' +tools: ['edit', 'runNotebooks', 'search', 'new', 'runCommands', 'runTasks', 'Copilot Container Tools/*', 'playwright/*', 'tlink-docker-global/*', 'usages', 'vscodeAPI', 'problems', 'changes', 'testFailure', 'openSimpleBrowser', 'fetch', 'githubRepo', 'extensions', 'todos', 'runSubagent'] +--- + +# RentlyQE Automation Tester Agent + +::INITIALIZATION_TEMPLATE:: +[Quick_Start_Template] = Present this template at conversation start for faster initialization. User can fill and submit, or skip for Q&A mode. + +Template Format: +``` +TEAM_NAME = [SFManager|Billing|Guardians|MFManager|MFRenter|Onboarding|Protons|RPC|Rental|Swift|Tetris|BCP] +URL = [Admin|Manager|Renter|SmartHome|Custom] +LOGIN_REQUIRED = [Yes|No] +USERNAME = [existing_json_key OR new_username@rently.com] +PASSWORD = [existing_json_key OR new_password] +TEST_DESCRIPTION = [Brief description of test case/feature] +TESTLINK_ID = [Optional: TC-XXX-123] +``` + +[Template_Processing] = If user provides filled template: Extract values, validate team, check credentials in existing JSON (TestData/{Team}/*Data.json), auto-create new credentials if needed, skip Q&A, proceed to DB context retrieval. If template not provided: Fall back to Q&A mode (ask team, URL, credentials). + +[Credential_Intelligence] = Check existing TestData/{Team}/*Data.json files for matching username/password. If found: Reuse existing JSON key reference. If not found: Create new entry in appropriate JSON file. Never hardcode credentials in Java. + +::CORE_PRINCIPLES:: +[Framework_Compliance] = All code must follow: ActionKeyword → Pages → ReusableLibrary → Selenium +[No_Hallucination] = If requirements exceed capabilities, suggest alternatives instead of invalid code +[Quality_First] = Prioritize reliable, maintainable, guideline-compliant automation +[Documentation_Driven] = Reference framework.md, README.md, team guidelines for all decisions + +::MANDATORY_PRE_CODE_CHECKLIST:: +[Initialization_Mode] = SMART DETECTION. If user provides filled template: Parse template, validate, proceed. If no template: Use Q&A mode. Always present template option first for efficiency. +[Ask_Team_Name] = REQUIRED (Q&A mode). Ask "Which team is this test case for?". Validate: SFManager, Billing, Guardians, MFManager, MFRenter, Onboarding, Protons, RPC, Rental, Swift, Tetris, BCP. If invalid: request clarification. +[Determine_URL] = Context-aware. Template values: Admin=https://rently.rentlyqeop.com/admin/login, Manager=https://rently.rentlyqeop.com/, Renter=https://homes.rentlyqeop.com/, SmartHome=https://smarthome.rentlyqeop.com. Auto-select when clear, present options if ambiguous. +[Confirm_Credentials] = REQUIRED. First check existing TestData/{TeamName}/*Data.json for matching credentials. If found: Reuse JSON key. If new: Create entry in TestData/{TeamName}/{PageName}Data.json. Never hardcode. Format: {"loginCredentials":{"username":"test@rently.com","password":"Pass123"}} +[Retrieve_DB_Context] = MANDATORY. Before code generation, search Weaviate DB (Rently collection) for relevant context. Query: Test case description/feature name. Use semantic_search to retrieve existing implementations, data structures, locators, workflows. Enhances code accuracy and consistency. +[Reference_TestLink] = DEFAULT SOURCE. Use TestLink as primary test spec source. Tools: mcp_tlink-docker-_search_test_cases_weaviate, mcp_tlink-docker-_list_test_cases, mcp_tlink-docker-_search_testcase_by_id. Workflow: ID/description → Search → Extract specs → Generate code. + +::FRAMEWORK_ARCHITECTURE:: +[Flow] = ActionKeyword → Pages → ReusableLibrary → Selenium WebDriver +[Layer_ActionKeyword] = Orchestrates test flows. Does NOT extend ReusableLibrary. Only call Page methods. No ReusableLibrary method access. +[Layer_Pages] = Page-specific automation. Extends ReusableLibrary. Use ReusableLibrary methods, locatorParser/jsonParser. Include Pass/FailScreenshot validation. +[Layer_ReusableLibrary] = Wrapped Selenium methods. NO MODIFICATIONS allowed. +[Layer_Objects] = Locators (XPath, CSS) in JSON. Add new only. No modifications to existing. +[Layer_TestData] = Test data & credentials in JSON. Add new only. No modifications to existing. + +::CRITICAL_RULES:: +[No_Raw_Selenium] = Never write driver.findElement() or direct WebDriver calls +[JSON_Driven] = All locators and data from JSON files +[Method_Chaining] = Use locatorParser(jsonParser()) pattern in Pages only +[Strict_Inheritance] = Pages extend ReusableLibrary; ActionKeyword does NOT +[Validation] = Use Pass/FailScreenshot for reporting in Pages +[Non_Destructive] = Add new methods only. Never modify/delete existing code. +[Credentials] = Store in TestData JSON. Never hardcode in Java files. + +::REPOSITORY_STRUCTURE:: +[Root] = RentlyQE/ +[ActionKeyword] = src/main/java/TestCaseExecution/ActionKeyword/{TeamName}Actions.java +[Pages] = src/main/java/TestCaseExecution/Pages/{TeamName}/{PageName}.java +[Objects] = src/main/java/TestCaseExecution/Objects/{TeamName}/{PageName}.json +[TestData] = src/main/resources/TestData/{TeamName}/{PageName}Data.json +[FrameworkProps] = src/main/resources/FrameworkProperties/{TeamName}Framework.properties (READ ONLY) +[ReusableLibrary] = src/main/java/TestCaseExecution/ReusableLibrary/ (NO MODIFICATIONS) +[Valid_Teams] = SFManager, Billing, Guardians, MFManager, MFRenter, Onboarding, Protons, RPC, Rental, Swift, Tetris, BCP + +::CORE_METHODS_PRIORITY:: +[P01_ClickElement] = ClickElement(By obj, String desc) - Standard click +[P02_EnterText] = EnterText(By obj, String text) - Enter text in field +[P03_EnterTextClear] = EnterTextClear(By obj, String text) - Clear & enter text +[P04_isDisplayed] = isDisplayed(By obj, String desc) - Check element displayed +[P05_getText] = getText(By obj) - Get element text +[P06_SelectText] = SelectText(By obj, String value) - Select dropdown by text +[P07_ClickJSElement] = ClickJSElement(By obj, String desc) - JS click for stubborn elements +[P08_EnterTextWithJS] = EnterTextWithJS(By obj, String text) - JS text entry +[P09_waitClick] = waitClick(By obj, int ms) - Wait & click +[P10_Wait] = Wait(int ms) - Static wait +[P11_isDisplayedByVisible] = isDisplayedByVisible(By obj, String desc) - Check visibility +[P12_isDisplayedByClickable] = isDisplayedByClickable(By obj, String desc) - Check clickable +[P13_SelectByValue] = SelectByValue(By obj, String value) - Select dropdown by value +[P14_SelectByIndex] = SelectByIndex(By obj, int index) - Select dropdown by index +[P15_EnterTextByEntert] = EnterTextByEntert(By obj, String text) - Enter text + Enter key +[P16_EnterTextTabClear] = EnterTextTabClear(By obj, String text) - Clear with Tab + enter +[P17_ClickElementToOpenNewInTab] = ClickElementToOpenNewInTab(By obj, String desc) - Click to new tab +[P18_clickByAction] = clickByAction(By obj) - Action class click +[P19_EnterTextWithPresence] = EnterTextWithPresence(By obj, String text) - Enter text with presence check +[P20_selectDropdownElement] = selectDropdownElement(By obj, String text) - Advanced dropdown +[P21_switchTab] = switchTab(1) - Switch browser tabs/windows +[P22_Scroll] = ScrollUp() / scrolltoBottom - Scroll page/element +[P23_refreshPage] = refreshPage() - Refresh current page +[P24_navigateBack] = navigateBack() - Browser back +[P25_closeCurrentTab] = closeCurrentTab() - Close current tab +[P26_getAttribute] = getAttribute(By obj, String attr) - Get attribute value +[P27_isEnabled] = isEnabled(By obj, String desc) - Check enabled/disabled +[P28_returnCountOfElements] = returnCountOfElements(By obj) - Count elements +[P29_clearText] = clearText(By obj) - Clear text field +[P30_doubleClick] = doubleClick(By obj, String desc) - Double-click +[P31_uploadFile] = uploadFile(By obj, String path) - Upload file +[P32_selectCheckbox] = selectCheckbox(By obj, boolean check) - Select/deselect checkbox +[P33_selectRadioButton] = selectRadioButton(By obj, String desc) - Select radio button +[P34_getSelectedText] = getSelectedText(By obj) - Get selected dropdown text +[P35_acceptAlert] = acceptAlert() - Accept alert/confirmation +[P36_dragAndDrop] = dragAndDrop(By source, By target) - Drag & drop +[P37_rightClick] = rightClick(By obj, String desc) - Right-click +[P38_hoverOverElement] = hoverOverElement(By obj, String desc) - Mouse hover +[P39_switchToFrame] = switchToFrame(By frameObj) - Switch to iframe +[P40_takeScreenshot] = takeScreenshot(String desc) - Capture screenshot + +::ACTIONKEYWORD_PATTERN:: +[Structure] = Package: TestCaseExecution.ActionKeyword. Does NOT extend ReusableLibrary. Only calls Page methods. +[Template] = +package TestCaseExecution.ActionKeyword; +import org.openqa.selenium.WebDriver; +import TestCaseExecution.Pages.{TeamName}.*; + +public class {TeamName}Actions { + protected WebDriver driver; + public {TeamName}Actions(WebDriver driver) { this.driver = driver; } + + public void testMethod() throws Exception { + Dashboard dash = new Dashboard(driver); + Properties props = new Properties(driver); + dash.navigateToProperties(); + props.addNewProperty("data"); + } +} + +[Rules] = Only Page method calls. No ReusableLibrary methods. Add methods at file end only. Never modify existing methods. +[Post_Generation] = Display methods summary: "Description -> methodName" + +::PAGES_PATTERN:: +[Structure] = Package: TestCaseExecution.Pages.{TeamName}. Extends ReusableLibrary. Uses locatorParser(jsonParser()). +[Template] = +package TestCaseExecution.Pages.{TeamName}; +import TestCaseExecution.ReusableLibrary.ReusableLibrary; +import org.openqa.selenium.WebDriver; + +public class PageName extends ReusableLibrary { + protected WebDriver driver; + String jsonPath, jsonData; + + public PageName(WebDriver driver) throws Exception { + super(driver); + this.driver = driver; + jsonPath = getObjectFile(this.getClass().getCanonicalName()); // Default: same name + jsonData = getDataFile(this.getClass().getCanonicalName()); + } + + public void performAction() throws Exception { + ClickElement(locatorParser(jsonParser(jsonPath, "Collection", "key")), "Description"); + if (isDisplayed(locatorParser(jsonParser(jsonPath, "Collection", "element")), "Element")) { + Pass("Action completed"); + } else { + FailScreenshot("Expected element not found"); + } + } +} + +[JSON_Path_Approaches] = Approach 1 (95%): getObjectFile(this.getClass().getCanonicalName()) - Same file names. Approach 2 (5%): getObjectFile("{TeamName}/{SpecificFile}") - Different names. +[Rules] = Extend ReusableLibrary. Use Top 40 methods first. Include Pass/FailScreenshot. Use locatorParser(jsonParser()). Add methods only. Never modify existing. + +::XPATH_CONSTRUCTION:: +[Best_Practices] = Use readable attributes: name, aria-label, title, placeholder, visible text. Combine conditions for uniqueness. Use parent/sibling when needed. +[Good_Examples] = //input[@name='user_email' and @placeholder='Enter email'], //button[contains(text(),'Save')] +[Avoid] = Random IDs (//div[@id='x7k9m2']), Index-only (//button[1]) + +::OBJECTS_JSON:: +[Format] = [{"Collection":{"elementKey":"By.xpath('//locator')","anotherKey":"By.css('.selector')"}}] +[Rules] = Add new locators only. Never modify/delete existing. Use readable XPath/CSS. + +::TESTDATA_JSON:: +[Format] = {"dataSet":{"key":"value"},"credentials":{"username":"user@test.com","password":"Pass123"}} +[Rules] = Store all credentials here. Add new data only. Never modify/delete existing. Never hardcode in Java. + +::FILE_MODIFICATION_RULES:: +[ActionKeyword] = Add methods at end only. Never modify/delete existing. +[Pages] = Add methods or new classes. Never modify/delete existing methods. +[Objects_JSON] = Add new locators only. Never modify/delete existing. +[TestData_JSON] = Add new data only. Never modify/delete existing. +[FrameworkProps] = READ ONLY. No modifications allowed. +[ReusableLibrary] = NO ACCESS. No modifications allowed. + +::REUSABLE_LOGIC_PRIORITY:: +[Priority_1] = If exact functionality exists, REUSE it (call existing method) +[Priority_2] = If modification needed, CREATE NEW method (never modify existing) +[Reason] = Preserves test flows, prevents breaking changes, maintains backward compatibility +::QUALITY_CHECKLIST:: +[Pre_Development] = Present template OR ask Team Name. Check existing credentials in JSON (reuse if found). Retrieve DB Context from Rently collection (MANDATORY semantic_search with TEST_DESCRIPTION). Determine URL. Confirm/create credentials in JSON. Reference TestLink. Check existing reusable logic. +[Pre_Development] = Ask Team Name. Retrieve DB Context from Rently collection (MANDATORY semantic_search). Determine URL. Confirm credentials in JSON. Reference TestLink. Check existing reusable logic. +[Code_Generation] = Use standard templates. Initialize JSON paths correctly. Use Top 40 methods priority. Implement locatorParser(jsonParser()). Include Pass/FailScreenshot. Follow XPath rules. No raw Selenium. ActionKeyword: Page calls only. Add at end only. Descriptive names. Credentials in JSON. Reuse when possible. +[Post_Generation] = Display ActionKeyword methods: "Description -> methodName". Verify no ReusableLibrary in ActionKeyword. Confirm credentials in JSON. + +::TEMPLATE_EXAMPLES:: +[Example_Filled_Template] = +TEAM_NAME = SFManager +URL = Manager +LOGIN_REQUIRED = Yes +USERNAME = sfmanager@rently.com +PASSWORD = SFManager@123 +TEST_DESCRIPTION = Verify property details display correctly +TESTLINK_ID = TC-SF-456 + +[Example_With_Existing_Creds] = +TEAM_NAME = Billing +URL = Admin +LOGIN_REQUIRED = Yes +USERNAME = existing_admin_user # Agent will search TestData/Billing/*Data.json +PASSWORD = existing_admin_pass # Agent will reuse if found +TEST_DESCRIPTION = Create new invoice for property +TESTLINK_ID = TC-BIL-789 + +[Example_No_Login] = +::TROUBLESHOOTING:: +[Raw_Selenium] = Use ReusableLibrary methods with locatorParser(jsonParser()) +[AK_ReusableLibrary] = ActionKeyword does NOT extend ReusableLibrary. Only call Page methods. +[Missing_Team] = Present template first. If not provided, ask "Which team?" and validate against valid teams +[Invalid_Template] = If template format invalid, display correct format and request re-submission or switch to Q&A mode +[Credential_Reuse] = Always check TestData/{Team}/*Data.json before creating new credentials. Reuse existing when possible. +TESTLINK_ID = TC-RPC-321 + +::CODE_EXAMPLES:: +[Correct_ActionKeyword] = +public void addPropertyFlow(String data) throws Exception { + Dashboard dash = new Dashboard(driver); + Properties props = new Properties(driver); + dash.navigateToProperties(); + props.addNewProperty(data); +} + +[Wrong_ActionKeyword] = +public void wrongFlow() throws Exception { + ClickElement(locatorParser(...), "Btn"); // WRONG: No ReusableLibrary access +} + +[Correct_Pages] = +public void navigateToProperties() throws Exception { + ClickElement(locatorParser(jsonParser(jsonPath, "Dashboard", "propertiesLink")), "Properties Link"); + Pass("Navigated to Properties"); +} + +::TROUBLESHOOTING:: +[Raw_Selenium] = Use ReusableLibrary methods with locatorParser(jsonParser()) +[AK_ReusableLibrary] = ActionKeyword does NOT extend ReusableLibrary. Only call Page methods. +[Missing_Team] = Always ask "Which team?" and validate against valid teams +[Skip_DB_Context] = MANDATORY to retrieve DB context from Rently collection using semantic_search before code generation +[Hardcoded_Creds] = Store all credentials in TestData JSON, never in Java +[Modifying_Existing] = Create new method for variations, never modify existing +[Missing_Summary] = Always provide methods summary: "Description -> methodName" +[ReadOnly_Files] = ReusableLibrary and FrameworkProperties are READ ONLY +[Missing_TestLink] = Use TestLink as default source with MCP tools +[JSON_Path] = Use Approach 1 (Canonical Name) by default (95%) +[Poor_XPath] = Use readable attributes (name, aria-label, title, text), avoid random IDs/indexes + +::QUICK_REFERENCE:: +[Workflow] = Present Template (optional quick-start) → Parse Template OR Ask Team → Check Existing Creds → Retrieve DB Context from Rently collection (semantic_search MANDATORY) → Determine URL → Confirm/Create Creds → Reference TestLink → Check Reusable → Generate Code → Display Summary +[Architecture] = ActionKeyword (Page calls only) → Pages (ReusableLibrary methods) → ReusableLibrary → Selenium +[DB_Collection] = Rently (default for all teams: SFManager, MFManager, MFRenter, Billing, Guardians, RPC, Rental, Onboarding, Protons, Swift, Tetris, BCP) +[DB_Usage] = semantic_search tool with query="{test_case_description/feature}" to retrieve context from Rently collection before code generation. Enhances understanding of existing implementations. +[File_Paths] = ActionKeyword/{Team}Actions.java, Pages/{Team}/{Page}.java, Objects/{Team}/{Page}.json, TestData/{Team}/{Page}Data.json +[Top_Methods] = P01-ClickElement, P02-EnterText, P03-EnterTextClear, P04-isDisplayed, P05-getText, P06-SelectText +[Validation] = Pass("Success message"), FailScreenshot("Error message") +[Forbidden] = Raw Selenium, ReusableLibrary in ActionKeyword, Hardcoded credentials, Modifying existing code, Changing ReusableLibrary/FrameworkProps, Skip DB context retrieval + +::REFERENCES:: +[Documentation] = README.md (project rules), framework.md (detailed framework), testng.xml (test config), {Team}Framework.properties (team guidelines - READ ONLY) + +**Last Updated**: 20 January 2026