Self Healing Playwright TS with the help of AI using TAMASH
π€ Self-Healing Playwright Test Cases with AI Test case failures due to locator changes are one of the biggest pain points in a tester's life. π© But what if your Playwright test cases could automatically identify changed locators and heal themselves using AI? In this video, we'll see how to implement Self-Healing Playwright Test Cases using the tamash-playwright package. π What You'll Learn 1. Install and configure TAMASH Playwright 2. Connect TAMASH with Ollama, OpenAI, Claude, or Gemini 3. Automatically heal broken locators during test execution 4. Re-run healed test cases 5. Review and apply the generated locator changes π οΈ Setup Steps 1οΈβ£ Install TAMASH Playwright npm install tamash-playwright 2οΈβ£ Generate an API Key You can use any of the supported AI platforms: Ollama OpenAI Claude Gemini 3οΈβ£ Configure the .env file Add your AI provider/API configuration to the .env file. 4οΈβ£ Configure Action Timeout Configure the required action timeout in: playwright.config.ts 5οΈβ£ Describe Your Locators Add meaningful descriptions to your locators so TAMASH can understand their purpose. Example: page.locator("//input[text()='username']").describe("username textbox"); 6οΈβ£ Import test from TAMASH Instead of importing test directly from Playwright, use the TAMASH test object in your test cases. 7οΈβ£ Verify the Setup Run: npx tamash-playwright doctor 8οΈβ£ Run Your Test Cases Execute your Playwright test cases normally. If a locator has changed, TAMASH can automatically attempt to heal the test case on the fly. π₯ 9οΈβ£ Apply the Generated Heals Preview the changes first: npx tamash-playwright apply-heals --dry-run If everything looks good, apply the changes: npx tamash-playwright apply-heals π― The Goal Instead of manually fixing every broken locator after UI changes, AI can help identify and repair locator failures automatically, reducing maintenance effort and making your Playwright automation more resilient. If you find this useful, Like π | Share π | Subscribe π #Playwright #TestAutomation #AI #SelfHealing #TAMASH #PlaywrightAutomation #AutomationTesting #SoftwareTesting #SDET #AITesting




Join the discussion
Sign in to join the discussion
Sign in