e2e tests with node tap
This repository has been archived on 2022-03-31. You can view files and clone it, but cannot push or open issues or pull requests.
Go to file
2022-03-25 13:14:35 +03:00
scenarios update: separate stateful and stateless scenarios 2022-03-25 13:14:35 +03:00
.gitignore project: (init) ussd-e2e 2022-03-24 19:38:49 +03:00
.taprc project: (init) ussd-e2e 2022-03-24 19:38:49 +03:00
config.js update: separate stateful and stateless scenarios 2022-03-25 13:14:35 +03:00
lib.js update: separate stateful and stateless scenarios 2022-03-25 13:14:35 +03:00
package.json project: (init) ussd-e2e 2022-03-24 19:38:49 +03:00
README.md update: separate stateful and stateless scenarios 2022-03-25 13:14:35 +03:00
yarn.lock update: separate stateful and stateless scenarios 2022-03-25 13:14:35 +03:00

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

# 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
# Initial Main menu, no input
""
# Input 1
"1"
# Input 2
"1*2"
# Input 99
"1*2*99"