-
Notifications
You must be signed in to change notification settings - Fork 57
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Integration test #209
Comments
And we can chain multi-step conversation like this: expect(client).to receive_message(
message.message_with_text("hello")
)
.as_service("facebook")
.and_send_replies([
{
"recipient" => {
"id" => message.sender_id
},
"message" => {
"text" => "Hello World!"
}
},
{
"recipient" => {
"id" => message.sender_id
},
"message" => {
"text" => "What's your name?"
}
}
])
expect(client).to receive_message(
message.message_with_text("Luke Skywalker")
)
.as_service("facebook")
.and_send_replies([
{
"recipient" => {
"id" => message.sender_id
},
"message" => {
"text" => "Nice to meet you Luke Skywalker!"
}
},
{
"recipient" => {
"id" => message.sender_id
},
"message" => {
"text" => "Goodbye World!"
}
}
]) |
👏 Thanks for sharing this! This needs a page in the docs, perhaps? To load Dir["#{File.dirname(__FILE__)}/matchers/**/*.rb"].each { |f| require f } Also, is the JSON from |
Hi @sunny - @josephktcheung's matchers folder is in the support folder so not needed in this case as it's loaded via the ** wildcard. You can see the folder structure here. I'm just playing around right now and I think JSON is Facebook-specific as Twilio webhooks use TwiML (its own flavour of XML) via the Also hello fellow LWer 👋 |
Hey @rahulkeerthi, great to see more people from the Le Wagon family :)
Ah, thanks! I followed this issue's description, it may need a little fix, then: -4. Define custom matcher `send_reply` in `spec/matchers/send_reply.rb`
+4. Define custom matcher `send_reply` in `spec/support/matchers/send_reply.rb` |
Ah, I missed that - you're right! 👍 |
Hi @josephktcheung, I'm trying to implement this but it won't work, I'm getting
I'm looking into the source code for Stealth and Stealth::Facebook to figure out what might have changed between when you wrote this and now, and I was wondering if you were still around? Thank you for reading! Will post back here if I solve it on my own. :-) |
Hi,
Related to #83, I'd like to share how I write Stealth's integration test. Source code can be found here https://github.com/josephktcheung/stealth-integration-test. @luizcarvalho @mgomes please take a look and see if this can be improved.
Steps:
Run
stealth new
to generate a new stealth appInstall following gems for testing
spec/spec_helper.rb
sample_message
class inspec/support/sample_message.rb
send_reply
inspec/support/matchers/send_reply.rb
(Thanks @sunny for correction)spec/features/chatbot_flow_spec.rb
bot/controllers/hellos_controller.rb
bundle e rspec
and test passesThe text was updated successfully, but these errors were encountered: