e2e tests with node tap
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.
 
Mohamed Sohail 97098482af
update: separate stateful and stateless scenarios
3 months ago
scenarios update: separate stateful and stateless scenarios 3 months ago
.gitignore project: (init) ussd-e2e 3 months ago
.taprc project: (init) ussd-e2e 3 months ago
README.md update: separate stateful and stateless scenarios 3 months ago
config.js update: separate stateful and stateless scenarios 3 months ago
lib.js update: separate stateful and stateless scenarios 3 months ago
package.json project: (init) ussd-e2e 3 months ago
yarn.lock update: separate stateful and stateless scenarios 3 months ago

README.md

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"