...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...
# visit page.driver.last_request.env['HTTP_REFERER'] # old visit page.driver.request.env['HTTP_REFERER'] # new # or for javascript tests: page.execute_script('window.history.back()') end undefined method locate for #Capybara::Session (NoMethodError) Use page.find instead of...
...now wrapped by a html document skeleton. Use page.text instead. (e.g. when you are testing correct JSON which is in fact not wrapped by a html sceleton) An element can...
...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...
...MySQL console and execute SHOW TABLE STATUS FROM database; mysql> SHOW TABLE STATUS FROM test; +-------------+--------+---------+------------+------+----------------+-------------+-----------------+--------------+-----------+----------------+---------------------+---------------------+------------+-----------------+----------+----------------+---------+ | Name | Engine | Version | Row_format | Rows | Avg_row_length | Data_length | Max_data_length | Index...
...free | Auto_increment | Create_time | Update_time | Check_time | Collation | Checksum | Create_options | Comment | +-------------+--------+---------+------------+------+----------------+-------------+-----------------+--------------+-----------+----------------+---------------------+---------------------+------------+-----------------+----------+----------------+---------+ | test1 | MyISAM | 10 | Dynamic...
Most of these will not work in newer projects because these use the Capybara/Rack::Test combo in lieu of Webrat. Find input fields Then /^there should be a "([^"]+)" field$/ do...
...While the FULLTEXT approach was many times faster than the LIKE approach in my tests, both approaches seem to scale linearly with the number of records. For a typical web...
...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...
...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.
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...
...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
We used zeroclipboard.js in some of our projects but now we switched to clipboard.js because it does not rely on...
the output is optional of course but might be helpful when you first test the migration and rollback
...a button on a Selenium-controlled browser, the call will return control to your test before the next page is loaded. This can lead to concurrency issues when a Cucumber...
Install and configure the AWS Command Line Interface Show existing certificates to test if the AWS Cli is working: $ aws iam list-server-certificates { "ServerCertificateMetadataList": [ { "Path": "/", "Arn": "arn:aws:iam...
...will be missing. Use this instead: rake gems:unpack GEM=cucumber_factory RAILS_ENV=test
...a production console. You often won't notice this because for the development and test environments auto_flushing is set to write after each line. On production environments the Rails...
...What Consul does internally is fetch all the IDs of the power.posts scope and test if the given record's ID is among them. This list of IDs is cached...
email: migration_user.email, phone: migration_user.phone ) end end end Now the best idea is to test this in the rails sandbox (so your development data stay untouched): rails console --sandbox...
Note that you need to write all selectors in lowercase letters in your tests. Capybara talks HTML, after all, and in HTML tags and attributes are case-insensitive (as...
...If you haven't installed Firefox 24 yet, the next time you run tests with Geordi, it will tell you how to install it. On a Rails 2 project:
-> Remove cucumber_spinner from Gemfile. We're not using it in parallel_tests anyway...
...in your mailer: # production.rb: Rails.application.configure do config.action_mailer.delivery_method = :smtp config.action_mailer.smtp_settings = smtp_settings end # test_mailer.rb def test_mail mail(to: 'mail@example.com', subject: 'Subject').delivery_method.settings.merge!(smtp_settings) end Configuring SMTP with...
...a Google account These is an example configuration you can use to test if mail delivery works in your application: smtp_settings { address: 'smtp.gmail.com', domain: 'smtp.gmail.com', port: 587,
...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...
Some helpers for poking around at your Capybara driven browser's cookies in integration tests. Supports Capybara's bundled drivers (rack-test, Selenium Webdriver), and adapters for other drivers may...