[rspec-devel] [ rspec-Patches-11917 ] Cleaner Spec::Ui error for failed Selenium connection

noreply at rubyforge.org noreply at rubyforge.org
Tue Jul 10 12:17:11 EDT 2007


Patches item #11917, was opened at 2007-06-29 02:46
You can respond by visiting: 
http://rubyforge.org/tracker/?func=detail&atid=3151&aid=11917&group_id=797

Category: None
Group: None
>Status: Closed
>Resolution: Accepted
Priority: 3
Submitted By: Ian Dees (undees)
>Assigned to: Aslak Hellesøy (aslak_hellesoy)
Summary: Cleaner Spec::Ui error for failed Selenium connection

Initial Comment:
If Spec::Ui fails for some reason to connect to the Selenium remote (e.g., if it's not running, or the port settings are wrong), the result is a rather lengthy backtrace leading off with a "You must call Spec::Ui::ScreenshotFormatter.screenshot..." message---even if the requisite call to screenshot() is in the right place.

Spec::Ui::ScreenshotFormatter::extra_error_content() seems to expect @relative_png_path to be set, which is reasonable for spec failures, but in the case of a "before" clause raising an error, this attribute won't have been set yet.

The simplest solution is to skip the call to img_div()---which calls relative_png_path()---if failure.expectation_not_met() is false.  This would seem to have the side effect of skipping the screen capture for a "describe" clause that raises any error other than ExpectationNotMet.  From a test writer's perspective, I can say the lack of a screenshot in that (rare?) case wouldn't bug me.


----------------------------------------------------------------------

>Comment By: Aslak Hellesøy (aslak_hellesoy)
Date: 2007-07-10 12:17

Message:
Nice. Applied in r2166

----------------------------------------------------------------------

You can respond by visiting: 
http://rubyforge.org/tracker/?func=detail&atid=3151&aid=11917&group_id=797


More information about the rspec-devel mailing list