Recreates the Capybara Screenshot bug.
Note: this can be fixed by switching to mattheworiordan/capybara-screenshot#205
-gem 'capybara-screenshot'
+gem 'capybara-screenshot', git: 'https://github.com/ArturT/capybara-screenshot.git',
+ branch: 'fix-reporter_module-loaded-twice'
git clone https://gist.github.com/2a1d73fd2f8cca15f38255995af035a2.git knapsack-pro-capybara-screenshot-bug-test
cd knapsack-pro-capybara-screenshot-bug-test
bundle install
export KNAPSACK_PRO_TEST_SUITE_TOKEN_RSPEC="xxx"
export KNAPSACK_PRO_REPOSITORY_ADAPTER=git
export KNAPSACK_PRO_CI_NODE_TOTAL=2
# Whichever one of these two commands runs two specs will show the error
env KNAPSACK_PRO_CI_NODE_INDEX=0 ./tests.sh
env KNAPSACK_PRO_CI_NODE_INDEX=1 ./tests.sh
git clone https://gist.github.com/2a1d73fd2f8cca15f38255995af035a2.git knapsack-pro-capybara-screenshot-bug-test
cd knapsack-pro-capybara-screenshot-bug-test
export KNAPSACK_PRO_TEST_SUITE_TOKEN_RSPEC="xxx"
export KNAPSACK_PRO_REPOSITORY_ADAPTER=git
export KNAPSACK_PRO_CI_NODE_TOTAL=2
# Whichever one of these two commands runs two specs will show the error
env KNAPSACK_PRO_CI_NODE_INDEX=0 docker-compose run app ./tests.sh
env KNAPSACK_PRO_CI_NODE_INDEX=1 docker-compose run app ./tests.sh
You can run this all in the one container also:
docker-compose run app bash
root@9ab279817bf3#:/app# env KNAPSACK_PRO_CI_NODE_INDEX=0 docker-compose run app ./tests.sh
root@9ab279817bf3#:/app# env KNAPSACK_PRO_CI_NODE_INDEX=1 docker-compose run app ./tests.sh
- Make sure you're running a 3.x Buildkite Agent.
- Create a pipeline with repository
https://gist.github.com/2a1d73fd2f8cca15f38255995af035a2.git
and a single step containingbuildkite-agent pipeline upload buildkite-pipeline.yml
- Run a build
- Whichever step runs two specs will show the error
15:45 $ docker-compose build && docker-compose run app ./tests.sh
Building app
Step 1/6 : FROM ruby:latest
---> 9de00c83e1f1
Step 2/6 : RUN apt-get update -yqq && apt-get install -fyqq curl libfontconfig1 libfreetype6 && curl -LO https://s3.amazonaws.com/shortstack-assets/phantomjs-2.1.1-linux-x86_64.tar.bz2 && bzcat phantomjs-2.1.1-linux-x86_64.tar.bz2 | tar xf - && mv phantomjs-2.1.1-linux-x86_64 /opt/phantomjs-2.1.1 && ln -s /opt/phantomjs-2.1.1 /opt/phantomjs && ln -s /opt/phantomjs/bin/phantomjs /usr/local/bin/phantomjs && rm phantomjs-2.1.1-linux-x86_64.tar.bz2
---> Using cache
---> fb05f227b429
Step 3/6 : WORKDIR /app
---> Using cache
---> e203f061d305
Step 4/6 : ADD Gemfile Gemfile.lock /app/
---> Using cache
---> 0c065b48670b
Step 5/6 : RUN bundle install
---> Using cache
---> f29fef0ed677
Step 6/6 : ADD . /app/
---> Using cache
---> 525db3425c31
Successfully built 525db3425c31
+++ :rspec: Running specs
I, [2017-03-31T04:45:18.927350 #6] INFO -- : [knapsack_pro] API request UUID: 1624d220-20e2-40ed-bc42-f0cd24226aee
I, [2017-03-31T04:45:18.927483 #6] INFO -- : [knapsack_pro] API response:
I, [2017-03-31T04:45:18.927645 #6] INFO -- : [knapsack_pro] {"queue_name"=>"195:80dd1e84f335637500c08c9549c59c7c", "build_subset_id"=>nil, "test_files"=>[{"path"=>"failing_2_spec.rb", "time_execution"=>nil}]}
I, [2017-03-31T04:45:18.927835 #6] INFO -- : [knapsack_pro] To retry in development the subset of tests fetched from API queue please run below command on your machine. If you use --order random then remember to add proper --seed 123 that you will find at the end of rspec command.
I, [2017-03-31T04:45:18.927909 #6] INFO -- : [knapsack_pro] bundle exec rspec --default-path *_spec.rb failing_2_spec.rb
I, [2017-03-31T04:45:19.151349 #6] INFO -- : [knapsack_pro] Test suite time execution queue recording enabled.
F HTML screenshot: file://tmp/capybara/screenshot_2017-03-31-04-45-21.649.html
Image screenshot: file://tmp/capybara/screenshot_2017-03-31-04-45-21.649.png
I, [2017-03-31T04:45:21.732778 #6] INFO -- : [knapsack_pro] Global time execution for tests: 0s
Failures:
1) Knapsack Pro queue mode #2 fails nicely w/ capybara-screenshot
Failure/Error: expect(page).to have_content 'Non-existent content'
expected to find text "Non-existent content" in "Hello World"
# ./failing_2_spec.rb:8:in `block (2 levels) in <top (required)>'
# /usr/local/bundle/gems/knapsack_pro-0.30.0/lib/knapsack_pro/runners/queue/rspec_runner.rb:42:in `run_tests'
# /usr/local/bundle/gems/knapsack_pro-0.30.0/lib/knapsack_pro/runners/queue/rspec_runner.rb:17:in `run'
# /usr/local/bundle/gems/knapsack_pro-0.30.0/lib/tasks/queue/rspec.rake:6:in `block (3 levels) in <top (required)>'
# /usr/local/bundle/gems/rake-12.0.0/lib/rake/task.rb:250:in `block in execute'
# /usr/local/bundle/gems/rake-12.0.0/lib/rake/task.rb:250:in `each'
# /usr/local/bundle/gems/rake-12.0.0/lib/rake/task.rb:250:in `execute'
# /usr/local/bundle/gems/rake-12.0.0/lib/rake/task.rb:194:in `block in invoke_with_call_chain'
# /usr/local/bundle/gems/rake-12.0.0/lib/rake/task.rb:187:in `invoke_with_call_chain'
# /usr/local/bundle/gems/rake-12.0.0/lib/rake/task.rb:180:in `invoke'
# /usr/local/bundle/gems/rake-12.0.0/lib/rake/application.rb:152:in `invoke_task'
# /usr/local/bundle/gems/rake-12.0.0/lib/rake/application.rb:108:in `block (2 levels) in top_level'
# /usr/local/bundle/gems/rake-12.0.0/lib/rake/application.rb:108:in `each'
# /usr/local/bundle/gems/rake-12.0.0/lib/rake/application.rb:108:in `block in top_level'
# /usr/local/bundle/gems/rake-12.0.0/lib/rake/application.rb:117:in `run_with_threads'
# /usr/local/bundle/gems/rake-12.0.0/lib/rake/application.rb:102:in `top_level'
# /usr/local/bundle/gems/rake-12.0.0/lib/rake/application.rb:80:in `block in run'
# /usr/local/bundle/gems/rake-12.0.0/lib/rake/application.rb:178:in `standard_exception_handling'
# /usr/local/bundle/gems/rake-12.0.0/lib/rake/application.rb:77:in `run'
# /usr/local/bundle/gems/rake-12.0.0/exe/rake:27:in `<top (required)>'
Finished in 2.53 seconds (files took 3.32 seconds to load)
1 example, 1 failure
Failed examples:
rspec ./failing_2_spec.rb:4 # Knapsack Pro queue mode #2 fails nicely w/ capybara-screenshot
I, [2017-03-31T04:45:27.003025 #6] INFO -- : [knapsack_pro] API request UUID: b4600cf2-378b-402e-948a-3859a5c3b3ae
I, [2017-03-31T04:45:27.004054 #6] INFO -- : [knapsack_pro] API response:
I, [2017-03-31T04:45:27.004167 #6] INFO -- : [knapsack_pro] {"queue_name"=>"195:80dd1e84f335637500c08c9549c59c7c", "build_subset_id"=>nil, "test_files"=>[{"path"=>"failing_3_spec.rb", "time_execution"=>nil}]}
I, [2017-03-31T04:45:27.004300 #6] INFO -- : [knapsack_pro] To retry in development the subset of tests fetched from API queue please run below command on your machine. If you use --order random then remember to add proper --seed 123 that you will find at the end of rspec command.
I, [2017-03-31T04:45:27.004386 #6] INFO -- : [knapsack_pro] bundle exec rspec --default-path *_spec.rb failing_3_spec.rb
I, [2017-03-31T04:45:29.247694 #6] INFO -- : [knapsack_pro] Global time execution for tests: 0s
Failures:
1) Knapsack Pro queue mode #2 fails nicely w/ capybara-screenshot
Failure/Error: expect(page).to have_content 'Non-existent content'
expected to find text "Non-existent content" in "Hello World"
# ./failing_2_spec.rb:8:in `block (2 levels) in <top (required)>'
# /usr/local/bundle/gems/knapsack_pro-0.30.0/lib/knapsack_pro/runners/queue/rspec_runner.rb:42:in `run_tests'
# /usr/local/bundle/gems/knapsack_pro-0.30.0/lib/knapsack_pro/runners/queue/rspec_runner.rb:17:in `run'
# /usr/local/bundle/gems/knapsack_pro-0.30.0/lib/tasks/queue/rspec.rake:6:in `block (3 levels) in <top (required)>'
# /usr/local/bundle/gems/rake-12.0.0/lib/rake/task.rb:250:in `block in execute'
# /usr/local/bundle/gems/rake-12.0.0/lib/rake/task.rb:250:in `each'
# /usr/local/bundle/gems/rake-12.0.0/lib/rake/task.rb:250:in `execute'
# /usr/local/bundle/gems/rake-12.0.0/lib/rake/task.rb:194:in `block in invoke_with_call_chain'
# /usr/local/bundle/gems/rake-12.0.0/lib/rake/task.rb:187:in `invoke_with_call_chain'
# /usr/local/bundle/gems/rake-12.0.0/lib/rake/task.rb:180:in `invoke'
# /usr/local/bundle/gems/rake-12.0.0/lib/rake/application.rb:152:in `invoke_task'
# /usr/local/bundle/gems/rake-12.0.0/lib/rake/application.rb:108:in `block (2 levels) in top_level'
# /usr/local/bundle/gems/rake-12.0.0/lib/rake/application.rb:108:in `each'
# /usr/local/bundle/gems/rake-12.0.0/lib/rake/application.rb:108:in `block in top_level'
# /usr/local/bundle/gems/rake-12.0.0/lib/rake/application.rb:117:in `run_with_threads'
# /usr/local/bundle/gems/rake-12.0.0/lib/rake/application.rb:102:in `top_level'
# /usr/local/bundle/gems/rake-12.0.0/lib/rake/application.rb:80:in `block in run'
# /usr/local/bundle/gems/rake-12.0.0/lib/rake/application.rb:178:in `standard_exception_handling'
# /usr/local/bundle/gems/rake-12.0.0/lib/rake/application.rb:77:in `run'
# /usr/local/bundle/gems/rake-12.0.0/exe/rake:27:in `<top (required)>'
2) Knapsack Pro queue mode #3 fails nicely w/ capybara-screenshot
Got 1 failure and 1 other error:
2.1) Failure/Error: expect(page).to have_content 'Non-existent content'
expected to find text "Non-existent content" in "Hello World"
# ./failing_3_spec.rb:8:in `block (2 levels) in <top (required)>'
# /usr/local/bundle/gems/knapsack_pro-0.30.0/lib/knapsack_pro/runners/queue/rspec_runner.rb:42:in `run_tests'
# /usr/local/bundle/gems/knapsack_pro-0.30.0/lib/knapsack_pro/runners/queue/rspec_runner.rb:46:in `run_tests'
# /usr/local/bundle/gems/knapsack_pro-0.30.0/lib/knapsack_pro/runners/queue/rspec_runner.rb:17:in `run'
# /usr/local/bundle/gems/knapsack_pro-0.30.0/lib/tasks/queue/rspec.rake:6:in `block (3 levels) in <top (required)>'
# /usr/local/bundle/gems/rake-12.0.0/lib/rake/task.rb:250:in `block in execute'
# /usr/local/bundle/gems/rake-12.0.0/lib/rake/task.rb:250:in `each'
# /usr/local/bundle/gems/rake-12.0.0/lib/rake/task.rb:250:in `execute'
# /usr/local/bundle/gems/rake-12.0.0/lib/rake/task.rb:194:in `block in invoke_with_call_chain'
# /usr/local/bundle/gems/rake-12.0.0/lib/rake/task.rb:187:in `invoke_with_call_chain'
# /usr/local/bundle/gems/rake-12.0.0/lib/rake/task.rb:180:in `invoke'
# /usr/local/bundle/gems/rake-12.0.0/lib/rake/application.rb:152:in `invoke_task'
# /usr/local/bundle/gems/rake-12.0.0/lib/rake/application.rb:108:in `block (2 levels) in top_level'
# /usr/local/bundle/gems/rake-12.0.0/lib/rake/application.rb:108:in `each'
# /usr/local/bundle/gems/rake-12.0.0/lib/rake/application.rb:108:in `block in top_level'
# /usr/local/bundle/gems/rake-12.0.0/lib/rake/application.rb:117:in `run_with_threads'
# /usr/local/bundle/gems/rake-12.0.0/lib/rake/application.rb:102:in `top_level'
# /usr/local/bundle/gems/rake-12.0.0/lib/rake/application.rb:80:in `block in run'
# /usr/local/bundle/gems/rake-12.0.0/lib/rake/application.rb:178:in `standard_exception_handling'
# /usr/local/bundle/gems/rake-12.0.0/lib/rake/application.rb:77:in `run'
# /usr/local/bundle/gems/rake-12.0.0/exe/rake:27:in `<top (required)>'
2.2) Failure/Error: example_failed_without_screenshot notification
SystemStackError:
stack level too deep
# /usr/local/bundle/gems/capybara-screenshot-1.0.14/lib/capybara-screenshot/rspec/text_reporter.rb:22:in `example_failed_with_screenshot'
# /usr/local/bundle/gems/capybara-screenshot-1.0.14/lib/capybara-screenshot/rspec/text_reporter.rb:22:in `example_failed_with_screenshot'
# /usr/local/bundle/gems/capybara-screenshot-1.0.14/lib/capybara-screenshot/rspec/text_reporter.rb:22:in `example_failed_with_screenshot'
# /usr/local/bundle/gems/capybara-screenshot-1.0.14/lib/capybara-screenshot/rspec/text_reporter.rb:22:in `example_failed_with_screenshot'
# /usr/local/bundle/gems/capybara-screenshot-1.0.14/lib/capybara-screenshot/rspec/text_reporter.rb:22:in `example_failed_with_screenshot'
# /usr/local/bundle/gems/capybara-screenshot-1.0.14/lib/capybara-screenshot/rspec/text_reporter.rb:22:in `example_failed_with_screenshot'
# /usr/local/bundle/gems/capybara-screenshot-1.0.14/lib/capybara-screenshot/rspec/text_reporter.rb:22:in `example_failed_with_screenshot'
# /usr/local/bundle/gems/capybara-screenshot-1.0.14/lib/capybara-screenshot/rspec/text_reporter.rb:22:in `example_failed_with_screenshot'
# /usr/local/bundle/gems/capybara-screenshot-1.0.14/lib/capybara-screenshot/rspec/text_reporter.rb:22:in `example_failed_with_screenshot'
# /usr/local/bundle/gems/capybara-screenshot-1.0.14/lib/capybara-screenshot/rspec/text_reporter.rb:22:in `example_failed_with_screenshot'
# /usr/local/bundle/gems/capybara-screenshot-1.0.14/lib/capybara-screenshot/rspec/text_reporter.rb:22:in `example_failed_with_screenshot'
# /usr/local/bundle/gems/capybara-screenshot-1.0.14/lib/capybara-screenshot/rspec/text_reporter.rb:22:in `example_failed_with_screenshot'
# /usr/local/bundle/gems/capybara-screenshot-1.0.14/lib/capybara-screenshot/rspec/text_reporter.rb:22:in `example_failed_with_screenshot'
# /usr/local/bundle/gems/capybara-screenshot-1.0.14/lib/capybara-screenshot/rspec/text_reporter.rb:22:in `example_failed_with_screenshot'
# /usr/local/bundle/gems/capybara-screenshot-1.0.14/lib/capybara-screenshot/rspec/text_reporter.rb:22:in `example_failed_with_screenshot'
# /usr/local/bundle/gems/capybara-screenshot-1.0.14/lib/capybara-screenshot/rspec/text_reporter.rb:22:in `example_failed_with_screenshot'
# /usr/local/bundle/gems/capybara-screenshot-1.0.14/lib/capybara-screenshot/rspec/text_reporter.rb:22:in `example_failed_with_screenshot'
# /usr/local/bundle/gems/capybara-screenshot-1.0.14/lib/capybara-screenshot/rspec/text_reporter.rb:22:in `example_failed_with_screenshot'
# /usr/local/bundle/gems/capybara-screenshot-1.0.14/lib/capybara-screenshot/rspec/text_reporter.rb:22:in `example_failed_with_screenshot'
# /usr/local/bundle/gems/capybara-screenshot-1.0.14/lib/capybara-screenshot/rspec/text_reporter.rb:22:in `example_failed_with_screenshot'
# /usr/local/bundle/gems/capybara-screenshot-1.0.14/lib/capybara-screenshot/rspec/text_reporter.rb:22:in `example_failed_with_screenshot'
# /usr/local/bundle/gems/capybara-screenshot-1.0.14/lib/capybara-screenshot/rspec/text_reporter.rb:22:in `example_failed_with_screenshot'
# /usr/local/bundle/gems/capybara-screenshot-1.0.14/lib/capybara-screenshot/rspec/text_reporter.rb:22:in `example_failed_with_screenshot'
# /usr/local/bundle/gems/capybara-screenshot-1.0.14/lib/capybara-screenshot/rspec/text_reporter.rb:22:in `example_failed_with_screenshot'
# /usr/local/bundle/gems/capybara-screenshot-1.0.14/lib/capybara-screenshot/rspec/text_reporter.rb:22:in `example_failed_with_screenshot'
# /usr/local/bundle/gems/capybara-screenshot-1.0.14/lib/capybara-screenshot/rspec/text_reporter.rb:22:in `example_failed_with_screenshot'
# /usr/local/bundle/gems/capybara-screenshot-1.0.14/lib/capybara-screenshot/rspec/text_reporter.rb:22:in `example_failed_with_screenshot'
# /usr/local/bundle/gems/capybara-screenshot-1.0.14/lib/capybara-screenshot/rspec/text_reporter.rb:22:in `example_failed_with_screenshot'
# /usr/local/bundle/gems/capybara-screenshot-1.0.14/lib/capybara-screenshot/rspec/text_reporter.rb:22:in `example_failed_with_screenshot'