Class: Selenium::WebDriver::Support::Guards
- Inherits:
-
Object
- Object
- Selenium::WebDriver::Support::Guards
- Defined in:
- lib/selenium/webdriver/support/guards.rb,
lib/selenium/webdriver/support/guards/guard.rb,
lib/selenium/webdriver/support/guards/guard_condition.rb
Defined Under Namespace
Classes: Guard, GuardCondition
Constant Summary collapse
- GUARD_TYPES =
i[except only exclude exclusive flaky].freeze
Instance Attribute Summary collapse
-
#bug_tracker ⇒ Object
Returns the value of attribute bug_tracker.
-
#messages ⇒ Object
readonly
Returns the value of attribute messages.
Instance Method Summary collapse
- #add_condition(name, condition = false, &block) ⇒ Object
- #add_message(name, message) ⇒ Object
- #disposition ⇒ Object
-
#initialize(example, bug_tracker: '', conditions: nil) ⇒ Guards
constructor
A new instance of Guards.
- #satisfied?(guard) ⇒ Boolean
Constructor Details
#initialize(example, bug_tracker: '', conditions: nil) ⇒ Guards
Returns a new instance of Guards.
32 33 34 35 36 37 38 |
# File 'lib/selenium/webdriver/support/guards.rb', line 32 def initialize(example, bug_tracker: '', conditions: nil) @example = example @bug_tracker = bug_tracker @guard_conditions = conditions || [] @guards = collect_example_guards = {} end |
Instance Attribute Details
#bug_tracker ⇒ Object
Returns the value of attribute bug_tracker.
30 31 32 |
# File 'lib/selenium/webdriver/support/guards.rb', line 30 def bug_tracker @bug_tracker end |
#messages ⇒ Object (readonly)
Returns the value of attribute messages.
29 30 31 |
# File 'lib/selenium/webdriver/support/guards.rb', line 29 def end |
Instance Method Details
#add_condition(name, condition = false, &block) ⇒ Object
40 41 42 43 44 |
# File 'lib/selenium/webdriver/support/guards.rb', line 40 def add_condition(name, condition = false, &block) condition = false if condition.nil? @guard_conditions << GuardCondition.new(name, condition, &block) WebDriver.logger.debug "Running with Guard '#{name}' set to: #{condition}" end |
#add_message(name, message) ⇒ Object
46 47 48 |
# File 'lib/selenium/webdriver/support/guards.rb', line 46 def (name, ) [name] = end |
#disposition ⇒ Object
50 51 52 53 54 55 56 57 58 |
# File 'lib/selenium/webdriver/support/guards.rb', line 50 def disposition if !skipping_guard.nil? [:skip, skipping_guard.] elsif !pending_guard.nil? && ENV.fetch('SKIP_PENDING', nil) [:skip, pending_guard.] elsif !pending_guard.nil? [:pending, pending_guard.] end end |
#satisfied?(guard) ⇒ Boolean
60 61 62 |
# File 'lib/selenium/webdriver/support/guards.rb', line 60 def satisfied?(guard) @guard_conditions.all? { |condition| condition.satisfied?(guard) } end |