#alessandrosiragusa_91615
1 messages · Page 1 of 1 (latest)
Hello there
You can't and don't really want to do this. What you should do instead is mock responses to set up your e2e tests. We talk about this here: https://stripe.com/docs/automated-testing
ok thank you, how can I make sure that the signature of the webhook is valid?
You would need to verify it as we discuss here: https://stripe.com/docs/webhooks#verify-official-libraries
yes I am doing this, but how can I generate a valid signature so the test passes?
Ah for your integration test you mean. Sorry. You would not automate the test of the actual handler receiving a signature. You would mock the response that would come from your handler.
So you test your handler to ensure it works
Then you automate the response it provides
wouldn't it be easier if there was an api for changing the status of a payment intent manually?
No. It is important that our API in test mode mirrors what happens in production as much as possible.
I get it, but in real life there is a user interaction and it's impossible to do a proper test without simulating those interactions
It is impossible to automate one of these tests
it's not a real e2e test and if something breaks the tests won't reveal that
It is absolutely not impossible to perform these tests