My current setup involves using protractor to test the functionality of my Angular client, while the server is implemented using Python Google App Engine.
In order to enhance my protractor test, I am looking to include an assertion on the http response generated by a POST request triggered by the click of a form button. Here is an example of what I am trying to achieve:
describe('Pointless Form Post Test', function() {
beforeEach(function() {
browser.get('/myform');
});
it('should populate a form, submit it, and handle the response without errors', function() {
element(by.model('form_summary')).sendKeys('Some input text');
element(by.model('form_details')).sendKeys('Lots of detailed text');
element(by.id('formBtn')).click();
--> ASSERTION NEEDED FOR HANDLING HTTP 500 ERROR RESPONSE <
})
});
Is there a way to validate the response received from the server after clicking the form button?
On a side note, I am starting to question if my approach to End-to-End testing with protractor aligns with its intended scope. However, I believe this functionality is crucial for my testing needs. While writing a test targeting my POST handler, I discovered that the server was returning 500 errors (due to a server bug). I am hopeful that protractor can help catch and handle such issues.