Some helpers for poking around at your Capybara driven browser's cookies in integration tests. Supports Capybara's bundled drivers (rack-test, Selenium Webdriver), and adapters for other drivers may...
Re-creating a complex ActiveRecord scenario quickly without setting up a full-blown Rails app can come in handy e.g...
...authorized users only 3. Using the same storage folder for multiple Rails environments or test processes This one affects your developers. If an image with ID 4 always ends up...
...as public/system/images/4.jpg, multiple Rails environments (e.g. development and test) will randomly see and overwrite each other's files. See Always store your Paperclip attachments in a separate folder per environment...
Geordi 0.16+ supports running selenium tests with project-specific firefox versions. Just update the gem. It will still default to using the old 5.0.1 firefox. If you want another one...
This cucumber step is useful for testing an image (looking at the src of the image). Then(/^I should see the image "([^"]*)"$/) do |filename_with_extension| expect(page).to have...
Then I should see the image "placeholder.png" Outline: Read more about how to test a uploaded file here, e.g. file downloads...
sudo gem install parallel script/plugin install git://github.com/grosser/parallel_tests.git Adapt config/database.yml test: database: xxx_test<%= ENV['TEST_ENV_NUMBER'] %> Create test databases script/dbconsole -p CREATE DATABASE `xxx...
... Generate RSpec files script/generate rspec (you'll probably only let it overwrite files in script/) Prepare test databases Now and after each migration: rake parallel:prepare Run tests
...en”. They reappear when Chrome gets updated. This may help you running your Selenium tests using the Chrome driver on applications that choose the language from what the browser sends...
I had to deal with JavaScript Undefined Error while accessing a specific CKEditor instance to fill in text. Ensure everything...
...behavior to be impractical, but it is by design. In order to perform a test or action in all matching elements, do not use within but prefer the attached "inside...
...work across all revisions that you will be bisecting. If you're referencing a test file that's under version control, make sure you always run the correct test.There are...
...that are built into RSpec. Play with some of these matchers in your MovieDB tests. The benefits of using better matchers Which of the following two lines is better? Why...
...in your MovieDB. It saves a duplicate of the movie, copying all the attributes. Test this method using your new have_same_attributes_as matcher. Tip ActiveSupport gives your arrays...
Spreewald now comes with a step that tests if a form field is visible: Then the "Due date" field should be visible But the "Author" field should not be visible...
...checks if that field is hidden via CSS (or Javascript). It is not currently tested if the label is visible or hidden. For this see: Check that an element is...
When using state_machine you sometimes need to know whether an object may execute a certain transition. Let's take...
...URL, which can lead to errors when you have absolute URLs in your Cucumber tests. If you really need to use absolute URLs somewhere, say in an email you send...
Single step and slow motion for Cucumber scenarios can come in handy, especially in @javascript scenarios. # features/support/examiners.rb AfterStep('@slow_motion...
Mornings can be rough. To make them a little easier, leave yourself a failing test if your work isn’t finished. When you come back to the project, it makes...
When you are scrolling up to investigate a test failure it is super annoying when the terminal scrolls back down whenever the running test outputs another line. Luckily you can...
The pages listed here contain tests and experiments about features, possibilities, browsers’ bugs concerning CSS. That is, over 200 experiments...
...implement sending an error notification if the data (in the db) is too old. Testing: If you use sidekiq_retries_exhausted (unit test): https://stackoverflow.com/questions/33930199/rspec-sidekiq-how-to-test-within-sidekiq-retries-exhausted-block-with-another If you use the...
...global option (manual test): # Use this worker to test if the exception notifier for sidekiq works as expected and the retries total duration fits. # Example: TestWorker.perform_async('foo', 'bar')
This note describes a Cucumber step definition that lets you test whether or not a CSS selector is present on the site: Then I should see an element "#sign_in...
One of many useful techniques when your test suite needs to talk to a remote API...
...x86_64 -cdrom filename.iso If you prepared a USB pen drive and want to test it, run it like this (/dev/sdx being your device name; you may need to sudo...
...to config/initializers.rb. In the same initializer, type a line: Undebug.trace_message('foobar') Now run tests or whatever you need to do to to trigger that message. The console output should...
In order to go back one page in your Cucumber tests, you can use the following step definition for Capybara: When(/^I go back$/) do visit page.driver.request.env['HTTP_REFERER']