...options to disable password leak detection and suppress the warning. Problem When running Selenium tests with recent versions of Chrome and Chromedriver (e.g., version 136+), entering “unsafe” (weak or reused...

"This password has appeared in a data breach…" This alert can break automated test runs, especially in CI/CD pipelines. Solution You can disable Chrome’s password leak detection to...

Using RSpec matchers One rule of thumb I try to follow in capybara tests is using capybara matchers and not plain rspec matchers. One example: visit(some_page)

...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...

makandra dev

...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...

...is because Redis defaults to at most 16 databases (0 to 15) and running tests in parallel might exceed that (your tests might run on databases 1..n or...

query.matches // => true or false Detecting when the query result changes The #matches() method tests the current screen width. To be notified when the width changes, you need additional scripting...

...so that only this will be run. This is very useful when using a test runner like guard. Add the following config to spec/spec_helper.rb: RSpec.configure do |config| # These two settings...

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...

...updating the corresponding mailer preview can be forgotten very easily. Mailer previews can be tested like other code as well and I sometimes add the following tests to test suites...

relishapp.com

...want to define a global matcher since you need it only for your specific test, there are two ways to do it: Custom matcher for a single group

...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...

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...

makandra dev

...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...

If a project ist configured to spawn CI runners for tests or deployment when pushing to the Repo, a habit of pushing WIP commits regularly may conflict with that.

...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...

relishapp.com

...and not_change { Video.count } The above example will call playlist.destroy only once, but test both assertions. Note When you chain multiple Capybara matchers using and, Capybara will retry all matchers...

# At this point we want to stop in the debugger for all following tests, when the :lock call runs into the after_save $debug = true expect { user.lock }.to change...

...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...

...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

...consecutive calls of Time.now probably return two inequal values. Consider freezing time in your tests so it is not dependent on the speed of the executing PC: Timecop.freeze(Time.now.round) do...

developers.google.com

...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...

github.com

...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...

ruby-doc.org

...be an issue, but can be annoying to deal with during development and in tests. To avoid this use Rationals conversion_factor = Rational('1') / Rational('3.6') # => (5/18) result = Rational...