rwebspec-webdriver 0.1.5 → 0.2

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -1,6 +1,9 @@
1
1
  CHANGELOG
2
2
  =========
3
3
 
4
+ == 0.2
5
+ * Deprecate try method, use try_until instead
6
+
4
7
  == 0.1.5
5
8
  * Support TestWise 2
6
9
 
data/Rakefile CHANGED
@@ -69,9 +69,9 @@ end
69
69
  spec = Gem::Specification.new do |s|
70
70
  s.platform= Gem::Platform::RUBY
71
71
  s.name = "rwebspec-webdriver"
72
- s.version = "0.1.5"
72
+ s.version = "0.2"
73
73
  s.summary = "Executable functional specification for web applications in RSpec syntax and Selenium-WebDriver"
74
- s.description = "Alternative web test syntax on top of Selenium-WebDriver"
74
+ # s.description = ""
75
75
 
76
76
  s.author = "Zhimin Zhan"
77
77
  s.email = "zhimin@agileway.net"
@@ -81,7 +81,7 @@ spec = Gem::Specification.new do |s|
81
81
  s.has_rdoc = true
82
82
  s.requirements << 'none'
83
83
  s.require_path = "lib"
84
- # s.autorequire = "rwebspec-webdriver"
84
+ s.autorequire = "rwebspec-webdriver"
85
85
 
86
86
  s.files = [ "Rakefile", "README", "CHANGELOG", "MIT-LICENSE" ]
87
87
  s.files = s.files + Dir.glob( "lib/**/*" )
@@ -89,7 +89,7 @@ spec = Gem::Specification.new do |s|
89
89
  s.files = s.files + Dir.glob( "sample/**/*")
90
90
  s.files = s.files + Dir.glob( "docs/**/*" )
91
91
  s.add_dependency(%q<rspec>, ["= 1.1.12"])
92
- s.add_dependency("selenium-webdriver", ">= 2.3.0")
92
+ s.add_dependency("selenium-webdriver", ">= 2.0.1")
93
93
  s.add_dependency("sanitize", ">= 2.0.0")
94
94
  end
95
95
 
@@ -17,7 +17,7 @@ require 'spec'
17
17
  require 'selenium-webdriver'
18
18
 
19
19
  unless defined? RWEBSPEC_VERSION
20
- RWEBSPEC_VERSION = "0.1.5"
20
+ RWEBSPEC_VERSION = "0.2"
21
21
  end
22
22
 
23
23
 
@@ -783,7 +783,7 @@ module RWebSpec
783
783
  # try { click_link('waiting')}
784
784
  # try(10, 2) { click_button('Search' } # try to click the 'Search' button upto 10 seconds, try every 2 seconds
785
785
  # try { click_button('Search' }
786
- def try(timeout = @@default_timeout, polling_interval = @@default_polling_interval || 1, & block)
786
+ def try_until(timeout = @@default_timeout, polling_interval = @@default_polling_interval || 1, & block)
787
787
  start_time = Time.now
788
788
 
789
789
  last_error = nil
@@ -801,8 +801,15 @@ module RWebSpec
801
801
  raise "Timeout after #{duration.to_i} seconds."
802
802
  end
803
803
 
804
- alias try_upto try
804
+ alias try_upto try_until
805
805
 
806
+ def try(timeout = @@default_timeout, polling_interval = @@default_polling_interval || 1, &block)
807
+ puts "Warning: method 'try' is deprecated (won't support in RWebSpec 3), use try_until instead."
808
+ try_until(timeout, polling_interval) {
809
+ yield
810
+ }
811
+ end
812
+
806
813
  ##
807
814
  # Convert :first to 1, :second to 2, and so on...
808
815
  def symbol_to_sequence(symb)
@@ -525,10 +525,7 @@ module RWebSpec
525
525
  options = select_box.find_elements(:tag_name, "option")
526
526
  options.each do |opt|
527
527
  # puts opt.methods
528
- if text == opt.text
529
- opt.click
530
- break
531
- end
528
+ opt.click if text == opt.text
532
529
  end
533
530
  # select_list(:name, selectName).select(option)
534
531
  end
@@ -555,17 +552,14 @@ module RWebSpec
555
552
  values.class == Array ? arys = values : arys = [values]
556
553
  elements = find_elements(:name, checkBoxName)
557
554
  the_checkbox = elements[0] if elements.size == 1
558
- if the_checkbox && !the_checkbox.selected?
559
- the_checkbox.click
555
+ if the_checkbox
556
+ the_checkbox.click unless the_checkbox.selected?
560
557
  return
561
558
  end
562
559
 
563
560
  arys.each { |cbx_value|
564
561
  elements.each do |elem|
565
- if elem.attribute('value') == cbx_value && !the_checkbox.selected?
566
- elem.click
567
- return
568
- end
562
+ elem.click if elem.attribute('value') == cbx_value && !the_checkbox.selected?
569
563
  end
570
564
  }
571
565
  else
@@ -583,24 +577,19 @@ module RWebSpec
583
577
  values.class == Array ? arys = values : arys = [values]
584
578
  elements = find_elements(:name, checkBoxName)
585
579
  the_checkbox = elements[0] if elements.size == 1
586
- if the_checkbox && the_checkbox.selected?
587
- the_checkbox.clear
588
- # the_checkbox.click if the_checkbox.selected?
580
+ if the_checkbox
581
+ the_checkbox.click if the_checkbox.selected?
589
582
  return
590
583
  end
591
584
 
592
585
  arys.each { |cbx_value|
593
586
  elements.each do |elem|
594
- if elem.attribute('value') == cbx_value && the_checkbox && the_checkbox.selected?
595
- # elem.click
596
- elem.clear
597
- break
598
- end
587
+ elem.click if elem.attribute('value') == cbx_value && the_checkbox && the_checkbox.selected?
599
588
  end
600
589
  }
601
590
  else
602
591
  the_checkbox = find_element(:name, checkBoxName)
603
- the_checkbox.clear if the_checkbox.selected?
592
+ the_checkbox.click if the_checkbox.selected?
604
593
  end
605
594
  end
606
595
 
@@ -640,7 +629,7 @@ module RWebSpec
640
629
  def select_file_for_upload(file_field, file_path)
641
630
  is_on_windows = RUBY_PLATFORM.downcase.include?("mingw") || RUBY_PLATFORM.downcase.include?("mswin")
642
631
  normalized_file_path = is_on_windows ? file_path.gsub("/", "\\") : file_path
643
- find_element(:name, file_field).set_keys(normalized_file_path)
632
+ file_field(:name, file_field).set(normalized_file_path)
644
633
  end
645
634
 
646
635
  def start_window(url = nil)
metadata CHANGED
@@ -4,17 +4,16 @@ version: !ruby/object:Gem::Version
4
4
  prerelease: false
5
5
  segments:
6
6
  - 0
7
- - 1
8
- - 5
9
- version: 0.1.5
7
+ - 2
8
+ version: "0.2"
10
9
  platform: ruby
11
10
  authors:
12
11
  - Zhimin Zhan
13
- autorequire:
12
+ autorequire: rwebspec-webdriver
14
13
  bindir: bin
15
14
  cert_chain: []
16
15
 
17
- date: 2011-11-30 00:00:00 +10:00
16
+ date: 2011-12-18 00:00:00 +10:00
18
17
  default_executable:
19
18
  dependencies:
20
19
  - !ruby/object:Gem::Dependency
@@ -40,9 +39,9 @@ dependencies:
40
39
  - !ruby/object:Gem::Version
41
40
  segments:
42
41
  - 2
43
- - 3
44
42
  - 0
45
- version: 2.3.0
43
+ - 1
44
+ version: 2.0.1
46
45
  type: :runtime
47
46
  version_requirements: *id002
48
47
  - !ruby/object:Gem::Dependency
@@ -59,7 +58,7 @@ dependencies:
59
58
  version: 2.0.0
60
59
  type: :runtime
61
60
  version_requirements: *id003
62
- description: Alternative web test syntax on top of Selenium-WebDriver
61
+ description:
63
62
  email: zhimin@agileway.net
64
63
  executables: []
65
64