...as pending, include a failing spec body or RSpec 3 will consider the pending test as failing. The reasoning is: If the spec is flagged as pending but passes, it...
We had a conversation about the fact that the 'TDD is about testing vs TDD is about design" debate that keeps popping up, especially now in the Ruby community...
This note describes a Cucumber step definition that lets you test whether or not a CSS selector is present on the site: Then I should see an element "#sign_in...
I needed to make sure that an element is visible and not overshadowed by an element that has a higher...
You might wonder about this request in your test.log: Started GET "/__identify__" for 127.0.0.1 at 2015-04-29 18:00:02 +0100 This is what happens: For drivers like Selenium...
This step tests whether a given select option comes preselected in the HTML. There is another step to test that an option is available at all. Capybara Then /^"([^"]*)" should be...
...the user is certain. Solution If you need to circumvent this protection, e.g. to test that your application behaves correctly despite being misused, do this: page.execute_script 'history.back()' page.execute_script...
Spreewald now comes with a step that tests if a form field is visible: Then the "Due date" field should be visible But the "Author" field should not be visible...
...checks if that field is hidden via CSS (or Javascript). It is not currently tested if the label is visible or hidden. For this see: Check that an element is...
...web browser. It's pretty convenient. By installing a Chrome addon you can also test your local code on http://localhost...
If the application under test makes sound, you probably want to disable this during integration testing. You can use the args option to pass parameters to the browser. For Chrome...
Plugins (and gems) are typically tested using a complete sample rails application that lives in the spec folder of the plugin. If your gem is supposed to work with multiple...
Sometimes PDF cucumber tests fail at the first test run and succeed at the second run. You can fix this with this step: When PDF generation is ready
When using state_machine you sometimes need to know whether an object may execute a certain transition. Let's take...
...scrollbars ? '==' : '!=' scroll_height.should.send(comparison, offset_height) end This should respect padding. However, I have not tested if margins have an effect on it...
There is a kind of features in web applications that hinder automated integration tests. Examples include cookie consent banners or form captchas. Clearly, these should be disabled so you do...
...not have to explicitly deal with them in each and every test (like, every test starting with accepting the cookies notice). On the other hand, they must be tested as...
...x86_64 -cdrom filename.iso If you prepared a USB pen drive and want to test it, run it like this (/dev/sdx being your device name; you may need to sudo...
...gem you often hook onto events like this: update.before do do_something end For testing such things in your controller you should -- as always -- not trigger something that eventually calls...
If you want to test that a certain text is contained within the document title of your page, you can do so using Selenium and a step such as
Our collection of the most useful Cucumber steps, Spreewald, now supports exact matching of form fields and lets you use...
This step will pass if the specified select is sorted. Then /^the "(.*?)" select should be sorted$/ do |label, negate|
...servers. It spins up when you run your feature specs, so that you can test your purchase flow without hitting Stripe’s servers or making any external HTTP requests.
...ve also had tests actually hitting the testing sandbox of Stripe, which worked OK most of the time (can be flakey...
The step definition below lets you say: Then I should see a field "Password" But I should not see a...
Tooltips that are delivered through HTML attributes are encoded. Decode entities before checking for their presence. Capybara: Then /^there should...
This is surprisingly difficult when there is a with the same text on the page, but you really want to...