fintech-automation-test
v1.0.4
Published
Autonomous Test Automation
Downloads
308
Maintainers
Readme
FAT - Fint Autonomous Testing
A autonomous framework for Automation testing using AI
Key Features:
- Jira Integration
- Code Gen templates
- Auto Generation of Test Cases
- Data-Driven Testing
- Smart Wait
- Self-Healing
- CI/CD Integration
- Report Portal
- AI-Based Analysis
FAT Setup Instructions
Clone the Project:
git clone https://github.com/Fint-Solutions/FAT.git
Install Node.js and npm:
- Ensure you have Node.js and npm (Node Package Manager) installed. You can download and install them from the Node.js official website.
- Install the dependencies listed in
package.json
:npm install --verbose
Run a Sample Scenario:
npx codeceptjs run test/web/**/**/*.js
Writing Tests with AI Copilot
Create a Test to Use AI Features:
- Run the following command to generate a new test:
npx codeceptjs gt
- Name your test and write the code. Use
Scenario.only
to execute only this specific test.Feature('ai'); Scenario.only('test ai features', ({ I }) => { I.amOnPage('https://www.google.co.in'); pause(); });
- Run the following command to generate a new test:
Run the Test in Debug Mode with AI Enabled:
npx codeceptjs run --debug --ai
Interact with AI During Pause Mode:
- When in pause mode, ask GPT to perform actions on the page using natural language. Ensure to include at least one space in your input, as input without spaces will be treated as JavaScript code.
- Example input:
I.fill checkout form with valid values without submitting it
AI Generates and Executes Code:
- GPT generates the necessary code and data, and CodeceptJS executes it. Successful code is saved to history for future use.
Self-Healing Tests
Heal Recipes:
- Functions executed upon test failure to attempt recovery.
- AI Heal Recipes provide error messages, the step being executed, and HTML context to the AI provider.
- AI suggests code to fix the failing test.
AI Healing:
- Specifically addresses locator changes (e.g., renaming "Sign in" to "Login").
- AI matches the new locator, retries the command, and continues test execution.
Limitations:
- Heal actions only work on actions like
click
,fillField
, etc. - They do not work on assertions, waiters, or grabbers.
- Heal actions only work on actions like
Automatic Updates:
- If the Heal plugin successfully fixes a step, it suggests code changes at the end of execution. Use these suggestions to update the codebase.
Setup Instructions:
- Ensure AI Provider Connection:
- Connect an AI provider.
- Include heal recipes in your
codecept.conf.js
orcodecept.conf.ts
configuration file.
- Enable the Heal Plugin:
plugins: { heal: { enabled: true } }
- Run Tests in AI Mode:
npx codeceptjs run --ai
- Review AI Suggestions:
- After test execution, you’ll receive token usage information and code suggestions from AI. Use this information to improve your test recovery process.
- Ensure AI Provider Connection:
Arbitrary GPT Prompts
Enabling AI Helper:
- Update
codecept.conf.js
to enable the AI helper along with the Playwright, Puppeteer, or WebDriver helper.helpers: { Playwright: { // configuration }, AI: {} }
- Update
AI Helper Methods:
askGptOnPage
: Sends a GPT prompt with the HTML of the page (split into chunks if necessary).askGptOnPageFragment
: Sends a GPT prompt with the HTML of a specific element.askGptGeneralPrompt
: Sends a GPT prompt without HTML.askForPageObject
: Creates a PageObject.
Generating PageObjects:
- Enable the AI helper and launch the shell:
npx codeceptjs shell --ai
- Use
pause()
to interact with AI and browse web pages:I.askForPageObject('login')
- Enable the AI helper and launch the shell:
Refining PageObjects:
- Customize requests or use a root locator:
I.askForPageObject('login', 'implement signIn(username, password) method') I.askForPageObject('login', '', '#auth')
- Move generated PageObjects to the
pages
folder and include them incodecept.conf.js
:include: { loginPage: "./pages/loginPage.js", // ... }
- Customize requests or use a root locator:
Debugging AI Features:
- Use the
DEBUG
flag to debug AI features:DEBUG="codeceptjs:ai" npx codeceptjs run --ai DEBUG="codeceptjs:ai" npx codeceptjs shell --ai
- Use the