React event not triggered [help]
wenderjean opened this issue · comments
hey guys,
I'm running a Rails project with Rspec, Capybara and Poltergeist and I'm currently fighting with a problem related to React components, I have a feature with a button managed by React with an onclick
event that only render some content, running my tests against that feature with Poltergeist driver my tests fail once the click_on
function doesn't trigger the action.
The curios thing is that I tried with chromedriver
and selenium
and both work well.
I'm running in an os x (sierra) and my project configuration is:
ruby: 2.2.4
rails: 4.2.6
phantomjs: 2.2.1
poltergeist: 1.10.0
react-rails: 1.8.0
Capybara.javascript_driver = :poltergeist
options = {
timeout: 360,
logger: nil,
phantomjs_options: ['--load-images=no', '--ignore-ssl-errors=yes']
}
Capybara.register_driver(:poltergeist) do |app|
Capybara::Poltergeist::Driver.new app, options
end
We're writing modules using es6
transpiled by babel, and we don't have javascript errors in logs
Are you 100% all JS is getting transpiled to ES5 compatible? Unfortunately parse time errors for ES6 features like let
can be silently swallowed by PhantomJS, so you end up with no errors but also with no JS being actually run.
The problem: We were using Promise
, js
was getting transpiled well but phantomjs
does not recognize Promise
as well.
Thanks @twalpole