Hot answers tagged

10 votes
Accepted

How can I run one spec 100 times using the command line?

If you are using zsh shell: repeat 10 { command } On basic shell: for _ in {1..10} do command; done If you can run the tests in parallel, you can use the GNU Parallel: parallel command ::: {1.....
user avatar
  • 9,949
2 votes
Accepted

What would switching from ruby rspec to minitest involve?

Minitest and Rspec are very similar. You are likely to miss the Rspec matchers, however there is an Rspec matchers gem for minitest. If you use it, there is a good chance your test will 'just work'. ...
user avatar
  • 181
2 votes

Why do rspec-capybara chrome tests run headless fail on my mac and how to diagnose/fix it?

To debug, first try to take a screenshot in headless mode when you arrive at the button. Then take another screenshot before the test fails or after you click the button. It really looks like you ...
user avatar
  • 589
2 votes

Why are intermittent browser automation failures hard to fix and how to overcome that?

Intermittent failures are hard to fix due to their very nature - they don't always happen. So when you think you have fixed them you often can't be sure just by 'running the spec'. You usually need ...
user avatar
2 votes

How can I run one spec 100 times using the command line?

Create a script in your home directory, e.g. $ cat run_spec_100_times.sh cd ~/eq/lynx for i in `seq 1 100`; do rspec spec/features/survey_spec.rb done cd ~ Modify ...
user avatar
2 votes
Accepted

What is the name for the 'describe it' format in testing?

I've generally seen it referred to as "xSpec"; that style was popularised, if not invented, by RSpec and there are others like JSpec (for Java, which uses it but not describe). The JavaScript ...
user avatar
1 vote

Check that an element does not exist *after* a button is clicked

Use expect(page.has_css?('#div.error', wait: 3)).to be true If the expression is true (i.e. error exists) at the outset, it will return immediately, i.e. will pass. Otherwise, it will use a polling ...
user avatar
1 vote

Check that an element does not exist *after* a button is clicked

This is the problem with negative assertions since Capybara has no way to know how long any actions are going to take on the page, so really can't know that even though the assertion is passing now ...
user avatar
1 vote

Stop page load, or visit page without waiting for full page load -Capybara

What visit waits until is determined by the specific driver used (chromedriver, geckodriver, etc) and the page load strategy that driver is configured to use - https://w3c.github.io/webdriver/#...
user avatar
1 vote

How can I test if a page object yml file has orphaned keys using rspec?

You can write an RSpec test that tries to do this by grepping spec files for the locator names. It will not be foolproof. Some orphans might slip through and the test still passes (falsely). ...
user avatar
1 vote

How to provide non-technical users with better rspec output

Here is a shell script to produce more readable documentation: find . -regex \ '\(.*_spec\.rb\|spec_.*\.rb\)' ! -name 'spec_helper.rb' \ -exec cat {} \; | \ grep -E \ '(^ +?describe |RSpec\....
user avatar
1 vote

How to use xvfb to run my automated rspec-capybara chromedriver tests?

This link explains Firefox browser testing with Capybara: Hope the below link give you an insight of the approach. http://elementalselenium.com/tips/38-headless Installing xvfb: Example command : For ...
user avatar
  • 714
1 vote
Accepted

What's the 'workflow' for writing tests for existing code with zero tests?

Technical Debt You have a described a situation where there is a lot of technical debt from having no tests. My approach would be: Change things for all code (new or updated) going forward to have ...
user avatar
1 vote
Accepted

Running tests in chrome but just getting data;. in every browser window

This was due to a bug in chromedriver. Updating to a more recent version solves this. Specifically this was fixed in chromedriver version 2.24 at least for Ubuntu. A couple of other of our ...
user avatar
1 vote
Accepted

Are there advantages to using Capybara with RSpec + Selenium?

I think the Capybara benefits sum it up nicely: No setup necessary for Rails and Rack application. Works out of the box. Intuitive API which mimics the language an actual user would use. ...
user avatar

Only top scored, non community-wiki answers of a minimum length are eligible