-
Notifications
You must be signed in to change notification settings - Fork 752
Closed
Description
Hi guys!
I'm trying to get some rspec+capybara tests up and running on a rails app with react-rails but the tests appear to be failing. I'm using rspec-core v2.13.1 and I've tested against capybara v2.1.0, capybara-webkit v1.0.0, and phantomjs/poltergeist v1.4.1.
On poltergeist I'm seeing this error:
1) Minimum App React.js should load on the main page and render 'Hello World'
Failure/Error: visit root_path
Capybara::Poltergeist::JavascriptError:
One or more errors were raised in the Javascript code on the page. If you don't care about these errors, you can ignore them by setting js_errors: false in your Poltergeist configuration (see documentation for details).
TypeError: 'undefined' is not a function (evaluating 'RegExp.prototype.test.bind(
/^(data|aria)-[a-z_][a-z\d_.\-]*$/
)')
TypeError: 'undefined' is not a function (evaluating 'RegExp.prototype.test.bind(
/^(data|aria)-[a-z_][a-z\d_.\-]*$/
)')
at http://127.0.0.1:15151/assets/react.js:1498
at http://127.0.0.1:15151/assets/react.js:6 in i
at http://127.0.0.1:15151/assets/react.js:6
at http://127.0.0.1:15151/assets/react.js:5483
at http://127.0.0.1:15151/assets/react.js:6 in i
at http://127.0.0.1:15151/assets/react.js:6
at http://127.0.0.1:15151/assets/react.js:2975
at http://127.0.0.1:15151/assets/react.js:6 in i
at http://127.0.0.1:15151/assets/react.js:6
at http://127.0.0.1:15151/assets/react.js:11467
at http://127.0.0.1:15151/assets/react.js:5
at http://127.0.0.1:15151/assets/react.js:11468
ReferenceError: Can't find variable: React
ReferenceError: Can't find variable: React
at http://127.0.0.1:15151/assets/application.js:4
# ./spec/features/minimums_spec.rb:6:in `block (3 levels) in <top (required)>'
With capybara, I'm seeing something similar (but it's not as explicit)
pry(#<RSpec::Core::ExampleGroup::Nested_2::Nested_1>)> page.driver.console_messages
=> [{:line_number=>0,
:message=>"TypeError: 'undefined' is not a function",
:source=>"undefined"},
{:line_number=>0,
:message=>"ReferenceError: Can't find variable: React",
:source=>"undefined"}]
Printing out the page I see that react.js is getting loaded but it's not doing anything in the test. It should be adding 'Hello World!' inside of #content
.
pry(#<RSpec::Core::ExampleGroup::Nested_2::Nested_1>)> print page.html
<!DOCTYPE html><html><head>
<title>PotentialBatman</title>
<link href="/assets/application.css" media="all" rel="stylesheet">
<script src="/assets/react.js"></script>
<script src="/assets/application.js"></script>
</head>
<body>
<h1>StaticPages#home</h1>
<p>Find me in app/views/static_pages/home.html.erb</p>
<div id="content"></div>
</body></html>=> nil
If I open the page in the browser it works perfectly. Are there any other test configurations that need to be setup?
Metadata
Metadata
Assignees
Labels
No labels