Paratii-Video / paratii-player

Probably the world's 1st in-player token wallet (v0.0.1 of the Paratii embeddable web player).
http://paratii.video
GNU General Public License v3.0
41 stars 11 forks source link

352 - add browser command to wait until a request comes back w/ a certain status #358

Closed bent0b0x closed 6 years ago

bent0b0x commented 6 years ago

Issue

352

Problem Some chimp tests rely on creation of a new asset, and steps in the test cannot run until that asset is created and a request for that resource will be successful. Previously, browser.pause was the best solution we had for this.

Fix Add a new waitUntilRequestHasStatus command, which repeatedly performs a synchronous XMLHttpRequest until either the specified status comes back (default of 200) or we timeout. This should help (albeit maybe slightly) with our test reliability.

From MDN:

Note: Starting with Gecko 30.0 (Firefox 30.0 / Thunderbird 30.0 / SeaMonkey 2.27), Blink 39.0, and Edge 13, synchronous requests on the main thread have been deprecated due to the negative effects to the user experience.

So this synchronous XMLHttpRequest is technically deprecated in other browsers. But as long as we are running in Chrome it should not be a problem. Something to consider, though.