teampoltergeist / poltergeist

A PhantomJS driver for Capybara

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Following jQuery line of code does not work in anything above v1.8.1

thebradhimself opened this issue · comments

$("#submit_payment").prop('disabled', false);
Something in Poltergeist v1.9.0 and up will not allow us to set disabled to false.

We are currently using Capybara 2.14.0, Poltergeist 1.8.1, and PhantomJS 2.1.1.

I downgraded the Poltergeist Gem from 1.15.0 to 1.8.1 in order to get this to work, I tried every version in between and none of them work either.

This is my first time submitting an issue, let me know if you need any more information.

Thank you for your time

How are you executing that code? Do you have the js_errors config turned on to see if it's raising any errors?

Also, how are you actually verifying whether or not that property has been set?

We take screenshots in our tests and can verify the button (#submit_payment is a button) is still disabled which causes the test to fail.

I haven't used js_errors.

@thebradhimself So that code is in your app? Not something you're executing via execute_script ?

https://gist.github.com/twalpole/6f549a27916b1fa2a8d4ef23677f58b2. is a gist that shows this behavior working with the latest poltergeist and phantoms 2.1.1 so I don't think this is an issue with poltergeist. Are you sure updating poltergeist isn't allowing some other gem to update as well that could be causing your issue? If that's not what's happening we're going to need some kind of reproducible example to look at this.

One other possibility is that you're taking your screenshot/clicking the button before it's actually become enabled. Did you sleep for a bit before your screenshot/click of the button to test that? If that is the case show the code you're attempting to use to click the button after it's enabled

When landing on the site, an ajax call runs a .js.erb script that gets a cipher key, sets some hidden fields in our form, and enables the button.
I changed the hidden fields to unhidden inputs and they do show up which proves the script is running.

Currently, the test sleeps for 2 seconds before filling out the form and then attempting to click the button.
I had it sleep 60 seconds and 120 seconds a few times and the button was still disabled.
Updating Poltergeist from 1.8.1 to 1.15.0 does not update any other gems or dependencies.

What other info can I give?

@thebradhimself A way to reproduce the issue - the gist I posted shows that the specific JS does work fine in Poltergeist, and enables the button. If you can start with that gist and produce something that shows the issue we would be able to narrow it down. Without that there really isn't anything we can do. The differences between 1.8.1 and 1.9.0 are 0605547...85eedae and there's nothing there that should produce what you're seeing, other than maybe whitelisting. However if whitelisting was the issue then you wouldn't see the ajax request in your test.log at all and none of the JS would run. Since you state that some of the JS is running that can't be it.

How exactly are you clicking the button (show the code for the test)

within ("#reserve_form") do  
  click_button 'Reserve'  
end  

I'm going to mark the issue as closed. Your gist runs fine on my machine. There has to be some other gem or something causing interference in our app.
Thank you for the help!