You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It would be a good idea to be able to configure a filter function for outgoing message. For example, when ending a conversation, the botbuilder sends a silent menssage with type: 'endOfConversation' that I don't want to match.
not a bad idea, but I think that filtering out messages can't be done to all messages. A user may want to use any type of message for checking. For now, I would check against the event or the events you're expected to see.
Actually implementing this may require a bit more thought. The current model is rather simple; a builder model with one class. To give more flexibility, that type of filtering on a per message sent basis may be a bit harder to implement and require a more complex model
@microsoftly Just to check if I understood correctly. What you are saying is that for now, users are required to check for the endOfCoversation activity always ? Is that even possible ? An IMessage type should always be message right ?
Can you explain a little further on the new model that you are suggesting ?
Yes, I would suggest checking that directly if you need to. I would first try to see if you don't need to set any expectations the test to work. You may need to add in a few millisecond delay with a .then between steps.
The new model is in reference to this, the main exported class from the module. checkSession, sendMessageToBot, then, and sendMessageToBotAndExpectSaveWithNoResponse all return the same botbuilder instance that accumulates all the test steps. The way I'm envisioning a filter would be something like
newBotTester(bot).sendMessageToBot('respondWithEventFirst').filter((message)=>message.type==='message').expect('hey! this is the second message I sent!').sendMessageToBot('another message')// ....runTest();
Doing something like this would require different builders to be returned between each sendMessageToBot call, complicating the simple one class is the only return type builder model that exists today.
@microsoftly At the moment if I don't add the following expectation to my test it fails.
return new BotTester(bot)
.sendMessageToBot('hi', 'Hello')
.sendMessageToBot('bye',
'Talk later',
{ type: 'endOfConversation' } as IMessage,
'Im going off' // This is send in a different conversation for example
)
I agree 100% on keeping simple the BotTester API. The simple chaining works really good.
Activity
bilby91 commentedon Sep 4, 2017
Maybe we can only filter the
endOfConversationmessage, not sure how many different type of messages can cause problems like this one...bilby91 commentedon Sep 5, 2017
@microsoftly What are you thoughts here ?
microsoftly commentedon Sep 6, 2017
not a bad idea, but I think that filtering out messages can't be done to all messages. A user may want to use any type of message for checking. For now, I would check against the event or the events you're expected to see.
Actually implementing this may require a bit more thought. The current model is rather simple; a builder model with one class. To give more flexibility, that type of filtering on a per message sent basis may be a bit harder to implement and require a more complex model
bilby91 commentedon Sep 6, 2017
@microsoftly Just to check if I understood correctly. What you are saying is that for now, users are required to check for the
endOfCoversationactivity always ? Is that even possible ? An IMessage type should always bemessageright ?Can you explain a little further on the new model that you are suggesting ?
Thanks for the support as usual!
microsoftly commentedon Sep 6, 2017
Yes, I would suggest checking that directly if you need to. I would first try to see if you don't need to set any expectations the test to work. You may need to add in a few millisecond delay with a
.thenbetween steps.The new model is in reference to this, the main exported class from the module.
checkSession,sendMessageToBot,then, andsendMessageToBotAndExpectSaveWithNoResponseall return the same botbuilder instance that accumulates all the test steps. The way I'm envisioning a filter would be something likeDoing something like this would require different builders to be returned between each sendMessageToBot call, complicating the simple one class is the only return type builder model that exists today.
bilby91 commentedon Sep 6, 2017
@microsoftly At the moment if I don't add the following expectation to my test it fails.
I agree 100% on keeping simple the BotTester API. The simple chaining works really good.
microsoftly commentedon Sep 22, 2017
closing for now. If a good implementation comes by I'll happily look at it
microsoftly commentedon Oct 4, 2017
reopening. New PR makes it looks like this isn't that difficult to implement. Will close when merged
microsoftly commentedon Oct 6, 2017
#33