71 lines
2.1 KiB
Markdown
71 lines
2.1 KiB
Markdown
# cic-ussd-e2e
|
|
|
|
Bunch of test scripts to automate traversing USSD menu's with little human interaction and as close replication to actual USSD usage including AT style reqests and waiting times.
|
|
|
|
## Setup
|
|
|
|
**Pre-requisites**
|
|
|
|
2 accounts each with:
|
|
|
|
- Initial pin set
|
|
- Some SRF Balance
|
|
|
|
**Environment**
|
|
|
|
- Node.js
|
|
- Install dependencies with `$ npm i`
|
|
- Set global config in `config.js`
|
|
|
|
## Scenarios
|
|
|
|
| Test | Type | Description |
|
|
| -------------- | --------- | ---------------------------------------------- |
|
|
| initial_menu | Statless | Main menu > Help > Exit |
|
|
| display_sarafu | Stateless | Main menu > My Sarafu > Exit |
|
|
| reset_pin | Stateful | Main menu > Account options > Reset pin > Exit |
|
|
|
|
### Stateful scenarios
|
|
|
|
These tests live individually in their own folder. They require some ENV variables to be set before running them.
|
|
|
|
### Stateless scenarios
|
|
|
|
These are included under the `stateless` folder and can be run in any order and have multple tests under the same folder since they only check correctness of menu responses.
|
|
|
|
## Running tests
|
|
|
|
```bash
|
|
# Set env variables for stateful scenarios, refer to individual test folders
|
|
$ npx tap --bail scenarios/SCENARIO_NAME
|
|
```
|
|
|
|
Examples:
|
|
|
|
- `CURRENT_PIN=4444 NEW_PIN=3333 npx tap --bail scenarios/stateless`
|
|
|
|
### Limitations
|
|
|
|
- These scripts cannot reset USSD sessions upon failure. You will need to manually set your account USSD menu to the main menu
|
|
- Cannot verify sms status, confirm with cic-notify for delivery
|
|
|
|
### Writing your own scenario
|
|
|
|
- Each scenario should exit since this test suite doesn't pass around past session info
|
|
- Control wait between menus with the `wait(time in ms)` function
|
|
- Follow any spec
|
|
- For any menu traversal, remember to append a `*` before the next input, this correctly mocks AT webhooks e.g.
|
|
- Dyanmic inputs for stateful scenarios must come from an env var that can be set again on next run
|
|
- Include a `tap-parallel-not-ok` file in any new folder
|
|
|
|
```bash
|
|
# Initial Main menu, no input
|
|
""
|
|
# Input 1
|
|
"1"
|
|
# Input 2
|
|
"1*2"
|
|
# Input 99
|
|
"1*2*99"
|
|
```
|