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

makandra dev

helps you debugging errors like DNS lookup limit reached it also lets you test a new SPF strings before applying it. This can save you time as you don...

...with operations Also the advanced check at vamsoft.com has a very good interface to test new SPF policies...

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

...cleaner gem with strategy :transaction, after_commit callbacks will not be fired in your tests. Rails 5+ Rails 5 has a fix for this issue and no further action is...

Rails 3, Rails 4 Add the gem test_after_commit to your test group in the Gemfile and you are done. You don't need to change the database...

To set a cookie in your test browser for cucumber tests, you need to know which driver you are using. Use the step below according to your driver.

...cookie set to "([^\"]+)"$/ do |key, value| Capybara.current_session.driver.set_cookie(key, value) end Usage in feature tests Given I have a "page_views" cookie set to "42" When I visit the start...

makandra dev

...environment configuration. This is useful for keeping log files manageable, especially in development and test environments. # config/environments/development.rb Rails.application.configure do config.log_file_size = 10.megabytes end When this value is set, Rails...

github.com

Setting array columns When using PostgreSQL array columns, you can set an array attribute to a value with square brackets...

Until Capybara 2, node finders that accept a text option were able to find nodes based on rendered text, even...

sudo gitlab-rails console Note This takes some minutes to start Send a mail Use the following...

content.pivotal.io

A matcher is a function that returns an object with a compare key. Usually it is registered with beforeEach...

...than Dir.tmpdir e.g. Dir.mktmpdir('foo', Rails.root.join('tmp')) => /home/user/rails_example/tmp/foo20220912-14561-pyr8qd. This might be necessary when your tests are running on CI. For this you might also want to commit tmp/.gitkeep to git...

...tmp dir inside your project is present. Example Dir.mktmpdir('exports') => "/tmp/exports20220912-14561-pobh0a" Improving your parallel tests with Dir.mktmpdir When creating directories in parallel tests manually, you normally need to handle these...

.../regex/.test(...) is converted to a string as defined by the specs, which means e.g. .test(null) is equal to .test("null"). Globally matching regex objects remember the last index they...

...matched. Multiple calls to test() will advance this pointer: matcher = new RegExp("foo", "g") // <- "global" flag matcher.test("foobar") // => true matcher.lastIndex // => 3 (where the regexp stopped scanning) matcher.test("foobar") // => false matcher.lastIndex...

You may have asked yourself how you're able to keep your test databases clean, if you're running multiple databases with full read and write access at...

development: primary: <<: *default database: my_app_development migration: <<: *default database: my_app_migration test: &test primary: <<: *default database: my_app_test_<%= ENV['TEST_ENV_NUMBER'] %> pool: 20 migration: <<: *default...

In Cucumber, scenario outlines help avoiding tests that are basically the same, except for a few variables (such as different inputs). So far, nothing new. The problem

...your test should (or should not) do something, like filling in a field only for some tests? Scenario Outline: ... When I open the form And I fill in "Name" with...

Within development and test environments, Rails is usually configured to show a detailed debug page instead of 404s. However, there might be some cases where you expect a 404 and...

...want to test for it. An example would be request-specs that check authorization rules. (If you use a gem like consul for managing authorization rules, you should always check...

...navigate to Settings -> Editor -> File and Code Templates. Example You can navigate to the test file of the currently open file with the shortcut Ctrl + T. If no test file...

...exists, you can generate a new test file. If you are not pleased with the output, you can adjust the related code template. To do this, open the project settings...

...close them as well! See the suggested helper at the bottom of this card. Test support If you access Redis in tests, I suggest introducing a helper method. Example for...

...redis ||= Redis.new(url: REDIS_URL) end end RSpec.configure do |config| config.include(RedisHelpers) end Your Tests may then say redis.get('example'). But I still want to use a global

...Let's say for example, you maintain a gem and want to run automated tests against multiple rails versions. When you need to bundle one of your secondary Gemfiles, the...

greg.molnar.io

...out, e.g. when hunting down a bug or embedding a Rails app into the tests of a gem. What you do is basically: Put everything (gems, application config, database migrations...

If you need to test interaction with a remote API, check out the VCR gem as an alternative to Webmock or stubbing hell. The idea behind VCR is that is...

...HTTP requests and logs the interaction in a .yml file. When you run the test again, requests and responses are stubbed from the log and the test can run offline...

...get Jasmine specs running in a Rails project using Webpacker, with the browser based test runner. Should be easily adaptable to a pure Webpack setup. Step 1: Install Jasmine

...Javascript, we will create two additional packs. The first only contains Jasmine and the test runner. The second will contain our normal application code and the specs themselves.

github.com

...What you can do is change the time zone of the process running your tests by setting a TZ=CET (or TZ=PDT or TZ=UTC etc.) environment variable.

...way, when the test process spawns another process to run a browser, it will inherit the environment and also believe it lives in that zone. To do so, run the...

These steps are now part of Spreewald. Here are some useful examples how to use the attached Cucumber Timecop steps...

Testing your responses in Rails allows to parse the body depending on the response MIME type with parsed_body. get '/posts.json' response.parsed_body # => [{'id' => 42, 'title' => 'Title'}, ...]