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/2_display_sarafu.test.js

41 lines
937 B
JavaScript

const test = require("tap").test;
const rangi = require("rangi");
const lib = require("../lib");
test("Initial menu, display balances, 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 My Sarafu menu", async (t) => {
await lib.wait(3000);
const r = await lib.ussdClient(sessionId, "2");
console.log(rangi.cyan(r.text));
t.equal(r.code, "CON");
t.match(r.text, /SRF/g);
t.end();
});
t.test("Exit", async (t) => {
await lib.wait(3000);
const r = await lib.ussdClient(sessionId, "2*00");
console.log(rangi.cyan(r.text));
t.equal(r.code, "END");
t.match(r.text, /Thank/g);
t.end();
});
});