Check POST request payload data with Protractor

若如初见. 提交于 2019-12-05 01:49:36

问题


Let's say i have angular page with a couple of input elements and save button. After Save button is clicked POST request will be sent. I'm writing Protractor e2e test for this page.

The question:

How can i check with protractor POST request payload data after app is sent it or before sending? I want to be sure that my app will sent right data in POST request.


回答1:


Following @Andres D's comment: yes, there is a misconception here.

protractor is a tool that helps you mimic real-user interactions with a page by automating a real browser. It stays on the high-level, sees what a normal user can see - click buttons, fills out inputs etc.

In other words, it is a black box testing, it doesn't matter where is data coming from, which protocol used to transfer it or how many external js files your page requires to be loaded - these are all technical details that should checked and tested separately.


FYI, there is a relevant tool called protractor-http-mock that can help you in testing corner cases allowing to replace the server responses with custom defined.



来源:https://stackoverflow.com/questions/27428874/check-post-request-payload-data-with-protractor

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!