web4cucumber 0.0.7 → 0.0.8

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: 09f2ae8b4f38c4ce225c93a487a25e6c30d2dd6c
4
- data.tar.gz: 5099fd51931bc779bd8fac847b47791036b28995
3
+ metadata.gz: 665d2600c206c0133279ee8f6d5a5e3b94283f34
4
+ data.tar.gz: 8ffc25cafcedfdbaa5b14fdd8c8fb7119550aac0
5
5
  SHA512:
6
- metadata.gz: 58b42e5b1452ba7bf297b4f393719529c6231e2da1b3b511c454e8474666ec23e1fb469c763d352ed9bc73f8c7bd86b4333f026a864248c0bdc3c68f3a88515a
7
- data.tar.gz: 20f5be395473dc40e1f0b8d26d71772a7fd85a894dea7d58d3695c31fad4bd63bb10118bbfb28c95e6f924ed9c0d2caaed04ae404e2d051e52e7f9fd6196c4d7
6
+ metadata.gz: b9d51ac82df67ae8e13d4ec9822728b8abbb304aba5f9dad097bc66870cc4dde1e308e2d8b9810e691bb4af0eea6fd905eb40241ac437d40c973f1c0f7431f30
7
+ data.tar.gz: ebb7890e5377b5d93153036d092c9f6aec4049cbd2efaa55213cde89eb51a245f4007c77aa51fc4e17aed092faa4b5fe53d8038b32d66642e34f723edc8e3ae4
@@ -7,7 +7,6 @@ GEM
7
7
  debugger-linecache (~> 1.2)
8
8
  childprocess (0.5.5)
9
9
  ffi (~> 1.0, >= 1.0.11)
10
- coderay (1.1.0)
11
10
  columnize (0.9.0)
12
11
  cucumber (1.3.19)
13
12
  builder (>= 2.1.2)
@@ -21,14 +20,8 @@ GEM
21
20
  gherkin (2.12.2)
22
21
  multi_json (~> 1.3)
23
22
  headless (1.0.2)
24
- json (1.8.2)
25
- method_source (0.8.2)
26
23
  multi_json (1.10.1)
27
24
  multi_test (0.1.2)
28
- pry (0.9.12.6)
29
- coderay (~> 1.0)
30
- method_source (~> 0.8)
31
- slop (~> 3.4)
32
25
  rspec-expectations (2.14.4)
33
26
  diff-lcs (>= 1.1.3, < 2.0)
34
27
  rubyzip (1.1.7)
@@ -37,7 +30,6 @@ GEM
37
30
  multi_json (~> 1.0)
38
31
  rubyzip (~> 1.0)
39
32
  websocket (~> 1.0)
40
- slop (3.5.0)
41
33
  watir-webdriver (0.6.11)
42
34
  selenium-webdriver (>= 2.18.0)
43
35
  web4cucumber (0.0.2)
@@ -50,11 +42,6 @@ PLATFORMS
50
42
  ruby
51
43
 
52
44
  DEPENDENCIES
53
- byebug
54
45
  cucumber
55
- headless
56
- json
57
- pry
58
46
  rspec-expectations
59
- watir-webdriver
60
47
  web4cucumber
data/lib/web4cucumber.rb CHANGED
@@ -421,7 +421,7 @@ class Web4Cucumber
421
421
 
422
422
  def initialize(options)
423
423
  # Let's make sure, that we get all necessary options in the proper format
424
- obligatory_options = [:base_url, :rules_path, :logger]
424
+ obligatory_options ||= [:base_url, :rules_path, :logger]
425
425
  # :logger should be a Logger class instance with at least the following
426
426
  # methods implemented, taking a string as an argument:
427
427
  # - info
@@ -434,7 +434,6 @@ class Web4Cucumber
434
434
  end
435
435
  if (options.keys & obligatory_options).sort == obligatory_options.sort
436
436
  @@base_url = options[:base_url]
437
- @@rules_path = options[:rules_path]
438
437
  @@logger = options[:logger]
439
438
  else
440
439
  raise "Please provide #{obligatory_options.join(', ')} in the passed options"
@@ -490,7 +489,7 @@ class Web4Cucumber
490
489
  if params[:url].match /^:\d+/
491
490
  base_url.gsub!(/\/$/, "")
492
491
  end
493
- @@b.goto base_url + params[:url]
492
+ @@b.goto @@base_url + params[:url]
494
493
  else
495
494
  @@b.goto params[:url]
496
495
  end
@@ -758,5 +757,64 @@ class Web4Cucumber
758
757
  return result
759
758
  end
760
759
 
761
- end
760
+ def textfield_clear(element)
761
+ result = {
762
+ :result => true,
763
+ :errors =>[]}
764
+ unless element.match(/\:\w+\=\>[\'\"]\S+[\"\']/)
765
+ raise "Please pass the element string in the form :selector=>\"value\""
766
+ end
767
+ # Only textfields are supported
768
+ begin
769
+ @@b.text_field(element).clear
770
+ rescue => e
771
+ result[:result] = false
772
+ result[:errors] << e.message
773
+ end
774
+ end
762
775
 
776
+ def run_custom(action, options={})
777
+ if options.has_key? :background
778
+ fork do
779
+ run_action(action, options)
780
+ end
781
+ else
782
+ return run_action(action, options)
783
+ end
784
+ end
785
+
786
+ def typetext(element, text)
787
+ unless element.match(/\:\w+\=\>[\'\"]\S+[\"\']/)
788
+ raise "Please pass the element string in the form :selector=>\"value\""
789
+ end
790
+ result = {:result => true,
791
+ :errors => []
792
+ }
793
+ begin
794
+ @@b.text_field(element).clear
795
+ @@b.text_field(element).send_keys text
796
+ rescue => e
797
+ result[:result] = false
798
+ result[:errors] << e.message
799
+ end
800
+ end
801
+
802
+ def value_list(element)
803
+ if not element.match(/\:\w+\=\>[\'\"]\S+[\"\']/)
804
+ raise "Please pass the element string in the form :selector=>\"value\""
805
+ end
806
+ result = {:result => true,
807
+ :errors => [],
808
+ :valuelist => []}
809
+ unless @@b.select_list(element).exists?
810
+ screenshot_save
811
+ result[:result] = false
812
+ result[:errors] << "Unable to find element with #{element.keys[0].to_s} #{element.values[0]}"
813
+ else
814
+ @@b.select_list(element).options.each do |option|
815
+ result[:valuelist] << option.value
816
+ end
817
+ end
818
+ return result
819
+ end
820
+ end
@@ -1,3 +1,3 @@
1
1
  module Web4Cucumber
2
- VERSION = "0.0.7"
2
+ VERSION = "0.0.8"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: web4cucumber
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Oleg Fayans