Comments (10)
Short answer: try deleting public/assets
.
Longer answer:
I got this error today calling page.execute_script
from Capybara. I'm serving jQuery from the asset pipeline, not from a CDN. After some investigation, I found:
- Calling
sleep 30
beforepage.execute_script
made no difference. bundle update
made no difference.save_and_open_page
showed that the JS was included from the<head>
element.- The jQuery code was included in compiled
public/assets/application-[hash].js
. - However, recent changes to custom JavaScript files were not included in the compiled JS.
Based on that last observation, I guessed that there was a weird interaction between Poltergeist and precompiled assets. On this hunch, I deleted public/assets
. That resolved the issue.
from poltergeist.
@jonatasrancan Because PhantomJS (used by Poltergeist) is basically equivalent to 7 year old version of Safari, and in dev mode you`re using a real browser. Itβs time to move to a more modern Capybara driver.
from poltergeist.
Does it work with other drivers? (e.g. selenium or capybara-webkit)
from poltergeist.
Nope, same issue with capybara-webkit. Hence, it could just be a config issue with the rails test env or cucumber env but I've looked into doing whatever I could with these with no luck.
Do you know if anyone uses jQuery with poltergeist?
How would I even start figuring out how to solve this?
from poltergeist.
Okay, this doesn't look like an actual bug in Poltergeist. It sounds like you need some help configuring your test environment, so I suggest you post to a help forum like Stack Overflow.
from poltergeist.
I found this was a problem with cdn loaded versions of jquery from ajax.googleapis.com or code.jquery.com. It was fixed when I downloaded and served the jquery files as part of my app.
from poltergeist.
I ran into this same issue recently. The problem was we were pulling assets from a CDN (Amazon Cloudfront). Amazon recently disabled SSLV3. Poltegeist version 1.5.1 or before uses SSLV3 as its default ssl protocol. As a result, no assets from Amazon cloudfront would load. The easy fix is to set the ssl setting '--ssl-protocol=any' when calling poltergeist. This issue has been resolved in the next version of Poltergeist, that has not yet been released. See Issue 544.
from poltergeist.
For me, dropping the https:
in the cdn href made the difference. I was having this same issue on Master.
from poltergeist.
I'm having the same issue here, and couldn't figure out how to solve yet. I'm loading jquery from gem 'jquery-rails'
, it works fine when I run the server, but in my feature tests not.
from poltergeist.
I faced the same problem
Failure/Error: click_on 'Login'
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).
ReferenceError: Can't find variable: $
Only on the test environment.
And after some investigation, I found out that trying to pass a default value on a param, was causing the problem.
I had this function:
drawInput: function(inputName, inputClass, value, rowIndex, columnIndex, readonly = false)
And the problem was the readonly = false
.
After changing it to drawInput: function(inputName, inputClass, value, rowIndex, columnIndex, readonly)
, the tests started working without problem.
I know that default value on function params exist since ES6/ES2015, but what I don't get is why that worked on development and on tests it failed.
from poltergeist.
Related Issues (20)
- React event not triggered [help] HOT 2
- Capybara::Poltergeist::TimeoutError in some environments HOT 23
- ReferenceError: Can't find variable: Audio HOT 1
- React components not loading HOT 1
- Following jQuery line of code does not work in anything above v1.8.1 HOT 8
- Typo in keys method HOT 1
- Version of JS supported HOT 1
- Broken rails UJS loading when use arrow functions HOT 1
- Timeout occurs causing all following javascript tests to fail. HOT 3
- Capybara::Poltergeist::StatusFailError on 302 redirects with port numbers HOT 2
- Future of Poltergeist HOT 14
- Screenshot is not created HOT 1
- Authz request header missing HOT 5
- User agent does not persist across windows HOT 3
- Capybara::Poltergeist::TimeoutError when running CI tests HOT 7
- current_url returns empty string on about:blank HOT 3
- page.current_path always root HOT 2
- Possible make a method that check if JS Alert exist
- TypeError When dealing with link clicks via Capybara::Session HOT 2
- Capybara::Poltergeist::StatusFailError: failed to reach server (but manually I can connect perfectly) HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from poltergeist.