...sharing was completed. Note that this will only work on https pages, so to test it in development, you will have to start your development server with SSL...
...text-transform: uppercase - especially on form labels - can cause you serious headaches in Selenium tests. Sometimes the web driver will see the uppercase text, sometimes it won't, and umlauts...
...will be a problem as well. Simply disable it in tests, by adding a body class for tests %body{'data-environment' => Rails.env} overriding the transforms [data-environment="test"] * text-transform...
...display the video. When you deliver your youtube video via https://youtu.be/jyElDp98HdI your test which checks that the embeded video is rendered in the view will fail because your...
...test server doesn't use https Solution Let your links look like //youtu.be/jyElDp98HdI and you will be fine, server side and test side...
...format before you can use it for plotting: Numo.gnuplot do .. # more plot settings plot "'test.csv'", u: "(hist($#{column_to_plot},width)):(1.0)" s: true, f: true, ...
output "hist.jpg" end
...write any array files into a temporary csv file before passing it Numo.gnuplot: CSV.open('test.csv', 'w') do |csv| random_values.zip(additional_values, absolute_values, other_values).each_with_index do |zipped...
...up DOM elements. There are also matchers like have_field to make expectations during tests. These methods also have a number of options to influence the lookup. E.g. the :disabled...
...to use Edge Rider for new projects, which is being actively maintained and has test coverage for all versions of Rails...
...Cucumber the way you want it: Prints some line feeds to easily find your test results when you come back to the console later Configures Cucumber to use cucumber_spinner...
...features if you setup your system that way Runs features in parallel if parallel_tests gem was found in you Gemfile and no rerun.txt with content exists [UPDATE] You can...
In Paperclip you can use the validates_attachment_file_name macro to test the suffix of a filename: class User < ActiveRecord::Base has_attached_file :avatar validates_attachment...
Then I should see a table with exactly the following rows: ... Testing tables with colspan or rowspan Cucumber tables are required to have the same number of...
...cells in every row. This is unfortunate when testing a table that uses colspan or rowspan attributes. The attached step definition offers a workaround for this: Wrap the entire table...
...this prior art when implementing yours? Checklist: I confirm my design implementation has been tested manually by me adheres to the code style of the project (e.g. BEM) avoids "magic...
...navigates through elements in order (or in an order that makes sense). You can test that by clicking into the page, top/left of the new design, and repeatedly pressing the...
...provides some instructions how you can get it to work with your cucumber acceptance tests using selenium webdriver as a capybara driver. Install xvfb if it is not installed yet...
...window, you can tag it with @no-headless. Note: If you are using paralell_tests to run your tests in parallel you have to take care of several things to...
...SE_AVOID_STATS=true or project based # spec_helper.rb ENV['SE_AVOID_STATS'] = 'true' To test if it works Go offline Remove ~/.cache/selenium/se-metadata.json Run a JS feature spec
...show the message "Your account is not activated yet." super && active? end end Your tests should at least cover: Signed in users are logged out on the next request once...
...column} <@ array[:expected_values]", expected_values:) end end ..and include their specs to your test suite: describe ApplicationRecord do describe '.where_array_matches!' do let!(:matching_user) { create(:user, movie...
...that have not been updated in a while Update a single gem conservatively Run tests Deal with the pain Update the next gem It's also advisable to only update...
Don't insert table rows in a Rails database migration. This will break tests that expect that database to be empty and cause you all sorts of pain.
...for the required model Write the controller first for the required model Write the tests first for the code bad: While doing this you can for example see easier when...
...that, so I hope it will be fixed with a future release. The following test succeeds: context 'factories' do let(:test_case) { FactoryBot.create(:test_case) } it 'are valid' do
...test_case).to be_valid end end But when I did the same in byebug the following happened: (byebug) FactoryBot.create(:test_case) *** NameError Exception: uninitialized constant # ::TargetLimitation
...don't need any "conversion" hacks which try to replace commas with dots. Additionally, tests which control browsers with Selenium will also see point-formatted values on non-English locales...
...the number of requests for a single IP address. Bash Command awk '{ print $1}' test.log | sort | uniq --count Result 1 87.140.79.41 3 87.140.79.42 Explain awk '{ print $1}' test.log...
...configuration.rb With this approach you have a stronger decoupling in your application: Your unit tests might use Webmock or VCR for the lib/github_client part, but your application only talks to...
...marked for destruction self.amount = invoice_items.reject(&:marked_for_destruction?).sum(&:amount) end end How to test the correct behaviour in rspec it 'ignores invoice items marked for destruction in a nested...
...simple. This way, you can also mock the LLM calls in local and CI tests. See also How to add RAG to your Rails application: vector search end-to-end...
...pages with body text. Pages with scattered content (infographics, posters) may lose relevant information. Test with representative samples. Alternative: OCR-driven strip segmentation (split instead of trim) The autocrop above...