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"

makandra dev

...pack is application.js): = image_pack_tag('media/application/images/logo.png') Deployment Follow Configuring Webpacker deployments with Capistrano. Tests In your cucumber test, you will want to regenerate your assets before each test suite...

...run. Since this is a bit slow, especially when using multiple processes with parallel_test, read this card. jQuery If you still require jQuery, add it to your webpacker project...

github.com

No one wants to cry over regression issues in views; does testing HTML and CSS have to be such a back and forth between designers and devs? Why is it...

...presentation layer? Well, GreenOnion is here to help you get the same results on testing front-end styling that you've enjoyed in your unit and integration tests up to...

1) first expectation failed 2) second expectation failed As you can see, the test is not being interrupted by the first two falsy expectations, the third expectation passed without...

This can be handy if you are testing for multiple values, which map to one context, e. g. mail components, in order to provide better readability of your...

...you need additional form fields (like tax IDs) to bill customers in another language. Tests Tests should continue to use the base language you had before starting localization. Don't...

...rewrite all tests and don't test every screens with every language unless repeatedly broken translations becomes a pain point. Do test non-trivial language-specific customizations like the parsing...

github.com

...implement sending an error notification if the data (in the db) is too old. Testing: If you use sidekiq_retries_exhausted (unit test): https://stackoverflow.com/questions/33930199/rspec-sidekiq-how-to-test-within-sidekiq-retries-exhausted-block-with-another If you use the...

...global option (manual test): # Use this worker to test if the exception notifier for sidekiq works as expected and the retries total duration fits. # Example: TestWorker.perform_async('foo', 'bar')

...integration of Pivotal's excellent license_finder that validates all dependencies during a regular test run. It will protect you from accidentally adding libraries with problematic licenses. Installation

LicenseFinder can exclude certain dependency groups from its report, for example development and test (add devDependencies for yarn). This only works with certain package managers (among which Bundler and...

...Add continuous integration in Gitlab 4 0 - 5 Dev machines are not blocked on test runs; Code Reviews include test badge; Automatically merge a PR on green tests

...library has a better API Add capybara_lockstep 2 0 - 5 Reduce flaky integration tests

docs.ruby-lang.org

...or an argument. return # => LocalJumpError: unexpected return example { return 4 } # => LocalJumpError: unexpected return def test example { return 4 } return 'test' end test # => 4 Note how test returns the return value...

...from the block; neither code after the example invocation (returning "test") nor code after the yield inside example (putsing "done", returning "example") are executed. As you always knew, and in...

Tests are about 100% control over UI interaction and your test scenario. Randomness makes writing tests hard. You will also push tests that are green for you today, but red...

This creates ugly sample data like "First3 Last3", but e.g. doesn't make tests pass when they shouldn't...

end end def bar 'New bar' end end module SuperClient prepend SuperClientExtension end Test class Test; include SuperClient; end Test.foo => 'New foo' Test.new.bar => 'New bar' Good practice

...last_name = last_name end attr_reader :first_name, :last_name end To just test if an argument is a Person, you have several options: Test that the argument is...

...instance of a certain class expect(object).to receive(:foo).with(instance_of(Person)) Test that the argument responds to certain methods expect(object).to receive(:foo).with(duck_type...

When testing JavaScript functionality in Selenium (E2E), you may need to access a class or function inside of a evaluate_script block in one of your steps. Capybara may only...

...are exporting your definition(s) in Webpacker, these won't be available in your tests (and neither in the dev console). The following principles/concepts also apply to Sprockets.

Haml HTML generated by Haml 5 HTML generated by Haml 6 %button(up-test) %button(up-test=true) %button(up-test=false) %button(up-test=nil) %button(up-test...

same %button(up-test='false') same %button(up-test='') same Extending the list of attributes considered "boolean" You can add to the list of "boolean attributes", but please do...

...can use this command: :%s/{{\([^\}]*\)}}/%{\1}/cg Fix deprecation warnings with :overwrite_params Run tests Deploy See the commit log for a detailed list of changes. 2.3.9 to 2.3.10

...Upgrade rails gem Change your environment.rb so it says RAILS_GEM_VERSION = '2.3.10' Run tests Deploy Also see commit log. From 2.3.10 to 2.3.11 Fixes multiple security issues.

web.archive.org

...you use that "db count" and process the loaded elements. A common example is tests: Imagine a test that sets up a few records and finishes the test setup by...

...records have loaded (i.e. cached) their associations too early and now are missing elements. Tests relying on the setup will fail, because they will operate on the loaded records. You...

...using inheritance, modules, traits or partials. When you reuse behavior you want to reuse tests as well. You are probably already reusing examples in unit tests. Unfortunately it is much...

...harder to reuse code when writing integration tests with Cucumber, where you need to express yourself with Gherkin and step definitions instead of Ruby classes and methods.

github.com

...you are using a driver that supports it (e.g. Selenium, not the default Rack::Test driver). Consider the following HTML: One Two With some CSS: .test1 { display: block } .test2 { display...

...Default: visible: :visible As described above, by default Capybara finds only visible elements. find('.test1') finds the .test1 element find('.test2') raises a Capybara::ElementNotFound error, as the .test2 element...

masilotti.com

Slow test suites are a major pain point in projects, often due to RSpec and FactoryBot. Although minitest and fixtures are sometimes viewed as outdated, they can greatly improve test...

...fixtures, and while it required some initial refactoring and establishing good practices, the faster test suite was well worth it! Stick with me to explore how these tools might actually...

...not part of the same network. Maybe you want to use your phone to test a web page, but are only in a guest WiFi. In the past, we often...

...local machine on port 3000. This can also be useful if you need to test with TLS, without having to jump through the hoops of creating some self-signed TLS...

...KB or Zousan. You can even polyfill Promise with jQuery itself using 339 bytes. Testing async code We want to test this code: whenLoaded = new Promise(function(resolve, reject) { $(resolve...

...function foo() { } function callFooWhenLoaded() { whenLoaded.then(foo) } This test fails: describe('callFooWhenLoaded()', function() { it('calls foo()', function() { spyOn(window, 'foo') callFooWhenLoaded() expect(foo).toHaveBeenCalled() }) }) The test fails since we're expecting...

...has the line gem 'rails', '~>5.2'). I also experienced that doing upgrades per group (test, development) are easier to do. Thus --groups might also be helpful. $ bundle outdated --strict --groups...

...newest 5.2.6, installed 5.2.4.6) ... ===== Group "development" ===== * binding_of_caller (newest 1.0.0, installed 0.8.0) * parallel_tests (newest 3.7.3, installed 2.32.0) * query_diet (newest 0.7.0, installed 0.6.2) * spring (newest 2.1.1, installed...

Code splitting is a feature of esbuild that can keep huge libraries out of the main bundle. How code splitting...

config.move_to_store = true We have a separate card about that. Store test files separately. Also add support for parallel tests. You can easily do that by setting...

config.root = "#{Rails.public_path}/system/#{Rails.env}#{ENV['TEST_ENV_NUMBER']}".freeze For debugging purposes (e.g. trying to hunt down a staging bug locally), it might make sense to allow reading...