Skip to main content

CLI Reference

Chathai CLI provides the following primary commands.


Install UI

npx chathai install-ui

Install the Chathai UI (Electron app).
After installation, open it with npx chathai open-ui.


Open UI

npx chathai open-ui

Open the installed Chathai UI.


Generate Cypress Test Script

npx chathai generate [excelPath] [outputDir]

Generate Cypress test scripts from an Excel file or a template folder.
Example:

npx chathai generate ./xlsxtemplate/chathai-templateV.1.0.0.xlsx ./cypress/e2e
  • [excelPath] : Excel file or template folder
  • [outputDir] : Output folder for generated files (if omitted, defaults to cypress/e2e or value from .chathai-config.json)

DDT mode (Data-Driven Testing)

# Use the fixture named ecommerce_ddt (file at cypress/fixtures/ecommerce_ddt.json)
npx chathai generate -ddt ecommerce_ddt

# If you don't specify a fixture name
npx chathai generate -ddt
# The default ecommerce_ddt will be used (file cypress/fixtures/ecommerce_ddt.json)

Output structure in DDT mode (async alias @rows):

describe('Your Scenario', () => {
beforeEach(() => {
cy.fixture('ecommerce_ddt.json').as('rows');
});
it('Your Test', function () {
cy.get('@rows').then((rows) => {
rows.forEach((row) => {
// steps using row.*
});
});
});
});

Configure output folder

npx chathai --output-dir [directory]

Set the output folder for generated files.
Note: When using -ddt, if the argument after the flag is a fixture name, it won't be treated as outputDir automatically (to prevent path mix-ups).


Validate Excel structure

npx chathai --validate [excelPath]

Verify that the Excel file contains all required columns.


Create a new Excel Template

npx chathai --create-template [templateName.xlsx]

Create a new Excel template in the xlsxtemplate/ folder.


List templates

npx chathai --list-templates

Show available Excel templates in the folder.


Configure template folder

npx chathai --template-dir [directory]

Set the default template folder.


Generate HTML Test Report

npx chathai export-report

Generate the test report in HTML format.

Warnings Summary after Generate

After running generate, if potential issues are found, a “Chathai warnings:” section will be printed, such as:

  • Missing required columns (TestScenario(des), Test case(IT), command)
  • Found {{placeholder}} without enabling -ddt
  • Invalid contains format (arguments should be separated by comma or slash)
  • Using chaining?=YES without a prior chained command
  • Invalid hook name

Show version

npx chathai --version

or

npx chathai -v

Show CLI help

npx chathai --help

or

npx chathai -h