Hot answers tagged

12 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.....
João Farias's user avatar
  • 10.9k
8 votes

Expect case insensitive text on page - Capybara + RSpec

have_content actually takes a regexp as parameter. You can use the i flag to make the search case insensitive expect(page).to have_content(/my case insensitive search/i)
Mihai-Andrei Dinculescu's user avatar
6 votes
Accepted

Why does element.displayed? throws exception instead of boolean false?

$driver.find_element(:xpath,element2) Above, you are trying to find an element. .displayed? Now you are trying to check the state in a element. The exception is thrown by the first computation; ...
João Farias's user avatar
  • 10.9k
6 votes
Accepted

Force a browser's visibility setting to true

It's possible to force this status with a Javascript injection via execute_script. To simulate a visible document: Object.defineProperty(document, 'visibilityState', {value: 'visible', writable: ...
Florent B.'s user avatar
5 votes
Accepted

What are the differences between capybara and watir

Watir is Object Oriented while capybara is domain specific. Capybara is simple to use, quick to deploy but maintenance will be an issue over time. Watir needs overhead to develop its page ...
Yu Zhang's user avatar
  • 9,952
3 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 ...
Michael Durrant's user avatar
3 votes
Accepted

Test automation script with ruby, watir-webdriver to run in Safari browser in Windows?

No The highest version of Safari for Windows is too old. It's also not able to handle many modern web technologies, so you're better off using either a containerized version of Safari, or sticking to ...
Kate Paulk's user avatar
  • 31.5k
3 votes

Why does element.displayed? throws exception instead of boolean false?

You are checking that an element that doesn't exist is displayed. Elements must exist if they are displayed so you are failing before you get to the .display? For the findElement part, you need to ...
K-8's user avatar
  • 355
3 votes

Selenium with Ruby: Script not finding options in a drop-down

Add an explicit wait after you click your menu and then once the drop-down element is present refer below steps: https://selenium.dev/docs/site/en/support_packages/working_with_select_elements/ ...
PDHide's user avatar
  • 11.1k
3 votes
Accepted

Are Characterization (Golden Master/Snapshot) tests supposed to be human readable?

Generally, characterisation tests are not an end state. They're a way to pin the current behaviour of untested legacy code, so that you can start making changes towards maintainability and testability ...
jonrsharpe's 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 ...
Michael Durrant's user avatar
2 votes

Upgrade from Selenium 2.53 to 3.0.0

Selenium 3.0 is a drop-in replacement, so it's as simple as updating your Gemfile to use the latest version of Selenium-WebDriver (and any other libraries you want). Then run your package manager to ...
Chris Kenst's user avatar
  • 3,731
2 votes

What are the differences between capybara and watir

I have asked similar question here on watir Github: What are known reasons to use watir not capybara? You may find something useful there.
Nakilon's user avatar
  • 178
2 votes
Accepted

Page Object Model with Ruby and Selenium(Capybara)?

Even though you might not be re-using elements on multiple pages, or re-use the same pages for different tests (that's how I understand it), I would say using the POM still has benefits: The code is ...
Pieter A's user avatar
  • 323
2 votes

Page Object Model with Ruby and Selenium(Capybara)?

POM can be useful to avoid unnecessary refactoring. For your development stack I would suggest installing the site_prism gem - it allows you to easily create and compose page objects. In this Pull ...
João Farias's user avatar
  • 10.9k
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 ...
newsn31's user avatar
  • 609
2 votes

How to assert that all input fields are clear from a web page form after being reset?

Step 0. Set up Webdriver. require 'rubygems' require 'selenium-webdriver' driver = Selenium::WebDriver.for :chrome Step 1. Set a variable for finding values found_values= false Step 2. Get an ...
Michael Durrant's user avatar
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'. ...
fmorales's user avatar
  • 181
2 votes

Test Automation tool able to determine object properties in desktop based application made with Ruby

I write test suites in Ruby using Rspec and Selenium. This does not mean that I must use Ruby to write automated tests for code written in Ruby. There's no need to choose your automation tool based on ...
CaptainKidd's user avatar
2 votes

How to emulate right click options by Capybara?

If it's the system right click menu then you can't. If it's a page generated right click menu then you just interact like any other element on the page.
Thomas Walpole's user avatar
2 votes

Coding assignment for Ruby QA job?

I'm not the most experienced guy when it comes to interviews, but this is my opinion on the subject. I like to separate personal interviews and assignments. Personal Interviews For me personal ...
Csaba Balázs's 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 ...
jonrsharpe's user avatar
1 vote

Force a browser's visibility setting to true

The browser being the topmost app on the OS is actually (what I would call) a meta state that is outside of Selenium's scope of dealing with apps and browser settings. So, if you really need the ...
FDM's user avatar
  • 5,904
1 vote
Accepted

XPath of an element keeps changing when testing in different OS or device

Yes, identify your element with an ID, class, name or other specific attribute. XPath should only be used as a last resort, or if the selector is really complex and/or contains dynamic data. But even ...
FDM's user avatar
  • 5,904
1 vote

How do I configure my env.rb file to be able to switch browsers?

At the end of each scenario, you should be quitting the driver instance during teardown: $driver.quit
Sam Woods's user avatar
  • 8,569
1 vote
Accepted

How to implement the page-objects ruby gem with selenium

It looks like page-object is using the Watir implementation instead of the Webdriver implementation, and since Webdriver does not have a text_field property (while Watir does) it is failing. I am not ...
Sam Woods's user avatar
  • 8,569
1 vote

Automation testing tools for non-GUI installer written in Ruby script on Mac and Windows

The classic tool for testing of interative non-GUI applications is called expect. It comes from the Tcl world but Ruby equivalents are available as well: https://github.com/abates/ruby_expect
Harri's user avatar
  • 151
1 vote

Selenium Ruby - How to find a radio button by name and value?

If you familiar with css you can use css selector format driver.find_element(:css,"[name='radioBtn'][value='1']")
Sunu Pinasthika Fajar's user avatar
1 vote
Accepted

What ruby automation options (capybara, watir) will let me use Selenium 3?

Here are the listed dependencies (as of 6/14/2017) capybara selenium-webdriver < 4.0, >= 2.0 Except version 3.4.1 due to this issue. s.add_development_dependency("selenium-webdriver", [">= ...
kirbycope's user avatar
  • 4,090
1 vote

How to Run tests in parallel with Spinach BDD framework?

You can try parallel_tests solution.
Dmitry Cheremushkin's user avatar

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