-
Notifications
You must be signed in to change notification settings - Fork 46
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Capybara::Apparition::NetworkTraffic::Request#finished? #49
base: master
Are you sure you want to change the base?
Conversation
98e09f0
to
4934f86
Compare
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? |
4934f86
to
c583c9d
Compare
@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 |
@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. |
d584885
to
a7d79ae
Compare
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!