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.
cic-ussd-e2e/tests/1_initial_menu.test.js

41 lines
933 B
JavaScript

const test = require("tap").test;
const rangi = require("rangi");
const lib = require("../lib");
test("Initial menu, go to help, exit", async (t) => {
const sessionId = lib.newSession();
t.plan(3);
t.test("Display menu and Sarafu balance", async (t) => {
await lib.wait(3000);
const r = await lib.ussdClient(sessionId);
console.log(rangi.cyan(r.text));
t.equal(r.code, "CON");
t.match(r.text, /Balance/g);
t.end();
});
t.test("Go to help menu", async (t) => {
await lib.wait(3000);
const r = await lib.ussdClient(sessionId, "4");
console.log(rangi.cyan(r.text));
t.equal(r.code, "CON");
t.match(r.text, /assistance/g);
t.end();
});
t.test("Exit", async (t) => {
await lib.wait(3000);
const r = await lib.ussdClient(sessionId, "4*99");
console.log(rangi.cyan(r.text));
t.equal(r.code, "END");
t.match(r.text, /Thank/g);
t.end();
});
});