cios_helpers 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0b7e92c244465ab955f19b8fdbd29bc0b3afc22f
4
- data.tar.gz: 7c2e83fcffd09aadc9307ef498f6833b96013397
3
+ metadata.gz: d024fa274936bcbcf33115fc8d58b794b040509f
4
+ data.tar.gz: 40ce21c4670eab95dcaab0029b359f095d7d3515
5
5
  SHA512:
6
- metadata.gz: 67c0bb9d2cf3a0185dc5deb54c343897519aa100d42ab36046ee59e46f4cbce45a102ceb434172c0537ee0b4a45ffeaf82f4d8355a3c1b16e11d5ef26ffcdbb9
7
- data.tar.gz: a6baee670bb055a90be03ffc27747ef2016073ca388ee51746021db617112a40af69901a544d2b676d4e91edefa266e5d5d04e02bd7c0629d4c70abe5a3a3374
6
+ metadata.gz: 8fafb06e6c195f0a292c4273b0ae4c1c0132e6bc4669048aefb1e5e6dbcb4204f7ea9cf28ade2b25fd80a747e79d3aef5b8b7cbc20c84c897bb6c792719e9136
7
+ data.tar.gz: e3c318f3129bab27e4064bf33fab4648902f48e2b2a12f1cc67ff38d537051b0d90082a86e088d9e40c43ca7f268774d825d72f011224ed7828c7934956ef2cf
data/cios_helpers.gemspec CHANGED
@@ -6,11 +6,11 @@ require 'cios_helpers/version'
6
6
  Gem::Specification.new do |spec|
7
7
  spec.name = "cios_helpers"
8
8
  spec.version = CiosHelpers::VERSION
9
- spec.authors = ["Joshua Escribano"]
10
- spec.email = ["escribirajoshua@gmail.com"]
11
- spec.description = ""
12
- spec.summary = ""
13
- spec.homepage = ""
9
+ spec.authors = ["Joshua Escribano", "Charles Wang"]
10
+ spec.email = ["escribirajoshua@gmail.com", "charles@xamarin.com"]
11
+ spec.description = "Adds helper methods to calabash-cucumber."
12
+ spec.summary = "cios_helpers-#{spec.version}"
13
+ spec.homepage = "https://github.com/jescriba/cios_helpers"
14
14
  spec.license = "MIT"
15
15
 
16
16
  spec.files = `git ls-files`.split($/)
@@ -18,6 +18,7 @@ Gem::Specification.new do |spec|
18
18
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
19
  spec.require_paths = ["lib"]
20
20
 
21
+ spec.add_runtime_dependency "calabash-cucumber"
21
22
  spec.add_development_dependency "bundler", "~> 1.3"
22
23
  spec.add_development_dependency "rake"
23
24
  end
data/lib/cios_helpers.rb CHANGED
@@ -1,5 +1,47 @@
1
1
  require "cios_helpers/version"
2
+ require "calabash-cucumber/ibase"
2
3
 
3
4
  module CiosHelpers
4
- # Your code goes here...
5
+
6
+ def until_element_exists opts = {}
7
+ '''Performs a lambda action until the element appears.
8
+ The default action is to do nothing.'''
9
+ raise "No element given." if opts[:element].nil?
10
+ timeout = opts[:timeout] || 10
11
+ action = opts[:action] || lambda { ; }
12
+ wait_poll until_exists: opts[:element], timeout: timeout do
13
+ action.call
14
+ end
15
+ end
16
+
17
+ def once_element_exists opts = {}
18
+ '''Performs a lambda action once the element exists.
19
+ The default behavior is to touch the specified element.'''
20
+ raise "No element given." if opts[:element].nil?
21
+ timeout = opts[:timeout] || 10
22
+ action = opts[:action] || lambda { touch opts[:element] }
23
+ wait_for_elements_exist [opts[:element]], timeout: timeout
24
+ action.call
25
+ end
26
+
27
+ def multiple_traits opts = {}
28
+ '''Pass an array of query elements. Determines the
29
+ correct trait for page objects that can have multiple
30
+ acceptable traits.'''
31
+ timeout = opts[:timeout] || 10
32
+ traits = opts[:traits] || ["*"]
33
+ trait = ''
34
+ action = lambda do
35
+ traits.each do |element|
36
+ if element_exists element
37
+ trait = element
38
+ break
39
+ end
40
+ end
41
+ !trait.empty?
42
+ end
43
+ wait_poll until: action, timeout: timeout do ; end
44
+ trait # Return the one trait
45
+ end
46
+
5
47
  end
@@ -1,3 +1,3 @@
1
1
  module CiosHelpers
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
metadata CHANGED
@@ -1,15 +1,30 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cios_helpers
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joshua Escribano
8
+ - Charles Wang
8
9
  autorequire:
9
10
  bindir: bin
10
11
  cert_chain: []
11
12
  date: 2014-01-03 00:00:00.000000000 Z
12
13
  dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: calabash-cucumber
16
+ requirement: !ruby/object:Gem::Requirement
17
+ requirements:
18
+ - - '>='
19
+ - !ruby/object:Gem::Version
20
+ version: '0'
21
+ type: :runtime
22
+ prerelease: false
23
+ version_requirements: !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - '>='
26
+ - !ruby/object:Gem::Version
27
+ version: '0'
13
28
  - !ruby/object:Gem::Dependency
14
29
  name: bundler
15
30
  requirement: !ruby/object:Gem::Requirement
@@ -38,9 +53,10 @@ dependencies:
38
53
  - - '>='
39
54
  - !ruby/object:Gem::Version
40
55
  version: '0'
41
- description: ''
56
+ description: Adds helper methods to calabash-cucumber.
42
57
  email:
43
58
  - escribirajoshua@gmail.com
59
+ - charles@xamarin.com
44
60
  executables: []
45
61
  extensions: []
46
62
  extra_rdoc_files: []
@@ -53,7 +69,7 @@ files:
53
69
  - cios_helpers.gemspec
54
70
  - lib/cios_helpers.rb
55
71
  - lib/cios_helpers/version.rb
56
- homepage: ''
72
+ homepage: https://github.com/jescriba/cios_helpers
57
73
  licenses:
58
74
  - MIT
59
75
  metadata: {}
@@ -76,5 +92,5 @@ rubyforge_project:
76
92
  rubygems_version: 2.1.10
77
93
  signing_key:
78
94
  specification_version: 4
79
- summary: ''
95
+ summary: cios_helpers-0.0.2
80
96
  test_files: []