Skip to content
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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

dkniffin
Copy link

@dkniffin dkniffin commented Apr 13, 2020

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!

@dkniffin
Copy link
Author

I just pushed a new version of this change that uses the Network.loadingFinished event to determine this instead.

@twalpole
Copy link
Owner

Does the new change work with the requests you said the other wasn’t?

lib/capybara/apparition/page.rb Outdated Show resolved Hide resolved
@dkniffin
Copy link
Author

@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.

@twalpole
Copy link
Owner

I’m willing if it works.

@dkniffin
Copy link
Author

@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?

@twalpole
Copy link
Owner

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

@dkniffin
Copy link
Author

@twalpole Alright, added a pretty simple test. Let me know if that is sufficient or not.

@twalpole
Copy link
Owner

@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.

@twalpole
Copy link
Owner

@dkniffin Any update on changing this to be its own new test rather than hacking into an existing one?

@dkniffin
Copy link
Author

@twalpole sorry, I've been busy. Thank you for the reminder. I'll try to make time to finish it up sometime this week.

@dkniffin
Copy link
Author

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.

@twalpole
Copy link
Owner

twalpole commented Aug 1, 2020

@dkniffin The test appears to fail

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants