pickles 0.2.1 → 0.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a0bfe1549c5e6a5186821c6124058cfcbf19fdd7
4
- data.tar.gz: bc2592e9194a7aca7fc06217441ff80e34e4f7a9
3
+ metadata.gz: b746089e7f029550a9e14d08b69364b0c50d0ac7
4
+ data.tar.gz: 825badd42378c243944baec9593407ea1ae8463b
5
5
  SHA512:
6
- metadata.gz: b595bc158eab97ee7e77368519b8898ca6977dab1c2db67cf4b5d721f2a34ff5f3bc3df0b4ed6905a9c2f29c8fa692774c987eeca557559c63ca337e4859ecfa
7
- data.tar.gz: 6ee7189666de0394d495b4c4b5ad30c737ca6c141ee31c9043cc14b552abb6d1ce410115e6efab0534cb44217ecd31ca9e0b4bca353210943f9f3dc6bb386540
6
+ metadata.gz: 0cb28a5d19919cb9b0213bebc6a40c1e93242323e0a49795e5e0ac808a307d06ad4e6c8ba7c42281e33f4aace0c419ded5355d06369fe67bd03203dc6c1ed16c
7
+ data.tar.gz: ec85c96a5f7924d10cc5d017bab1be715c2a3035665444705437d9fc9d672e177f9d6f992acd709cb972a19868ba7ae563b8159f71e49a85189d0ce9eec5806d
@@ -2,9 +2,12 @@ module CheckIn
2
2
 
3
3
  _dir = 'cucumber/pickles/steps/check_in/'
4
4
 
5
- autoload :Factory, _dir + 'factory'
6
- autoload :Input, _dir + 'input'
7
- autoload :Text, _dir + 'text'
5
+ autoload :Factory, _dir + 'factory'
6
+ autoload :Input, _dir + 'input'
7
+ autoload :Text, _dir + 'text'
8
+ autoload :Select, _dir + 'select'
9
+ autoload :Image, _dir + 'image'
10
+ autoload :Video, _dir + 'video'
8
11
  autoload :ComplexInput, _dir + 'complex_input'
9
12
 
10
13
  end
@@ -22,8 +22,12 @@ class Pickles::Config
22
22
  @css_node_map = {}
23
23
  @log_xhr_response = false
24
24
  @xpath_node_map = {}
25
- @fill_tag_steps_map = { 'select' => FillIN::Select, 'jselect' => FillIN::JsSelect }
26
- @check_tag_steps_map = { 'text' => CheckIn::Text }
25
+ @fill_tag_steps_map = { 'select' => FillIN::Select,
26
+ 'jselect' => FillIN::JsSelect }
27
+ @check_tag_steps_map = { 'text' => CheckIn::Text,
28
+ 'select' => CheckIn::Select,
29
+ 'image' => CheckIn::Image,
30
+ 'video' => CheckIn::Video }
27
31
  end
28
32
 
29
33
  def css_node_map=(map)
@@ -2,10 +2,10 @@ module FillIN
2
2
 
3
3
  _dir = 'cucumber/pickles/steps/fill_in/'
4
4
 
5
- autoload :Factory, _dir + 'factory'
6
- autoload :Input, _dir + 'input'
7
- autoload :JsSelect, _dir + 'js_select'
8
- autoload :Select, _dir + 'select'
5
+ autoload :Factory, _dir + 'factory'
6
+ autoload :Input, _dir + 'input'
7
+ autoload :JsSelect, _dir + 'js_select'
8
+ autoload :Select, _dir + 'select'
9
9
  autoload :ComplexInput, _dir + 'complex_input'
10
10
 
11
11
  end
@@ -38,21 +38,11 @@ Then(/^I can(not)? see:( within (?:.*))?$/) do |is_not, within_block, table|
38
38
  end
39
39
 
40
40
  And(/^I can(not)? see video (".*?")( within (?:.*))?$/) do |is_not, video_src, within|
41
- within ||= page
42
- if is_not
43
- expect(within).not_to have_selector("iframe[src=#{video_src}]")
44
- else
45
- expect(within).to have_selector("iframe[src=#{video_src}]")
46
- end
41
+ CheckIn::Video.new(video_src, within).call(is_not)
47
42
  end
48
43
 
49
44
  And(/^I can(not)? see image (".*?")( within (?:.*))?$/) do |is_not, image_src, within|
50
- within ||= page
51
- if is_not
52
- expect(within).not_to have_selector("img[src=#{image_src}]")
53
- else
54
- expect(within).to have_selector("img[src=#{image_src}]")
55
- end
45
+ CheckIn::Image.new(image_src, within).call(is_not)
56
46
  end
57
47
 
58
48
  Then /^focus is on (.*) ?"(.*?)"$/ do |identifier, locator|
@@ -1,6 +1,6 @@
1
1
  class CheckIn::Factory
2
2
 
3
- TAG = /^(.+\S+)\s*\((.*)\)$/
3
+ TAG = /^(.+\S+)?\s*\((.*)\)$/
4
4
 
5
5
  def initialize(label, value, within: nil)
6
6
  @label = label
@@ -0,0 +1,20 @@
1
+ class CheckIn::Image
2
+
3
+ include RSpec::Expectations
4
+ include RSpec::Matchers
5
+
6
+ def initialize(label = nil, value, within)
7
+ @label = label
8
+ @value = value
9
+ @within = within || Capybara.current_session
10
+ end
11
+
12
+ def call(is_not = false)
13
+ if is_not
14
+ expect(@within).not_to have_selector("img[src*='#@value']")
15
+ else
16
+ expect(@within).to have_selector("img[src*='#@value']")
17
+ end
18
+ end
19
+
20
+ end
@@ -0,0 +1,21 @@
1
+ class CheckIn::Select
2
+
3
+ include RSpec::Expectations
4
+ include RSpec::Matchers
5
+
6
+ def initialize(label, value, within)
7
+ @label = label
8
+ @value = value
9
+ @within = within || Capybara.current_session
10
+ end
11
+
12
+ def call
13
+ locator, wait = Locator::Wait.execute(@label)
14
+
15
+ options = { selected: @value }
16
+ options[:wait] = wait if wait
17
+
18
+ expect(@within).to have_select(locator, options)
19
+ end
20
+
21
+ end
@@ -0,0 +1,20 @@
1
+ class CheckIn::Video
2
+
3
+ include RSpec::Expectations
4
+ include RSpec::Matchers
5
+
6
+ def initialize(label = nil, value, within)
7
+ @label = label
8
+ @value = value
9
+ @within = within || Capybara.current_session
10
+ end
11
+
12
+ def call(is_not)
13
+ if is_not
14
+ expect(@within).not_to have_selector("iframe[src*=#@value]")
15
+ else
16
+ expect(@within).to have_selector("iframe[src*=#@value]")
17
+ end
18
+ end
19
+
20
+ end
@@ -11,7 +11,8 @@ class FillIN::Select
11
11
  end
12
12
 
13
13
  def call
14
- locator, wait = Locator::Wait.execute(@label)
14
+ locator, wait = Locator::Wait.execute(@label)
15
+ locator, index = Locator::Index.execute(locator)
15
16
 
16
17
  options = { from: locator }
17
18
  options[:wait] = wait if wait
@@ -1,3 +1,3 @@
1
1
  module Pickles
2
- VERSION = "0.2.1"
2
+ VERSION = "0.2.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pickles
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - vs
@@ -107,8 +107,11 @@ files:
107
107
  - lib/cucumber/pickles/steps/check.rb
108
108
  - lib/cucumber/pickles/steps/check_in/complex_input.rb
109
109
  - lib/cucumber/pickles/steps/check_in/factory.rb
110
+ - lib/cucumber/pickles/steps/check_in/image.rb
110
111
  - lib/cucumber/pickles/steps/check_in/input.rb
112
+ - lib/cucumber/pickles/steps/check_in/select.rb
111
113
  - lib/cucumber/pickles/steps/check_in/text.rb
114
+ - lib/cucumber/pickles/steps/check_in/video.rb
112
115
  - lib/cucumber/pickles/steps/click.rb
113
116
  - lib/cucumber/pickles/steps/fill.rb
114
117
  - lib/cucumber/pickles/steps/fill_in/complex_input.rb