Open dkniffin opened 4 years ago
I just pushed a new version of this change that uses the Network.loadingFinished event to determine this instead.
Does the new change work with the requests you said the other wasn’t?
@twalpole I'm actually not sure. I didn't test this with our app. I would definitely want to add unit tests into this PR, but I wanted to make sure you were okay with the approach and willing to accept it before I spent time on that.
I’m willing if it works.
@twalpole Hmm. Looking at the tests now, I'm not actually sure how I would test this. It looks like there's not a lot of unit tests. How would you suggest I add a test for it?
Apparition runs it's test suite plus the whole of the Capybara test suite. I would recommend testing it by making requests to endpoints in the test app (new or existing ones) that delay the response a couple of seconds, verifying that the response isn't completed and then after the expected delay verifying the response is completed - similar to what the network traffic tests do - https://github.com/twalpole/apparition/blob/master/spec/integration/driver_spec.rb#L706
Capybara provided portion of the test suite is at https://github.com/teamcapybara/capybara/tree/master/lib/capybara/spec
@twalpole Alright, added a pretty simple test. Let me know if that is sufficient or not.
@dkniffin The test you modified is now failing - I'm not sure if it's because of your change or not. Please add a new test that specifically tests the finished?
method rather than merging into an existing test so it's clear which part isn't working.
@dkniffin Any update on changing this to be its own new test rather than hacking into an existing one?
@twalpole sorry, I've been busy. Thank you for the reminder. I'll try to make time to finish it up sometime this week.
I finally had a few minutes to take a look at this. I just split it to it's own spec. We'll see if that resolved the failure, or which of the tests is failing now.
@dkniffin The test appears to fail
I would like to add this method, which returns whether the request is completed or still pending. I have no idea if this is the correct implementation for it. In fact, testing it on my app, there are requests where this is not true, even after a long period of time. If someone could give me feedback on this, that would be awesome!