Module: Capybara::Storyboard::TestHelper
- Defined in:
- lib/capybara/storyboard/test_helper.rb
Overview
RSpec system-spec helper. Include AFTER Capybara::DSL so the overrides
below chain into the DSL via super. A per-test policy call decides
whether automatic screenshots are taken (see Capybara::Storyboard.policy).
Class Method Summary collapse
Instance Method Summary collapse
- #accept_alert ⇒ Object
- #accept_confirm ⇒ Object
- #attach_file(locator) ⇒ Object
- #check(locator) ⇒ Object
- #choose(locator) ⇒ Object
- #click_button(locator = nil) ⇒ Object
- #click_link(locator = nil) ⇒ Object
- #click_on(locator = nil) ⇒ Object
- #fill_in(locator) ⇒ Object
- #select(value = nil) ⇒ Object
-
#storyboard_screenshot(label) ⇒ Object
Manual screenshot hook.
- #uncheck(locator) ⇒ Object
- #visit(path) ⇒ Object
Class Method Details
.included(base) ⇒ Object
11 12 13 |
# File 'lib/capybara/storyboard/test_helper.rb', line 11 def self.included(base) base.class_eval { before { __storyboard_init } } end |
Instance Method Details
#accept_alert ⇒ Object
68 69 70 |
# File 'lib/capybara/storyboard/test_helper.rb', line 68 def accept_alert(...) @__storyboard.suppress_captures { super }.tap { @__storyboard.auto(page, 'accept_alert') } end |
#accept_confirm ⇒ Object
64 65 66 |
# File 'lib/capybara/storyboard/test_helper.rb', line 64 def accept_confirm(...) @__storyboard.suppress_captures { super }.tap { @__storyboard.auto(page, 'accept_confirm') } end |
#attach_file(locator) ⇒ Object
60 61 62 |
# File 'lib/capybara/storyboard/test_helper.rb', line 60 def attach_file(locator, ...) super.tap { @__storyboard.auto(page, 'attach_file', locator) } end |
#check(locator) ⇒ Object
48 49 50 |
# File 'lib/capybara/storyboard/test_helper.rb', line 48 def check(locator, ...) super.tap { @__storyboard.auto(page, 'check', locator) } end |
#choose(locator) ⇒ Object
56 57 58 |
# File 'lib/capybara/storyboard/test_helper.rb', line 56 def choose(locator, ...) super.tap { @__storyboard.auto(page, 'choose', locator) } end |
#click_button(locator = nil) ⇒ Object
35 36 37 38 |
# File 'lib/capybara/storyboard/test_helper.rb', line 35 def (locator = nil, ...) @__storyboard.auto(page, 'before_click_button', locator) super.tap { @__storyboard.auto(page, 'after_click_button', locator) } end |
#click_link(locator = nil) ⇒ Object
30 31 32 33 |
# File 'lib/capybara/storyboard/test_helper.rb', line 30 def click_link(locator = nil, ...) @__storyboard.auto(page, 'before_click_link', locator) super.tap { @__storyboard.auto(page, 'after_click_link', locator) } end |
#click_on(locator = nil) ⇒ Object
25 26 27 28 |
# File 'lib/capybara/storyboard/test_helper.rb', line 25 def click_on(locator = nil, ...) @__storyboard.auto(page, 'before_click_on', locator) super.tap { @__storyboard.auto(page, 'after_click_on', locator) } end |
#fill_in(locator) ⇒ Object
40 41 42 |
# File 'lib/capybara/storyboard/test_helper.rb', line 40 def fill_in(locator, ...) super.tap { @__storyboard.auto(page, 'fill_in', locator) } end |
#select(value = nil) ⇒ Object
44 45 46 |
# File 'lib/capybara/storyboard/test_helper.rb', line 44 def select(value = nil, ...) super.tap { @__storyboard.auto(page, 'select', value) } end |
#storyboard_screenshot(label) ⇒ Object
Manual screenshot hook. Captured only when enabled (like the automatic hooks); use Capybara's own save_screenshot for an unconditional shot.
17 18 19 |
# File 'lib/capybara/storyboard/test_helper.rb', line 17 def storyboard_screenshot(label) @__storyboard.manual(page, label) end |
#uncheck(locator) ⇒ Object
52 53 54 |
# File 'lib/capybara/storyboard/test_helper.rb', line 52 def uncheck(locator, ...) super.tap { @__storyboard.auto(page, 'uncheck', locator) } end |
#visit(path) ⇒ Object
21 22 23 |
# File 'lib/capybara/storyboard/test_helper.rb', line 21 def visit(path, ...) super.tap { @__storyboard.auto(page, 'visit', path) } end |