...XrayWrapper [object HTMLInputElement]] (Selenium::WebDriver::Error::MoveTargetOutOfBoundsError) I had the Terminal window running the test on my secondary screen, whereas the Selenium-webdriven Firefox always started on my primary one...
...Now if I had focused the secondary screen when running the tests, Selenium could not start Firefox and switch to it (probably because the screens are split), generating the above...
...silence some specific warnings. Add this to your initializers, or require it in your tests: silenced = [ /Not considered a useful test/, /use: should(_not)? have_sent_email/, ] # list of warnings...
In case your integration tests crash with a message like below, try to upgrade Capybara to a newer version (3.35.3 was good enough). You might encounter this issue when you...
...Listening on localhost:36309, CTRL+C to stop If you are running parallel tests with thin, this will clutter you output. Disable thin logging with these lines: # e.g. in features/support/thin.rb...
Thin::Logging.silent = true Note that this disables all logging in tests. Instead, you also might set a different logger with Thin::Logging.logger = . See Thin::Logging for details...
When using geordi for integration tests you might get the following error when trying to run geordi cucumber: unable to obtain stable firefox connection in 60 seconds (127.0.0.1:7055) (Selenium...
...WebDriver::Error::WebDriverError) This means, that the vnc window the tests is talking to has no proper firefox version running. To figure out the issue this might help you:
...they are wrapping the same native DOM elements: $('body') == $('body') // false In order to test if two jQuery objects refer to the same native DOM elements, use is:
Jasmine equality matcher for jQuery See here for a custom Jasmine matcher that tests if two jQuery objects are equal...
PostgreSQL supports the SQL OVERLAPS operator. You can use it to test if two date ranges overlap: => SELECT ('2001-02-16'::date, '2001-12-21'::date) OVERLAPS...
...date, '2002-10-30'::date); overlaps -------- false Also compare our card Test if two date ranges overlap in Ruby or Rails...
When testing Ruby code that prints something to the terminal, you can test that output. Since RSpec 3.0 there is a very convenient way to do that. Anything that writes...
...print) can be captured like this: expect { something }.to output("hello\n").to_stdout Testing stderr works in a similar fashion: expect { something }.to output("something went wrogn\n").to...
...if you make any error in programming. E.g. a simple typo would make the test above green. The block will catch the Spec:: exception and the test will be happy...
...guaranteed to be 100% accurate. It performs a "best guess" based # on a simple test of the first +File.blksize+ characters. # # Example: # # File.binary?('somefile.exe') # => true # File.binary?('somefile.txt') # => false #-- # Based on code...
To start a workflow manually it must have a trigger called workflow_dispatch: --- name: Tests on: push: branches: - master pull_request: branches: - master workflow_dispatch: branches: - master In the Actions...
...a transformable example of katapult's features Development Add katapult update script Speed up tests (now running in about 9 min) Improve development workflow (see README) No bundler issues in...
...tests any more
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...
...page is a collection of common markdown XSS payloads which is handy for writing tests. Producing arbitrary links: [Basic](javascript:alert('Basic')) [Local Storage](javascript:alert(JSON.stringify(localStorage))) [CaseInsensitive](JaVaScRiPt...
If you want to have routes that are only available in tests (e.g. for testing obscure redirects), you can use the with_routing helper -- but that one destroys existing routes...
...may break a specs that require them to work. To keep both "regular" and test routes, do this: class MyApplicationController < ActionController::Base def show render text: 'Welcome to my application...
...REVISION', 'utf-8').trim() } catch(_error) { // okay, probably in dev mode } environment.loaders.prepend('fa-font', { test: /fa-.*\.(woff2|woff|eot|svg|ttf)$/, use: [{ loader: 'file-loader', options: { name: '[path][name]-[hash...
...data to a new schema. If you have different versions, you always need to test all different version if required. With FactoryBot this should be traits. The JSON Schema files...
betterspecs.org is a documentation on how to write better RSpec tests. Note that there are also other approaches like The Self-Contained Test, which is complementary to the dry-approches...
Unfortunately, by default plugin tests are pretty bland. They use the plain unit test suite supplied by Ruby, and not any of the extended Rails test framework. This will leave...
...our plugin’s test classes with no access to fixtures, database.yml configuration, or any of those nice class auto-loading features...
...fix" this in multiple ways: Update your drivers on your machine with RAILS_ENV=test rake webdrivers:chromedriver:update Ignore the driver update-URL in your VCR configuration
...table ("rotate" it by 90 degree). The tool can be handy if you have tests with large markdown tables for testing contents of a flat json structure or csv.
...of matched elements to those that match the selector or pass the function's test. jQuery has a select method, but it has nothing to do with navigating the DOM...
...the following command open a database console for the development environment: rails dbconsole -p test You need to write this instead: rails dbconsole test -p
If you’re testing the behavior of deprecated code in your Ruby project, the warning messages littered throughout your spec output is incredibly noisy. You could silence all warnings with...
...an important warning in one of your dependencies. It’s tempting to remove the tests altogether (the code will be burned soon too, right?), but I figured out something a...