The rspec / capybara / poltergeist tests pass 100% locally, the random tests fai...
source link: https://www.codesd.com/item/the-rspec-capybara-poltergeist-tests-pass-100-locally-the-random-tests-fail-on-the-teamcity-ci-server.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
The rspec / capybara / poltergeist tests pass 100% locally, the random tests fail on the teamcity CI server
I have a bunch of rspec tests and roughly 30 of those are headless tests through capybara/poltergeist. Every time i run the tests locally, all 100% of the tests pass.
I recently set up a teamcity continuous integration server and the test results have been extremely inconsistent.
I ran the tests 10 times, without doing any changes between the tests. Only 1 of the rounds passed 100%. The others had 1-2 failures (most of them weren't the same), all relating to the headless browser testing. Here is an example of one of the failures:
ActionView::Template::Error: Couldn't find Spree::Address with id=1072978592
Stack trace:
./app/models/spree/order_decorator.rb:50:in `initialize_default_address'
./app/models/spree/order_decorator.rb:42:in `initialize_shipment'
./app/views/layouts/core.html.erb:23:in `_8cb98e121af585621c1d08e3ec1f6022'
./app/views/layouts/default.html.erb:14:in `_588b3208edc213a939dffd2ad73f4f26'
This failure is odd because i stubbed the function that looks for an address with an ID and returns a factorygirl model. I do not have this problem locally.
Here is another error from one of the test runs:
Capybara::ExpectationNotMet: expected to find link "10" but there were no matches
Stack trace:
./spec/features/simply_ship_spec.rb:102:in `block (2 levels) in <top (required)>'
Again, when i run this locally, this error doesn't happen, and when i switch to selenium and watch the test, the link is clearly there.
Both of these errors (not all, but a couple examples) happened individually, on different runs, without doing any updates to the project. Does anybody have any ideas why this is happening?
rspec-rails 2.14.0 capybara 2.1 poltergeist 1.3.0 rails 3.2.14 ruby 1.9.3 p448
You may try capybara-screenshot gem to clarify page state during fails.
Recommend
-
43
Ever tried inspecting the network traffic of any page and validating its response values? It's possible in Capybara if you are using the Poltergeist driver. The Poltergeist driver is a PhantomJS driver for Capyba...
-
5
Poltergeist 1.0! 7 October 2012 Almost a year ago, on a complete whim, I decided to try to hook up the headless browser PhantomJS with Ruby’s full-stack acceptance t...
-
9
Poltergeist 0.6.0: Javascript error handling and remote debugging 15 April 2012 Recently I pushed version 0.6.0 of Poltergeist. This version brin...
-
4
Poltergeist: A PhantomJS driver for Capybara 3 January 2012 This announcement is coming way later than I had originally intended. Last October I started experimenting with the idea of writing a driver...
-
5
RSpec - Uninitialized Constant Errors on Model Tests Jul 10, 2019 This one is an easy one but still tripped me up. I'm working on a project where generators on RSpec stub files are turned off (don't ask; disa...
-
8
RSpec tests for your Puppet manifests & modules Table of Contents Installation gem install rspec-puppet Note for ruby 1.8 users: while rspec-puppet itself supports ruby 1....
-
10
How RSpec helped me with resolving random spec failures
-
12
The following is an excerpt from my book, Rails Testing for Beginners. What we’re going to do One of the biggest challenges in getting started with testin...
-
5
Solving Flaky Tests in RSpecIncreasing the reliability of Flexport’s test suite with new Quarantine gem.Flaky tests are an unavoidable nuisance at every company, and Flexport is no exception. With the r...
-
4
How to Get Your Capybara System Tests Running in a Docker Dev Container on Apple Silicon
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK