MakingChatbots / ivr-tester

An automated testing framework for Interactive Voice Response (IVR) call flows
https://ivr-tester.makingchatbots.com/
MIT License
29 stars 9 forks source link

Hard to follow the setup #92

Closed bahunov closed 1 year ago

bahunov commented 1 year ago

Hi @SketchingDev

Could you please record tutorial or better documentation on how to get this working?

After downloading the repo, there's no mentioning of where to do npm install etc. Where to create a sample test.js?

Easier tutorial please for dummies :)

Thanks!

bahunov commented 1 year ago

found solution:

import { googleSpeechToText } from "ivr-tester-transcriber-google-speech-to-text";
import { IvrTester, similarTo, press, hangUp, isAnything } from "ivr-tester";
import path from "path";
import { fileURLToPath } from 'url';

const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);

const config = {
  transcriber: googleSpeechToText({ languageCode: "en-GB", useEnhanced: true }),
  twilioAuth: {
    accountSid: '',
    authToken: '',
  },
  recording: {
    transcript: {
      outputPath: path.join(__dirname, "../recordings"),
      includeResponse: true,
    },
  },
};

new IvrTester(config).run(
  { from: "+XXXXXX", to: "+XXXXXX" },
  {
    name: "Customer is provided a menu after their account number confirmed",
    steps: [
      {
        whenPrompt: isAnything(),
        then: press("112"),
        silenceAfterPrompt: 3000,
        timeout: 6000,
      },
      {
        whenPrompt: similarTo(
          "Finish"
        ),
        then: hangUp(),
        silenceAfterPrompt: 3000,
        timeout: 6000,
      },
    ],
  }
);