Getting Started
1. Install Chathai
Install via npm:
npm install chathai --save-dev
Or use npx without installing:
npx chathai --help
2. Open Chathai UI (for non-command-line users)
npx chathai install-ui
npx chathai open-ui
Chathai UI helps you create and edit test cases in Excel easily.
3. Excel Template Structure
Chathai uses an Excel (.xlsx) file to define test cases.
Example of required columns:
TestScenario(des) | Test case(IT) | Describe | only | hook | command | value/target | chaining? |
---|---|---|---|---|---|---|---|
Simple Todo App | Loads the app and adds a todo | Open the site before each test in the suite | visit | http://localhost:3000 | |||
Simple Todo App | Loads the app and adds a todo | Open the site before each test in the suite | get | input[name="task"] | |||
Simple Todo App | Loads the app and adds a todo | Open the site before each test in the suite | skip | type | Learn Cypress | ||
Simple Todo App | Loads the app and adds a todo | Open the site before each test in the suite | before | get | button[type="submit"] | ||
Simple Todo App | Loads the app and adds a todo | Open the site before each test in the suite | click | ||||
Simple Todo App | Loads the app and adds a todo | Open the site before each test in the suite | contains | Learn Cypress |
Column descriptions
- TestScenario(des): Test group name (describe)
- Test case(IT): Test case name (it)
- Describe: Test group description (optional)
- only: Use with Cypress.only (optional)
- hook: Specify hooks such as before, beforeEach (optional)
- command: Cypress commands such as visit, get, type, click, contains
- value/target: Command value/target such as URL, selector, text
- chaining?: Whether to chain commands (optional)
4. Complete example test case
TestScenario(des) | Test case(IT) | Describe | only | hook | command | value/target | chaining? |
---|---|---|---|---|---|---|---|
Login | User Login | Login test | before | visit | /login | ||
Login | User Login | Login test | get | #username | |||
Login | User Login | Login test | type | user1 | YES | ||
Login | User Login | Login test | get | #password | |||
Login | User Login | Login test | type | pass123 | YES | ||
Login | User Login | Login test | click | #submit | YES | ||
Login | User Login | Login test | should | url,/home | YES |
5. Usage steps
- Create test cases in Excel as shown
- Generate Cypress script:
Or open DDT mode (replace
npx chathai generate ./xlsxtemplate/chathai-templateV.1.0.0.xlsx ./cypress/e2e
{{field}}
from a fixture):npx chathai generate -ddt ecommerce_ddt
# If you don't specify a fixture name, the default ecommerce_ddt will be used - Run Cypress:
npx cypress open
- Export test report:
npx chathai export-report
Note: After generation, if potential issues are found, the CLI will print a "Chathai warnings:" summary (e.g., placeholder without DDT, invalid contains format, etc.).
6. Good to know
- Create a new template with
npx chathai --create-template my-template.xlsx
- Validate a template with
npx chathai --validate my-template.xlsx
- See all commands in the CLI Reference
7. No Cypress background required
- No need to write JavaScript
- No need to know Cypress syntax
- Just prepare test cases in Excel as shown
- Use simple commands via CLI or UI