makandra dev
web.archive.org

When testing your command line application with Aruba, you might need to stub out other binaries you don't want to be invoked by your test. Aruba Doubles is a...

selenium.dev

I recently stumbled over a problem that my feature tests broke in CI because of a mismatching chromedriver version. In this specific project we have a fixed Chromium version in...

...a Debian 12 environment instead of Chrome. The tests however used a recent chrome version instead. $ chromedriver --version ChromeDriver 117.0.5938.149 (e3344ddefa12e60436fa28c81cf207c1afb4d0a9-refs/branch-heads/5938@{#1539}) $ chromium --version Chromium 117.0.5938.149 built on...

Jasmine comes with two matchers that test for equality. The first is toBe: expect(first).toBe(second) toBe passes when first === second. Unfortunately this is useless for non-primitive values...

...teach toEqual additional notions of equality. E.g. the following code will teach toEqual to test two jQuery collections for equality: beforeEach -> jasmine.addCustomEqualityTester (first, second) -> if first instanceof jQuery && second instanceof...

When you need to see the content of a page (i.e. not all the HTML but the relevant text body...

makandra dev

# Redis db#1 is used for development. db_number = 1 if rails_env == 'test' normalized_test_number = [ENV['TEST_ENV_NUMBER'].to_i, 1].max db_number += normalized_test...

While we are used to run our JavaScript tests on a test page within our Browser, it's also possible to run them on the command line with NodeJS. I...

...think that's actually the most common way to run JS tests. Given a Vue project that uses Jest (via vue-cli-service) with the following package.json: { "scripts": { "test": "vue...

...favicon.ico in your project but also PNGs of different sizes and backgrounds, you should test if all those files are actually reachable. Here are a few selectors to get you...

...pass visible: false for each selector so Capybara can find them. Example The following test was taken from a project using ActionDispatch::IntegrationTest. Though we usually use RSpec, this should...

github.com

...to 127.0.0.1:1025. Usually you want the following config in config/environments/development.rb and maybe in test.rb or cucumber.rb. config.action_mailer.delivery_method = :smtp config.action_mailer.smtp_settings = { :address => 'localhost', :port => 1025 } Now you can see...

rspec.info

Don't use reruns as a mean to work around flaky tests. You should always try to fix those instead of rerunning them regularly. Setup Configure RSpec to persist...

...the result of your test runs to a file. This is necessary to be able to rerun examples. Add this to your spec/spec_helper.rb : config.example_status_persistence_file_path = 'spec/examples.txt'

Webpack is the future. We're using it in our latest Rails applications. For tests, we want to compile assets like for production. For parallel tests, we want to avoid...

Here is our solution for all that. Its concept should work for all test suites. Copy the following to config/initializers/webpacker_compile_once.rb. It will patch Webpacker, but only for the test...

stackoverflow.com

These methods are available to you: page.driver.browser.switch_to.alert.accept page.driver.browser.switch_to.alert.dismiss page.driver.browser.switch_to.alert.text # the confirmation text Spreewald gives you steps like these:

...method to (un)check checkboxes. But there's one problem, if you want to test a custom styled checkbox, which hides its -Tag: The methods cannot (un)check checkboxes without...

...Some label', allow_label_click: true). Solution 2 Make hidden inputs visible in integration tests via data-environment. Depending on your CSS framework you also need to adjust the z...

When your cucumber features grow massively over time, the test execution can take a lot of time. One easy way to speed up your test execution is to use the...

...parallel_tests gem. It comes along with some useful rake tasks that let you setup your local test environment shortly to run your features, specs or unit-tests in parallel...

...that behave differently (like mobile vs desktop navigation menus). Since you want your integration tests to behave consistently, you want to set a specific size for your tests' browser windows...

...simply switch the driver via Capybara.current_driver = :selenium. If you use Cucumber for integration testing, wrap that into something like Before('@javascript') {...

Benefits of using device metrics are:

makandra dev

10.0.0 2024-03-07 Compatible changes console command: You can now globally disable the IRB multiline feature by setting irb...

If you need a sample video with certain properties for a test you can create one using ffmpeg. You might want a very low bitrate file to speed up processing...

...in your test. (e.g. you only care about the length, then you can create a video with a very low resolution and framerate) Create a 21s video with 1fps and...

We prefer to run our end-to-end tests with headless Chrome. While it's a very stable solution overall, we sometimes see the headless Chrome process freeze (or the...

...Capybara driver losing connection, we're not sure). The effect is that your test suite suddenly stops progressing without an error. You will eventually see an error after a long...

makandra dev

Just found out about a great feature in Rails that seems to be around since Rails 2. Start a console...

Jasmine has spyOnProperty(), but it only works if the property is implemented using getter and setter functions. This is a...

...your stubs, so it is always http://example.com/?foo[]=1&foo[]=2&foo[]=3. This might lead to green tests, but in fact crashes in real world. Rack::Utils.build_nested_query might help to build...

...some HTTP requests to fetch the data we want to check for certain criteria. Testing this in the real world can be slow and inconvenient, when we aren't able...

makandra dev

I recently was in a weird situation where my (Jest/CLI) tests were referencing a function that was no longer part of my code - I had just refactored it. Apparently Jest...

We currently test most of our gems on Travis CI, but want to migrate those tests to Github Actions. This is a step-by-step guide on how to do...

...Gemfiles needed which database, but is not currently very smart about it. If your test.yml does not set up the database correctly, please adjust it by comparing it with...

...usually just want to print error messages), but it can be useful when writing tests. As an example, consider the following model which uses two validations on the email attribute...