Reputation: 1023
Basically Protractor hangs in our project, because there is this weird xhr_streaming
activity in Network tab caused by some sort of websocket which never finishes. Is there a way in protractor or by using some additional node lib to ignore this request?
Upvotes: 1
Views: 625
Reputation: 71961
Protractor has no way of doing that, and it's a big loss in my opinion. The only way to make this work is to use:
beforeAll(() => {
browser.waitForAngularEnabled(false);
});
The problem is now that it won't wait for angular events anymore, and there could be times that elements are not visible yet.
Besides protractor, you could also have a look at Cypress.io. Personally I think it's much easier and more straight forward to write e2e with.
Maybe it works if you make the xhr request run outside the NgZone
, and whenever it needs to do something, make it run back in the zone:
constructor(readonly nz: NgZone, readonly http: HttpClient) {}
startStreamingXhr(): void {
this.nz.runOutsideAngular(() => this.http.get(...).subscribe((data) => {
this.nz.run(() => {
// do something with data
});
});
}
Upvotes: 1
Reputation: 1199
You can try to use those options:
Option 1
https://stackoverflow.com/a/21863295/6331748
Option 2
You can try to abort XHR in question. See the reference: https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/abort
Option 3
Protractor / Selenium XHR stays in status "pending"
Let me know if any of those options worked.
Upvotes: 0