rwebspec-webdriver 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -1,6 +1,10 @@
1
1
  CHANGELOG
2
2
  =========
3
3
 
4
+ == 0.1.3
5
+ * optimize uncheck checkbox, using clear instead of click
6
+ * optimize select_option, return after found matching option
7
+
4
8
  == 0.1.2
5
9
  * Remove assert_link_present_with_exact, add opts[:partial]
6
10
  * Rewrite assert_hidden, assert_enabled...
data/Rakefile CHANGED
@@ -69,7 +69,7 @@ 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.2"
72
+ s.version = "0.1.3"
73
73
  s.summary = "Executable functional specification for web applications in RSpec syntax and Selenium-WebDriver"
74
74
  # s.description = ""
75
75
 
@@ -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.0.1")
92
+ s.add_dependency("selenium-webdriver", ">= 2.3.0")
93
93
  s.add_dependency("sanitize", ">= 2.0.0")
94
94
  end
95
95
 
@@ -519,7 +519,10 @@ module RWebSpec
519
519
  options = select_box.find_elements(:tag_name, "option")
520
520
  options.each do |opt|
521
521
  # puts opt.methods
522
- opt.click if text == opt.text
522
+ if text == opt.text
523
+ opt.click
524
+ break
525
+ end
523
526
  end
524
527
  # select_list(:name, selectName).select(option)
525
528
  end
@@ -546,14 +549,17 @@ module RWebSpec
546
549
  values.class == Array ? arys = values : arys = [values]
547
550
  elements = find_elements(:name, checkBoxName)
548
551
  the_checkbox = elements[0] if elements.size == 1
549
- if the_checkbox
550
- the_checkbox.click unless the_checkbox.selected?
552
+ if the_checkbox && !the_checkbox.selected?
553
+ the_checkbox.click
551
554
  return
552
555
  end
553
556
 
554
557
  arys.each { |cbx_value|
555
558
  elements.each do |elem|
556
- elem.click if elem.attribute('value') == cbx_value && !the_checkbox.selected?
559
+ if elem.attribute('value') == cbx_value && !the_checkbox.selected?
560
+ elem.click
561
+ return
562
+ end
557
563
  end
558
564
  }
559
565
  else
@@ -571,19 +577,24 @@ module RWebSpec
571
577
  values.class == Array ? arys = values : arys = [values]
572
578
  elements = find_elements(:name, checkBoxName)
573
579
  the_checkbox = elements[0] if elements.size == 1
574
- if the_checkbox
575
- the_checkbox.click if the_checkbox.selected?
580
+ if the_checkbox && the_checkbox.selected?
581
+ the_checkbox.clear
582
+ # the_checkbox.click if the_checkbox.selected?
576
583
  return
577
584
  end
578
585
 
579
586
  arys.each { |cbx_value|
580
587
  elements.each do |elem|
581
- elem.click if elem.attribute('value') == cbx_value && the_checkbox && the_checkbox.selected?
588
+ if elem.attribute('value') == cbx_value && the_checkbox && the_checkbox.selected?
589
+ # elem.click
590
+ elem.clear
591
+ break
592
+ end
582
593
  end
583
594
  }
584
595
  else
585
596
  the_checkbox = find_element(:name, checkBoxName)
586
- the_checkbox.click if the_checkbox.selected?
597
+ the_checkbox.clear if the_checkbox.selected?
587
598
  end
588
599
  end
589
600
 
@@ -623,7 +634,7 @@ module RWebSpec
623
634
  def select_file_for_upload(file_field, file_path)
624
635
  is_on_windows = RUBY_PLATFORM.downcase.include?("mingw") || RUBY_PLATFORM.downcase.include?("mswin")
625
636
  normalized_file_path = is_on_windows ? file_path.gsub("/", "\\") : file_path
626
- file_field(:name, file_field).set(normalized_file_path)
637
+ find_element(:name, file_field).set_keys(normalized_file_path)
627
638
  end
628
639
 
629
640
  def start_window(url = nil)
@@ -17,7 +17,7 @@ require 'spec'
17
17
  require 'selenium-webdriver'
18
18
 
19
19
  unless defined? RWEBSPEC_VERSION
20
- RWEBSPEC_VERSION = "0.1"
20
+ RWEBSPEC_VERSION = "0.1.3"
21
21
  end
22
22
 
23
23
 
metadata CHANGED
@@ -1,13 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rwebspec-webdriver
3
3
  version: !ruby/object:Gem::Version
4
- hash: 31
5
- prerelease:
4
+ prerelease: false
6
5
  segments:
7
6
  - 0
8
7
  - 1
9
- - 2
10
- version: 0.1.2
8
+ - 3
9
+ version: 0.1.3
11
10
  platform: ruby
12
11
  authors:
13
12
  - Zhimin Zhan
@@ -15,18 +14,16 @@ autorequire: rwebspec-webdriver
15
14
  bindir: bin
16
15
  cert_chain: []
17
16
 
18
- date: 2011-07-13 00:00:00 +10:00
17
+ date: 2011-08-11 00:00:00 +10:00
19
18
  default_executable:
20
19
  dependencies:
21
20
  - !ruby/object:Gem::Dependency
22
21
  name: rspec
23
22
  prerelease: false
24
23
  requirement: &id001 !ruby/object:Gem::Requirement
25
- none: false
26
24
  requirements:
27
25
  - - "="
28
26
  - !ruby/object:Gem::Version
29
- hash: 11
30
27
  segments:
31
28
  - 1
32
29
  - 1
@@ -38,27 +35,23 @@ dependencies:
38
35
  name: selenium-webdriver
39
36
  prerelease: false
40
37
  requirement: &id002 !ruby/object:Gem::Requirement
41
- none: false
42
38
  requirements:
43
39
  - - ">="
44
40
  - !ruby/object:Gem::Version
45
- hash: 13
46
41
  segments:
47
42
  - 2
43
+ - 3
48
44
  - 0
49
- - 1
50
- version: 2.0.1
45
+ version: 2.3.0
51
46
  type: :runtime
52
47
  version_requirements: *id002
53
48
  - !ruby/object:Gem::Dependency
54
49
  name: sanitize
55
50
  prerelease: false
56
51
  requirement: &id003 !ruby/object:Gem::Requirement
57
- none: false
58
52
  requirements:
59
53
  - - ">="
60
54
  - !ruby/object:Gem::Version
61
- hash: 15
62
55
  segments:
63
56
  - 2
64
57
  - 0
@@ -110,27 +103,23 @@ rdoc_options: []
110
103
  require_paths:
111
104
  - lib
112
105
  required_ruby_version: !ruby/object:Gem::Requirement
113
- none: false
114
106
  requirements:
115
107
  - - ">="
116
108
  - !ruby/object:Gem::Version
117
- hash: 3
118
109
  segments:
119
110
  - 0
120
111
  version: "0"
121
112
  required_rubygems_version: !ruby/object:Gem::Requirement
122
- none: false
123
113
  requirements:
124
114
  - - ">="
125
115
  - !ruby/object:Gem::Version
126
- hash: 3
127
116
  segments:
128
117
  - 0
129
118
  version: "0"
130
119
  requirements:
131
120
  - none
132
121
  rubyforge_project: rwebspec-webdriver
133
- rubygems_version: 1.4.2
122
+ rubygems_version: 1.3.6
134
123
  signing_key:
135
124
  specification_version: 3
136
125
  summary: Executable functional specification for web applications in RSpec syntax and Selenium-WebDriver