cypress 模拟服务器端请求进行端到端测试
我正在使用 Cypress 进行端到端测试。为了测试我的付款流程,我需要模拟后端(快递)向银行发出的交易请求。因此,当 cypress 测试点击购买时,请求发送到后端,后端向银行发送购买请求,然后银行向后端发送响应。所以我需要测试除了发往/来自银行的请求之外的所有内容。从 this 答案我认为没有办法通过 cypress 模拟服务器端请求。希望有人能告诉我我错了以及这样做的方法! 我希望 cypress 插件能让我做到这一点,但似乎我误解了它们的目的。
I am using Cypress for end to end tests. To test my payment process I need to mock the request of my back end(express) to bank for transaction. So when the cypress test clicks buy, a request goes to backend and the backend sends a request to bank for purchase, then the bank sends response to backend. So I need to test everything except requests to/from bank. From this answer I assume there is no way to mock server side requests by cypress. Hope someone can show me that I am wrong and the way of doing that!
I was hoping that cypress plugins will let me to do that, but seems like I misunderstood the purpose of them.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论