chathai
v1.1.6
Published
chathai is a tool to help u make test script from testcase(xlxs) now can use on cypress
Readme
Chathai
A powerful tool for generating Cypress test scripts from Excel test cases
Quick Start
npm install chathai --save-dev
npx chathai generateInstallation
npm install chathai --save-dev
# Or install globally
npm install -g chathaiFeatures
- Generate Cypress test scripts from Excel test cases
- Automatic template creation
- Support for custom Excel file paths
- Easy to use command-line interface
- Validate Excel file structure
- List available templates
- Data-Driven Testing (DDT) generation via fixtures and placeholders
Usage
Basic Usage
npx chathai generateThis will create test scripts in the default cypress/e2e directory using the default template.
Using Custom Excel File
npx chathai generate path/to/your/excel.xlsxSpecifying Custom Output Directory
npx chathai generate path/to/your/excel.xlsx --output-dir cypress/e2eDefault output directory is cypress/e2e (unless overridden by --output-dir or .chathai-config.json).
Generate with DDT
npx chathai generate path/to/your/excel.xlsx --ddt ecommerce_ddt
# or
npx chathai generate -ddt ecommerce_ddt
# If you omit the name: defaults to ecommerce_ddt
npx chathai generate -ddtThis generates tests that:
- Load fixture
cypress/fixtures/ecommerce_ddt.jsoninbeforeEach - Use
{{field}}placeholders inside Excelvalue/targetcells (resolved torow.field)
Example Excel values:
typewithvalue/target:{{email}}typewithvalue/target:{{phone}}selectwithvalue/target:ไทยorDE
Generated pattern:
describe('Your Scenario', () => {
beforeEach(() => {
cy.fixture('ecommerce_ddt.json').as('rows');
});
it('Your Test', function () {
const runStep = (row) => {
// steps here using row.*
};
this.rows.forEach(row => runStep(row));
});
});npx chathai generate path/to/your/excel.xlsx custom/output/directoryList Available Templates
npx chathai --list-templatesThis will display all available templates in the xlsxtemplate directory.
Create a New Template
npx chathai --create-template my-template.xlsxThis will create a new template file named my-template.xlsx in the xlsxtemplate directory.
Validate an Excel File
npx chathai --validate path/to/your/excel.xlsxThis will check if the specified Excel file has a valid structure.
CLI warnings summary
After generation, CLI prints a warnings summary if needed, for example:
- Missing required columns (e.g.,
TestScenario(des),Test case(IT),command) - Found
{{placeholder}}without-ddt - Suspicious
containsvalue (expect two args separated by comma or slash) - "chaining?=YES" used without prior chain
- Unknown hook name
Set Default Output Directory
npx chathai --output-dir custom/output/directoryThis will set the default output directory for generated test scripts.
You can also set defaultOutputDir or a default fixture in .chathai-config.json:
{
"defaultOutputDir": "cypress/e2e",
"defaultFixture": "ecommerce_ddt"
}Excel Template Structure
The default template includes the following columns:
- Test Case ID
- Test Case Name
- Description
- Steps
- Expected Result
- Actual Result
- Status
Example
- Create a new project:
mkdir my-test-project
cd my-test-project
npm init -y
npm install chathai --save-dev- Generate test scripts:
npx chathai generate- The generated test scripts will be available in the
cypress/e2edirectory.
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
This project is licensed under the ISC License - see the LICENSE file for details.
Support
If you encounter any issues or have questions, please open an issue on GitHub.
