softwear-lib 0.0.16 → 0.0.17

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: 5e9e5faa264baae9709c7aa3e617385ae064b4b3
4
- data.tar.gz: 1176a7fad8ce213844ed4b1546360e941eae7cf2
3
+ metadata.gz: 4ac2c8d7b7161999addf91016caab6f44f3b4dad
4
+ data.tar.gz: 9d2b1bd4545bcbf451dbc73297a346baf6073bf9
5
5
  SHA512:
6
- metadata.gz: 1a556e2889c49055add5ad93f1d0cd875254163d970235b1a1ce764dc04bf8b0a7775cae352683265ff8d9ed587cea9f33a64fa31e6229ace080a74fc2243359
7
- data.tar.gz: 9d31ab2998d6934f7b9f36b070eed84df8b822a8b1ae2822d3a5447b1c741b38c41ba2b3f97b8c0792e9ddf2bd45e5b38c23aa4ddbfe834eff1b89dcc50a97c1
6
+ metadata.gz: 3c688a01c3e57392e957a1aca79910fd7e80e274af1ba3ca62cfb9df06bc5a55b1b98a52f27b99149ec90659e51d968afb64b1842b70a6ae5e17b804d271192c
7
+ data.tar.gz: 416b4b8ab059bf372c23a02430864e5842661bb4e52d15fd23be1bce90295186bba1082911d290d045ba13d4ff04a8025361a10bd489d1567d99686a6fc10263
@@ -44,6 +44,50 @@ module Softwear::Lib
44
44
  # Restore existing default
45
45
  page.evaluate_script('window.confirm = function() { return true; }')
46
46
  end
47
+
48
+ def eventually_fill_in(field, options={})
49
+ page.should have_css('#' + field)
50
+ fill_in field, options
51
+ end
52
+
53
+ def within_row(num, &block)
54
+ if RSpec.current_example.metadata[:js]
55
+ within("table.index tbody tr:nth-child(#{num})", &block)
56
+ else
57
+ within(:xpath, all('table.index tbody tr')[num-1].path, &block)
58
+ end
59
+ end
60
+
61
+ def column_text(num)
62
+ if RSpec.current_example.metadata[:js]
63
+ find("td:nth-child(#{num})").text
64
+ else
65
+ all('td')[num-1].text
66
+ end
67
+ end
68
+
69
+ def find_label_by_text(text)
70
+ label = find_label(text)
71
+ counter = 0
72
+
73
+ # Because JavaScript testing is prone to errors...
74
+ while label.nil? && counter < 10
75
+ sleep(1)
76
+ counter += 1
77
+ label = find_label(text)
78
+ end
79
+
80
+ if label.nil?
81
+ raise "Could not find label by text #{text}"
82
+ end
83
+
84
+ label
85
+ end
86
+
87
+ def find_label(text)
88
+ first(:xpath, "//label[text()[contains(.,'#{text}')]]")
89
+ end
90
+
47
91
  end
48
92
 
49
93
  module Select2
@@ -65,7 +109,7 @@ module Softwear::Lib
65
109
  select_select2_result(value)
66
110
  end
67
111
 
68
- def nonfunctional_select2(value, options)
112
+ def select2(value, options)
69
113
  label = find_label_by_text(options[:from])
70
114
 
71
115
  within label.first(:xpath,'.//..') do
@@ -1,5 +1,5 @@
1
1
  module Softwear
2
2
  module Lib
3
- VERSION = "0.0.16"
3
+ VERSION = "0.0.17"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: softwear-lib
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.16
4
+ version: 0.0.17
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nigel Baillie