...time and there are no indications anything would change. And even if, any automated tests would fail immediately when trying to read the wrong table name, and you could still...
...all the classes in a Rails project, controllers are some of the hardest to test and understand and should receive special care. It is our belief that: Controllers should be...
Geordi now supports our solution for running Selenium tests without having Firefox or Chrome windows popping up all over your workspace. This will stop Selenium windows from appearing on your...
Ubuntu has a package mysql-sandbox that lets you install multiple MySQL versions into your user home: Install mysql-sandbox...
...use feature detection or a polyfill when using this API, to avoid unforeseen results. // Test via a getter in the options object to see if the passive property is accessed...
...var supportsPassive = false; try { var opts = Object.defineProperty({}, 'passive', { get: function() { supportsPassive = true; } }); window.addEventListener("testPassive", null, opts); window.removeEventListener("testPassive", null, opts); } catch (e) {} // Use our detect's results. passive applied if...
When you load a with a nonce, that script can await import() additional sources from any hostname. The nonce is propagated automatically for the one purpose of importing more scripts. This is not related to strict-dynamic, which propagates nonces for any propose not limited to imports (e.g. inserting elements). Example We have a restrictive CSP that only allows nonces: Content-Security-Policy: default-src 'none'; script-src 'nonce-secret123' Our HTML loads script.js using that nonce: Our script.js imports other.js without a nonce: let other = await import('other.js') console.log("Look, script.js has imported %o", other) The import succeeds without a nonce, due to implicit nonce propagation. Why this is useful In modern build pipelines, code splitting (chunking) is implemented using dynamic imports. Nonce propagation allows us to use automatic chunking with restrictive, nonce-based CSPs without using strict-dynamic. E.g. esbuild automatically groups dynamically imported modules into chunks, and writes that chunk to disk. The compiled build has an await import('assets/chunk-NAXSMFJV.js'). There's no way to inject a nonce into that import(), but implicit nonce propagation still allows the request. Should I worry about this? It would require some truly strange code for user input to make it into an import() argument. I wouldn't lose sleep over this. Is this a browser bug? It is by design. Here are some sources: HTML Spec Section 8 (Web Application APIs) (search for "descendant script fetch options") Chromium test ensuring none propagation Firefox bug implementing nonce propagation CSP issue: Someone concerned about propagation being a vulnerability CSP issue: Proposal for import-src that went nowhere Are other CSP sources also propagated? No, only nonces. In particular host-based CSPs do not propagate trust. For example, you only allow scripts from our own host (no nonces): Content-Security-Policy: default-src 'none'; script-src 'self' Our HTML loads script.js from our own host: Our script.js imports other.js from a different host: let other = await import('https://other-host.com/other.js') This fails with a CSP violation: Executing inline script violates the following Content Security Policy directive 'script-src 'self''
...because capybara is a dependency of cucumber-rails), which will break all your tests. The fix Bundler >= 1.14 has a --conservative flag. Using the conservative flag allows bundle update GEM...
When your application is open for public sign up and sends out transactional e-mails to a large number of...
When filling out forms in Selenium tests, Chrome shows the (usual) bubble, asking to store those credentials. While the bubble does not interfere with tests, it is annoying when debugging...
...tests. Here are two ways to disable it: Option 1: prefs You can set profile preferences to disable the password manager like so: prefs = { 'credentials_enable_service' => false, 'profile.password_manager...
This is my configuration: # ~/.claude/notify.sh # Note: You need to `chmod +x` this #!/bin/bash # Test usage: # echo '{ "title": "foo", "message": "bar" }' | bash ~/.claude/notify.sh EDITOR_COMMAND="/snap/bin/rubymine" INPUT=$(cat)
...introduced rules. You can use them in your .gitlab-ci.yml in your project. To limit test runs to merge requests and the master branch, you can write this: tests: script: bundle...
...exec rake tests rules: - if: '$CI_COMMIT_BRANCH == "master"' - if: '$CI_PIPELINE_SOURCE == "merge_request_event...
...opt-out of Capybara's retry mechanism you need to retry yourself or your test will be flaky. Note the wait: 0 argument. Actually there is a host of options...
...it only cares about the HTML-Tag type. Example. This might lead to breaking tests when your html changes. Once browser support is fulfilled prefiltering nth-child selector will be...
...Setup job that will only run for Rails environment "staging" end end You may test the cron output like this (no changes will be made to your crontab):
...task that will only run for Capistrano stage "customer1-staging" end end You may test the cron output like this (no changes will be made to your crontab): STAGE=customer1...
...rare circumstances, you want to use a websites full domain (say https://mywebsite.com) while testing in dev mode. This can be useful if you need to test third party integrations...
...mywebsite.com. Don't forget to remove the change to /etc/hosts when you're done testing...
...your ChromeDriver to version 75 or beyond, you might get w3c errors in your tests. For example, reading the browser console for errors no longer works, and page.driver.browser.manage.logs.get(:browser) will...
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...
Ever wondered how Rails talks to itself in a Cucumber feature? In Rails 3 you can do it like this...
Hint: There's another card with this helper for Cucumber features. Sometimes you feel like you need to stub some...
These steps are now part of Spreewald. The step definitions below allow you to test the filename suggested by the server: When I follow "Export as ZIP"
...configured your Searchkick settings) add: SEARCHKICK_CLIENT_TYPE = case Rails.env when 'production', 'staging', 'development', 'test' :elasticsearch else :opensearch end Searchkick.client_type = ENV.fetch('SEARCHKICK_CLIENT_TYPE', SEARCHKICK_CLIENT_TYPE).to_sym...
...columns (you can debug issues better) As many parts of file processing are not tested (resolution, fallback images and many more), you need to know the application and make many...
Alltogether Deploy and run Part A (maybe takes some days) Before deployment of Part B Run Part A again (or maybe twice - depends on how long it runs...
In order to save the original value of a constant, set the new value and restore the old value after...
When the order matters: expect(array1).toEqual(array2) Regardless of order: expect(array1).toEqual(jasmine.arrayWithExactContents(array2)) Ignoring extra elements: