...Locally or Prefetch Store in LocalStorage with Base64 Encoding Another Method Web Font Performance Tests Google Fonts Test Web Safe Font Test Local Fonts Test Third Party: Typekit Test
...paint or render of your text, so you can avoid FOIT. Remember to run tests for 3G connections as well because mobile users might have a worse experience as opposed...
...for the first time (bundle install, create database.yml, create databases, migrate), optionally run all tests (--test) or load a dump (--dump staging) update: update a Rails project that has been...
...open a shell on a Capistrano target, optionally selecting the server with --select-server tests: run all employed tests; checks for: Cucumber, RSpec, Test::Unit and rake with-firefox-for...
tl;dr: Always have your attachment path start with :rails_root/storage/#{Rails.env}#{ENV['RAILS_TEST_NUMBER']}/. The directory where you save your Paperclip attachments should not look like this: storage/photos/1...
...storage/attachments/1/... storage/attachments/2/... The problem with this is that multiple environments (at least development and test) will share the same directory structure. This will cause you pain eventually. Files will get...
...fast binstubs like bin/rails or bin/rspec which avoid Rails boot time. You want parallel_tests to speed up full test runs of large test suites. Unfortunately, you do not want...
...parallel_tests to use your Spring binstubs as those parallelized tests will share data and/or loose some information. There are some issues about this on GitHub and there is a...
...or when you accidentally interact with the browser frame. This will result in flickering tests, which are "randomly" red and green. In fact, this behavior is not random at all...
...better understanding of Selenium focus issues, and what you can do to get your test suite stable again. Preventing accidental interaction with the Selenium window When Selenium windows steal your...
...subsequent ESR releases overlap for three months. This way enterprises have a quarter to test the new version and migrate their clients...
...you don't need to check the input of hidden fields in an integration test. But e.g. waiting for a datepicker library to write the expected value to this field...
...before continuing the test, which prevents flaky tests, is a valid use case...
...not to include 3 Applications Tip This can be used to test for exclusion of multiple values all at once...
Consider this class: class Foo private def test puts "Hello" end end While you can say create a block to call that method (using ampersand and colon) on Ruby...
...Foo.new.tap(&:test) Hello => # ... you cannot do that on Ruby 1.9 or 2.0: 1.9.3 > Foo.new.tap(&:test) NoMethodError: private method `test' called for # ^ 2.0.0 > Foo.new.tap(&:test) NoMethodError: private method `test' called for...
...and check if your application responds and everything looks okay. Run your application's tests...
...behavior, not give you a safe string in the end (see below). Example def test(input) input.gsub /(f)/ do puts $1 'b' end end >> test('foo') f => "boo"
...files from the dist folder, which is most often <ES6 javascript. 9. Achieve green tests. 10. Check if postcss, uglifier, babel and other compilers work for production. This can be...
...Specs with --backtrace option Run Cucumber features (with Geordi's --debug option) When all tests are green, look through your Gemfile and remove as many version constraints as possible.
Update rspec to '< 2' Lock haml to '= 3.1.7' Unlock andand Unlock rake Lock test-unit to '= 1.2.3' Lock database_cleaner to '< 1.3' Lock cucumber to '< 2'
Note: This technique is confusing and slows down your test suite. Copy the attached code to features/support. This gets you a new Cucumber tag @no_parallel which ensures that the...
...scenarios not tagged will @no_parallel can still run in parallel with the tagged test. Please read the previous sentence again. This can help when multiple test processes that access...
...Angular app employs uiRouter, although it is not used nor actually required for this test. Working test setup # Capitalized expressions are intended to be replaced with YOUR values describe 'SERVICE...
...httpBackend.verifyNoOutstandingExpectation() @$httpBackend.verifyNoOutstandingRequest() describe 'FUNCTION()', -> it 'does something', -> # Maybe some code here # Call function under test (triggers API request, which will be intercepted) @SERVICE.FUNCTION()
...do something before request is answered
...on a Rails project a bundle install will get you back the gems. Run tests Now run your test suite to see if the migration was successful. Troubleshooting: Use an...
You know that Devise offers RSpec test helpers for controller specs. However, in request specs, they will not work. Here is a solution for request specs, adapted from the Devise...
...wiki. We will simply use Warden's test helpers -- you probably already load them for your Cucumber tests. First, we define sign_in and sign_out methods. These will behave...
...to make it accessible from other machines in the local network, e.g. with a test iPad Improve geordi tests: If rake runs tests, skip other test runs (cucumber, rspec), as...
...rake usually runs all employed tests Rename geordi devserver to geordi server (the former is still supported) Improved command descriptions and README Fix geordi firefox --setup: Fail on missing version...
...user hovers over the button, or when the article is scrolled into view). 6. Test it! There is so much that can go wrong with the buttons or how the...
...share dialog popups interact with your layout. Always test with each social network. Consider using a fake profile for this so you don't annoy your real life friends...
...inserted data in a migration or when you had to kill -9 a frozen test process. Old Capybara versions already have the Database Cleaner gem as dependency. Otherwise add database...
...Rake task by copying the attachment into lib/tasks/clean_database.rake. Now you can e.g. clean the test database by saying on the shell: rake db:clean RAILS_ENV=test
...Selenium note, I found yet another solution for the problem to hide your selenium tests away. This has the advantages ^ not to require a gem (so you do not force...
...at the running webdriver if necessary Simply make a script that runs your cucumber tests and runs this before: vncserver :6 -localhost -nolisten tcp -SecurityTypes None &>/dev/null DISPLAY=":6"
When you want to test how an web-application reacts in a specific resolution, you can set up a specific Selenium driver for some tests: Before('@chrome320x480') do Capybara.current_driver...
...your path. You can also set a special binary you only use for theese tests. You set up the driver in a file like this # features/support/chrome.rb Capybara.register_driver :chrome320x480 do...
...expect(timerCallback).not.toHaveBeenCalled(); jasmine.clock().tick(101); expect(timerCallback).toHaveBeenCalled(); }); If you actually want the test to wait out the timer, your example function needs to accept a done argument, which...
...you then call when the test is expected to finish: it("causes a timeout to be called", function(done) { setTimeout(function() { timerCallback(); }, 100); setTimeout(function() { expect(timerCallback).toHaveBeenCalled();
...that running the Ruby garbage collector only every X seconds can speed up your tests. I found that deferring garbage collection would speed up my RSpec examples by about...
...but it probably depends on the nature of your tests. I also tried applying it to Cucumber features, but found no performance improvements. Since Joe is using Test::Unit in...