angular / protractor

E2E test framework for Angular apps
http://www.protractortest.org
MIT License
8.75k stars 2.31k forks source link

Page Load behaviour differences Protractor/Manual #4904

Open SmaugRon opened 6 years ago

SmaugRon commented 6 years ago

We have a small hotel booking app for which I have written a simple automated smoke-test based on an E2E flow.

Select hotel > Choose Start Date > Choose End Date > Select no of Adults > Select No of Children > Enter Promo code > Click Search. From the offered hotels, click Submit to return room availability and costs.

Works fine when run by a user and also fine under an automated test UNTIL the last Submit action - the results page frame loads, then there is a 'wait' wheel followed by an error message stating the hotel's availability is not available!

  1. I've checked that the url being posted contains the same data when run manually and automatically - i.e the enquiry data mentioned above...it's correct.
  2. I've asked my dev colleagues if there's something different between the two ways of sending the data post-button press - no.
  3. I've tried:

Below is the last straw clutched! it('should check when new page is loaded', function () { button.click().then(function (){ browser.getCurrentUrl(); browser.getTitle().then(function (title) { expect(title).toEqual('https://obmng.dbm.guestline.net/availability?hotel=OBMNG4&arrival='); return expect(newElement.isDisplayed()).toBeTruthy();

Has anyone got anything I could try or perhaps can explain this behaviour difference?

Thanks David

Bug report

SmaugRon commented 6 years ago

NB Tried on FireFox too...same error. BUT getting a console error that might be a clue?

- Failed: java.net.SocketException: Software caused connection abort: recv failed

ben-yocum commented 6 years ago
it('should check when new page is loaded', function () { 
    button.click().then(function () { 
        browser.getCurrentUrl(); 
        browser.getTitle().then(function (title) { 
            expect(title).toEqual('https://obmng.dbm.guestline.net/availability?hotel=OBMNG4&arrival='); 
            return expect(newElement.isDisplayed()).toBeTruthy();

Could you post a more complete code sample? Also, be careful with Github's formatting. It removed all the whitespace from your snippet.

A few things about this sample stand out to me:

I wouldn't expect any of this to cause the error you've described so long as you haven't disabled selenium's promise manager (SELENIUM_PROMISE_MANAGER: false), but perhaps your error is caused by a similar issue elsewhere in your test.