Class: AngularWebdriver::ByRepeaterInner
- Inherits:
-
Object
- Object
- AngularWebdriver::ByRepeaterInner
- Defined in:
- lib/angular_webdriver/protractor/by_repeater_inner.rb
Instance Attribute Summary collapse
-
#column_binding ⇒ Object
readonly
Returns the value of attribute column_binding.
-
#exact ⇒ Object
readonly
Returns the value of attribute exact.
-
#repeat_descriptor ⇒ Object
readonly
Returns the value of attribute repeat_descriptor.
-
#row_index ⇒ Object
readonly
Returns the value of attribute row_index.
Class Method Summary collapse
-
.wrap_repeater(args) ⇒ Object
Takes args and returns wrapped repeater if the first arg is a repeater.
Instance Method Summary collapse
- #column(column_binding) ⇒ Object
-
#initialize(opts = {}) ⇒ ByRepeaterInner
constructor
Generate either by.repeater or by.exactRepeater.
-
#process ⇒ Object
Return JSON representation of the correct repeater method and args.
- #row(row_index) ⇒ Object
Constructor Details
#initialize(opts = {}) ⇒ ByRepeaterInner
Generate either by.repeater or by.exactRepeater
19 20 21 22 23 24 25 26 27 28 |
# File 'lib/angular_webdriver/protractor/by_repeater_inner.rb', line 19 def initialize opts={} exact = opts.fetch(:exact) raise "#{exact} is not a valid value" unless [true, false].include?(exact) repeat_descriptor = opts.fetch(:repeat_descriptor) raise "#{repeat_descriptor} is not a valid repeat_descriptor" unless repeat_descriptor.is_a?(String) @exact = exact @repeat_descriptor = repeat_descriptor self end |
Instance Attribute Details
#column_binding ⇒ Object (readonly)
Returns the value of attribute column_binding.
3 4 5 |
# File 'lib/angular_webdriver/protractor/by_repeater_inner.rb', line 3 def column_binding @column_binding end |
#exact ⇒ Object (readonly)
Returns the value of attribute exact.
3 4 5 |
# File 'lib/angular_webdriver/protractor/by_repeater_inner.rb', line 3 def exact @exact end |
#repeat_descriptor ⇒ Object (readonly)
Returns the value of attribute repeat_descriptor.
3 4 5 |
# File 'lib/angular_webdriver/protractor/by_repeater_inner.rb', line 3 def repeat_descriptor @repeat_descriptor end |
#row_index ⇒ Object (readonly)
Returns the value of attribute row_index.
3 4 5 |
# File 'lib/angular_webdriver/protractor/by_repeater_inner.rb', line 3 def row_index @row_index end |
Class Method Details
.wrap_repeater(args) ⇒ Object
Takes args and returns wrapped repeater if the first arg is a repeater
8 9 10 11 12 13 14 |
# File 'lib/angular_webdriver/protractor/by_repeater_inner.rb', line 8 def self.wrap_repeater args if args && args.first.is_a?(self) [repeater: args.first.process] # watir requires an array containing a hash else args end end |
Instance Method Details
#column(column_binding) ⇒ Object
36 37 38 39 40 |
# File 'lib/angular_webdriver/protractor/by_repeater_inner.rb', line 36 def column column_binding raise "#{column_binding} is not a valid column binding" unless column_binding.is_a?(String) @column_binding = column_binding self end |
#process ⇒ Object
Return JSON representation of the correct repeater method and args
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 |
# File 'lib/angular_webdriver/protractor/by_repeater_inner.rb', line 43 def process # findRepeaterElement - (repeater, exact, index, binding, using, rootSelector) - by.repeater('baz in days').row(0).column('b') - [baz in days, false, 0, b, null, body] # findRepeaterRows - (repeater, exact, index, using) - by.repeater('baz in days').row(0) - [baz in days, false, 0, null, body] # findRepeaterColumn - (repeater, exact, binding, using, rootSelector) - by.repeater('baz in days').column('b') - [baz in days, false, b, null, body] # findAllRepeaterRows - (repeater, exact, using) - by.repeater('baz in days') - [baz in days, false, null, body] # # # using - parent element # rootSelector - selector for finding angular js # exact - true if by.exactRepeater false when by.repeater # # # repeater (repeat_descriptor), binding (column_binding), index (row_index) # # findRepeaterElement - (repeat_descriptor, row_index, column_binding) # findRepeaterRows - (repeat_descriptor, row_index) # findRepeaterColumn - (repeat_descriptor, column_binding) # findAllRepeaterRows - (repeat_descriptor) result = if repeat_descriptor && row_index && column_binding { script: :findRepeaterElement, args: { repeat_descriptor: repeat_descriptor, exact: exact, row_index: row_index, column_binding: column_binding, } } elsif repeat_descriptor && row_index { script: :findRepeaterRows, args: { repeat_descriptor: repeat_descriptor, exact: exact, row_index: row_index } } elsif repeat_descriptor && column_binding { script: :findRepeaterColumn, args: { repeat_descriptor: repeat_descriptor, exact: exact, column_binding: column_binding } } elsif repeat_descriptor { script: :findAllRepeaterRows, args: { repeat_descriptor: repeat_descriptor, exact: exact } } else raise 'Invalid repeater' end result.to_json end |
#row(row_index) ⇒ Object
30 31 32 33 34 |
# File 'lib/angular_webdriver/protractor/by_repeater_inner.rb', line 30 def row row_index raise "#{row_index} is not a valid row index" unless row_index.is_a?(Integer) @row_index = row_index self end |