Skip to content

Test prompt objects other than text #84

Description

@shaikatzir

I would like to test the bot ability to respond with choices prompts and be able to answer those prompts.
So for:

var salesData = {
    "west": {
        units: 200,
        total: "$6,000"
    },
    "central": {
        units: 100,
        total: "$3,000"
    },
    "east": {
        units: 300,
        total: "$9,000"
    }
};

bot.dialog('getSalesData', [
    function (session) {
        builder.Prompts.choice(session, "Which region would you like sales for?", salesData); 
    },
    function (session, results) {
        if (results.response) {
            var region = salesData[results.response.entity];
            session.send(`We sold ${region.units} units for a total of ${region.total}.`); 
        } else {
            session.send("OK");
        }
    }
]);

do:

var expectedChoicePrompt  = PromptChoice("Which region would you like sales for?", salesData)
new BotTester(bot)
            .sendMessageToBot("hello", expectedChoicePrompt)
            .sendMessageToBot("central", " We sold 100 units for a total of \"300$\".")
            .runTest();

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions