gxt-widgets 0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (41) hide show
  1. data/.gitignore +21 -0
  2. data/.travis.yml +8 -0
  3. data/Gemfile +11 -0
  4. data/Rakefile +33 -0
  5. data/cucumber.yml +12 -0
  6. data/features/gxt_grid.feature +87 -0
  7. data/features/gxt_grid_with_grouping.feature +48 -0
  8. data/features/gxt_pager.feature +37 -0
  9. data/features/step_definitions/common_steps.rb +11 -0
  10. data/features/step_definitions/gxt_grid_steps.rb +131 -0
  11. data/features/step_definitions/gxt_grid_with_grouping_steps.rb +8 -0
  12. data/features/step_definitions/gxt_pager_steps.rb +32 -0
  13. data/features/support/env.rb +8 -0
  14. data/features/support/hooks.rb +7 -0
  15. data/features/support/pages/basic_grid_example.rb +9 -0
  16. data/features/support/pages/grouping_grid_example.rb +5 -0
  17. data/features/support/pages/gxt_examples_page.rb +9 -0
  18. data/features/support/pages/local_pagination_example.rb +6 -0
  19. data/features/support/persistent_browser.rb +20 -0
  20. data/gxt-widget.gemspec +31 -0
  21. data/lib/gxt-widgets.rb +15 -0
  22. data/lib/gxt-widgets/gxt_column_menu.rb +11 -0
  23. data/lib/gxt-widgets/gxt_column_selection_menu.rb +7 -0
  24. data/lib/gxt-widgets/gxt_grid.rb +34 -0
  25. data/lib/gxt-widgets/gxt_grid_header_row.rb +23 -0
  26. data/lib/gxt-widgets/gxt_grid_row.rb +31 -0
  27. data/lib/gxt-widgets/gxt_header_cell.rb +15 -0
  28. data/lib/gxt-widgets/gxt_pager.rb +36 -0
  29. data/lib/gxt-widgets/modules/selectable_column.rb +13 -0
  30. data/lib/gxt-widgets/modules/sortable_column.rb +12 -0
  31. data/lib/gxt-widgets/platforms/selenium_webdriver/gxt_grid.rb +25 -0
  32. data/lib/gxt-widgets/platforms/selenium_webdriver/gxt_grid_header_row.rb +23 -0
  33. data/lib/gxt-widgets/platforms/selenium_webdriver/gxt_grid_row.rb +15 -0
  34. data/lib/gxt-widgets/platforms/watir_webdriver/gxt_grid.rb +35 -0
  35. data/lib/gxt-widgets/platforms/watir_webdriver/gxt_grid_header_row.rb +22 -0
  36. data/lib/gxt-widgets/platforms/watir_webdriver/gxt_grid_row.rb +17 -0
  37. data/lib/gxt-widgets/version.rb +4 -0
  38. data/readme.md +15 -0
  39. data/spec/gxt-widgets/gxt_grid_row_spec.rb +67 -0
  40. data/spec/gxt-widgets/gxt_grid_spec.rb +96 -0
  41. metadata +223 -0
@@ -0,0 +1,17 @@
1
+ module GxtWidgets
2
+ module Platforms
3
+ module WatirWebDriver
4
+ module GxtGridRow
5
+ include PageObject::Platforms::WatirWebDriver::TableRow
6
+
7
+ private
8
+
9
+ def find_index_by_title(title)
10
+ first_row = @container.first_row.element
11
+ first_row.cells.find_index {|column| column.text.include? title }
12
+ end
13
+
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,4 @@
1
+ module GxtWidgets
2
+ # @private
3
+ VERSION = "0.1"
4
+ end
@@ -0,0 +1,15 @@
1
+ This is a collection of widgets which simplify the testing of GXT web applications by extending the page-object gem.
2
+
3
+ The goal of this library is two-fold. One, to provide a useful set of widgets for working with standard GXT controls. Second, to provide examples of how to extend PageObject for interacting with complex controls.
4
+
5
+ The first widgets are gxt_grid and gxt_pager.
6
+
7
+ Work to do: Fill out widgets from the Gxt Example Gallery http://gxtexamplegallery.appspot.com/
8
+
9
+ Add a Grid with Grouping widget.
10
+
11
+ Add a Basic Tree Widget.
12
+
13
+ Add a Basic Tree Grid.
14
+
15
+ Add a Grid with Grouping.
@@ -0,0 +1,67 @@
1
+ require 'page-object/elements'
2
+ require "gxt-widgets/gxt_grid_row"
3
+
4
+ describe GxtWidgets::GxtGridRow do
5
+ let(:table_cell) { double('table_cell') }
6
+ let(:table_row_driver) { double('table_row_driver') }
7
+ let(:table) { double('table') }
8
+
9
+ describe "interface" do
10
+
11
+ context "for selenium" do
12
+ it "should return a table cell when indexed" do
13
+ table_row = GxtWidgets::GxtGridRow.new(table_row_driver, table, :platform => :selenium_webdriver)
14
+ table_row.stub(:columns).and_return(2)
15
+ table_row_driver.should_receive(:find_elements).with(:xpath, ".//child::td|th").and_return(table_cell)
16
+ table_cell.should_receive(:[]).and_return(table_cell)
17
+ table_row[0].should be_instance_of PageObject::Elements::TableCell
18
+ end
19
+
20
+ it "should retrun the number of columns" do
21
+ table_row = GxtWidgets::GxtGridRow.new(table_row_driver, table, :platform => :selenium_webdriver)
22
+ table_row_driver.should_receive(:find_elements).with(:xpath, ".//child::td|th").and_return(table_row_driver)
23
+ table_row_driver.should_receive(:size).and_return(3)
24
+ table_row.columns.should == 3
25
+ end
26
+
27
+ it "should iterate over the table columns" do
28
+ table_row = GxtWidgets::GxtGridRow.new(table_row_driver, table, :platform => :selenium_webdriver)
29
+ table_row.should_receive(:columns).and_return(2)
30
+ table_row.stub(:[]).and_return(table_row_driver)
31
+ count = 0
32
+ table_row.each { |e| count += 1 }
33
+ count.should == 2
34
+ end
35
+ end
36
+
37
+ context "for watir" do
38
+ before(:each) do
39
+ table_row_driver.stub(:find_elements).and_return(table_row_driver)
40
+ end
41
+
42
+ it "should return a table cell when indexed" do
43
+ table_row = GxtWidgets::GxtGridRow.new(table_row_driver, table, :platform => :watir_webdriver)
44
+ table_row.stub(:columns).and_return(2)
45
+ table_row_driver.should_receive(:[]).with(1).and_return(table_cell)
46
+ table_row[1].should be_instance_of PageObject::Elements::TableCell
47
+ end
48
+
49
+ it "should return the number of columns" do
50
+ table_row = GxtWidgets::GxtGridRow.new(table_row_driver, table, :platform => :watir_webdriver)
51
+ table_row_driver.stub(:wd).and_return(table_row_driver)
52
+ table_row_driver.should_receive(:find_elements).with(:xpath, ".//child::td|th").and_return(table_row_driver)
53
+ table_row_driver.should_receive(:size).and_return(3)
54
+ table_row.columns.should == 3
55
+ end
56
+
57
+ it "should iterate over the table columns" do
58
+ table_row = GxtWidgets::GxtGridRow.new(table_row_driver, table, :platform => :watir_webdriver)
59
+ table_row.should_receive(:columns).and_return(2)
60
+ table_row.stub(:[])
61
+ count = 0
62
+ table_row.each { |e| count += 1 }
63
+ count.should == 2
64
+ end
65
+ end
66
+ end
67
+ end
@@ -0,0 +1,96 @@
1
+ require 'gxt-widgets'
2
+
3
+ describe GxtWidgets do
4
+
5
+ describe "interface" do
6
+ let(:gxt_grid_element) { double('gxt_grid_element') }
7
+
8
+ before(:each) do
9
+ gxt_grid_element.stub(:find_elements).and_return(gxt_grid_element)
10
+ end
11
+
12
+ context "for watir" do
13
+ let(:watir_gxt_grid) { GxtWidgets::GxtGrid.new(gxt_grid_element, :platform => :watir_webdriver) }
14
+
15
+ before(:each) do
16
+ gxt_grid_element.stub(:trs).and_return(gxt_grid_element)
17
+ end
18
+
19
+ it "should return a table row when indexed" do
20
+ gxt_grid_element.stub(:[]).with(1).and_return(gxt_grid_element)
21
+ watir_gxt_grid[1].should be_instance_of GxtWidgets::GxtGridRow
22
+ end
23
+
24
+ it "should return the first row" do
25
+ gxt_grid_element.stub(:[]).with(0).and_return(gxt_grid_element)
26
+ watir_gxt_grid.first_row.should be_instance_of GxtWidgets::GxtGridRow
27
+ end
28
+
29
+ it "should return the last row" do
30
+ gxt_grid_element.stub(:[]).with(-1).and_return(gxt_grid_element)
31
+ watir_gxt_grid.last_row.should be_instance_of GxtWidgets::GxtGridRow
32
+ end
33
+
34
+ it "should return the number of rows" do
35
+ gxt_grid_element.stub(:wd).and_return(gxt_grid_element)
36
+ gxt_grid_element.should_receive(:find_elements).with(:xpath, ".//descendant::tr").and_return(gxt_grid_element)
37
+ gxt_grid_element.should_receive(:size).and_return(2)
38
+ watir_gxt_grid.rows.should == 2
39
+ end
40
+
41
+ it "should iterate over the table rows" do
42
+ watir_gxt_grid.should_receive(:rows).and_return(2)
43
+ gxt_grid_element.should_receive(:[]).twice
44
+ count = 0
45
+ watir_gxt_grid.each { |e| count += 1 }
46
+ count.should == 2
47
+ end
48
+
49
+ it "should return a header row" do
50
+ gxt_grid_element.stub(:header).and_return(gxt_grid_element)
51
+ gxt_grid_element.should_receive(:[]).with(0)
52
+ watir_gxt_grid.header.should be_instance_of GxtWidgets::GxtGridHeaderRow
53
+ end
54
+ end
55
+
56
+ context "for selenium" do
57
+ before(:each) do
58
+ gxt_grid_element.stub(:[]).and_return(gxt_grid_element)
59
+ end
60
+ let(:selenium_gxt_grid) { GxtWidgets::GxtGrid.new(gxt_grid_element, :platform => :selenium_webdriver) }
61
+
62
+ it "should return a table row when indexed" do
63
+ gxt_grid_element.should_receive(:find_elements).with(:xpath, ".//descendant::tr").and_return(gxt_grid_element)
64
+ selenium_gxt_grid[1].should be_instance_of GxtWidgets::GxtGridRow
65
+ end
66
+
67
+ it "should return the first row" do
68
+ gxt_grid_element.stub(:[]).with(0).and_return(gxt_grid_element)
69
+ selenium_gxt_grid.first_row.should be_instance_of GxtWidgets::GxtGridRow
70
+ end
71
+
72
+ it "should return the last row" do
73
+ gxt_grid_element.stub(:[]).with(-1).and_return(gxt_grid_element)
74
+ selenium_gxt_grid.last_row.should be_instance_of GxtWidgets::GxtGridRow
75
+ end
76
+
77
+ it "should return the number of rows" do
78
+ gxt_grid_element.should_receive(:find_elements).with(:xpath, ".//descendant::tr").and_return(gxt_grid_element)
79
+ gxt_grid_element.should_receive(:size).and_return(2)
80
+ selenium_gxt_grid.rows.should == 2
81
+ end
82
+
83
+ it "should iterate over the table rows" do
84
+ selenium_gxt_grid.should_receive(:rows).and_return(2)
85
+ count = 0
86
+ selenium_gxt_grid.each { |e| count += 1 }
87
+ count.should == 2
88
+ end
89
+
90
+ it "should return a header row" do
91
+ gxt_grid_element.stub(:header).and_return(gxt_grid_element)
92
+ selenium_gxt_grid.header.should be_instance_of GxtWidgets::GxtGridHeaderRow
93
+ end
94
+ end
95
+ end
96
+ end
metadata ADDED
@@ -0,0 +1,223 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: gxt-widgets
3
+ version: !ruby/object:Gem::Version
4
+ version: '0.1'
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - William J. Powell
9
+ - Jeff Morgan
10
+ autorequire:
11
+ bindir: bin
12
+ cert_chain: []
13
+ date: 2013-02-27 00:00:00.000000000 Z
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: page-object
17
+ requirement: !ruby/object:Gem::Requirement
18
+ none: false
19
+ requirements:
20
+ - - ! '>='
21
+ - !ruby/object:Gem::Version
22
+ version: 0.8.2
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ none: false
27
+ requirements:
28
+ - - ! '>='
29
+ - !ruby/object:Gem::Version
30
+ version: 0.8.2
31
+ - !ruby/object:Gem::Dependency
32
+ name: rspec
33
+ requirement: !ruby/object:Gem::Requirement
34
+ none: false
35
+ requirements:
36
+ - - ! '>='
37
+ - !ruby/object:Gem::Version
38
+ version: 2.12.0
39
+ type: :development
40
+ prerelease: false
41
+ version_requirements: !ruby/object:Gem::Requirement
42
+ none: false
43
+ requirements:
44
+ - - ! '>='
45
+ - !ruby/object:Gem::Version
46
+ version: 2.12.0
47
+ - !ruby/object:Gem::Dependency
48
+ name: cucumber
49
+ requirement: !ruby/object:Gem::Requirement
50
+ none: false
51
+ requirements:
52
+ - - <
53
+ - !ruby/object:Gem::Version
54
+ version: 1.2.0
55
+ type: :development
56
+ prerelease: false
57
+ version_requirements: !ruby/object:Gem::Requirement
58
+ none: false
59
+ requirements:
60
+ - - <
61
+ - !ruby/object:Gem::Version
62
+ version: 1.2.0
63
+ - !ruby/object:Gem::Dependency
64
+ name: yard
65
+ requirement: !ruby/object:Gem::Requirement
66
+ none: false
67
+ requirements:
68
+ - - ! '>='
69
+ - !ruby/object:Gem::Version
70
+ version: 0.7.2
71
+ type: :development
72
+ prerelease: false
73
+ version_requirements: !ruby/object:Gem::Requirement
74
+ none: false
75
+ requirements:
76
+ - - ! '>='
77
+ - !ruby/object:Gem::Version
78
+ version: 0.7.2
79
+ - !ruby/object:Gem::Dependency
80
+ name: rack
81
+ requirement: !ruby/object:Gem::Requirement
82
+ none: false
83
+ requirements:
84
+ - - ! '>='
85
+ - !ruby/object:Gem::Version
86
+ version: '1.0'
87
+ type: :development
88
+ prerelease: false
89
+ version_requirements: !ruby/object:Gem::Requirement
90
+ none: false
91
+ requirements:
92
+ - - ! '>='
93
+ - !ruby/object:Gem::Version
94
+ version: '1.0'
95
+ - !ruby/object:Gem::Dependency
96
+ name: watir-webdriver
97
+ requirement: !ruby/object:Gem::Requirement
98
+ none: false
99
+ requirements:
100
+ - - ! '>='
101
+ - !ruby/object:Gem::Version
102
+ version: 0.6.2
103
+ type: :development
104
+ prerelease: false
105
+ version_requirements: !ruby/object:Gem::Requirement
106
+ none: false
107
+ requirements:
108
+ - - ! '>='
109
+ - !ruby/object:Gem::Version
110
+ version: 0.6.2
111
+ - !ruby/object:Gem::Dependency
112
+ name: selenium-webdriver
113
+ requirement: !ruby/object:Gem::Requirement
114
+ none: false
115
+ requirements:
116
+ - - ! '>='
117
+ - !ruby/object:Gem::Version
118
+ version: 2.27.2
119
+ type: :development
120
+ prerelease: false
121
+ version_requirements: !ruby/object:Gem::Requirement
122
+ none: false
123
+ requirements:
124
+ - - ! '>='
125
+ - !ruby/object:Gem::Version
126
+ version: 2.27.2
127
+ description: An Extension to page-object gem which provides widgets for interacting
128
+ with GXT controls found on the Gxt Example Gallery http://gxtexamplegallery.appspot.com/
129
+ email:
130
+ - williamjpowell@gmail.com
131
+ - jeff.morgan@leandog.com
132
+ executables: []
133
+ extensions: []
134
+ extra_rdoc_files: []
135
+ files:
136
+ - .gitignore
137
+ - .travis.yml
138
+ - Gemfile
139
+ - Rakefile
140
+ - cucumber.yml
141
+ - features/gxt_grid.feature
142
+ - features/gxt_grid_with_grouping.feature
143
+ - features/gxt_pager.feature
144
+ - features/step_definitions/common_steps.rb
145
+ - features/step_definitions/gxt_grid_steps.rb
146
+ - features/step_definitions/gxt_grid_with_grouping_steps.rb
147
+ - features/step_definitions/gxt_pager_steps.rb
148
+ - features/support/env.rb
149
+ - features/support/hooks.rb
150
+ - features/support/pages/basic_grid_example.rb
151
+ - features/support/pages/grouping_grid_example.rb
152
+ - features/support/pages/gxt_examples_page.rb
153
+ - features/support/pages/local_pagination_example.rb
154
+ - features/support/persistent_browser.rb
155
+ - gxt-widget.gemspec
156
+ - lib/gxt-widgets.rb
157
+ - lib/gxt-widgets/gxt_column_menu.rb
158
+ - lib/gxt-widgets/gxt_column_selection_menu.rb
159
+ - lib/gxt-widgets/gxt_grid.rb
160
+ - lib/gxt-widgets/gxt_grid_header_row.rb
161
+ - lib/gxt-widgets/gxt_grid_row.rb
162
+ - lib/gxt-widgets/gxt_header_cell.rb
163
+ - lib/gxt-widgets/gxt_pager.rb
164
+ - lib/gxt-widgets/modules/selectable_column.rb
165
+ - lib/gxt-widgets/modules/sortable_column.rb
166
+ - lib/gxt-widgets/platforms/selenium_webdriver/gxt_grid.rb
167
+ - lib/gxt-widgets/platforms/selenium_webdriver/gxt_grid_header_row.rb
168
+ - lib/gxt-widgets/platforms/selenium_webdriver/gxt_grid_row.rb
169
+ - lib/gxt-widgets/platforms/watir_webdriver/gxt_grid.rb
170
+ - lib/gxt-widgets/platforms/watir_webdriver/gxt_grid_header_row.rb
171
+ - lib/gxt-widgets/platforms/watir_webdriver/gxt_grid_row.rb
172
+ - lib/gxt-widgets/version.rb
173
+ - readme.md
174
+ - spec/gxt-widgets/gxt_grid_row_spec.rb
175
+ - spec/gxt-widgets/gxt_grid_spec.rb
176
+ homepage: http://github.com/wjpowell/gxt-widgets
177
+ licenses: []
178
+ post_install_message:
179
+ rdoc_options: []
180
+ require_paths:
181
+ - lib
182
+ required_ruby_version: !ruby/object:Gem::Requirement
183
+ none: false
184
+ requirements:
185
+ - - ! '>='
186
+ - !ruby/object:Gem::Version
187
+ version: '0'
188
+ segments:
189
+ - 0
190
+ hash: -3067973274556583158
191
+ required_rubygems_version: !ruby/object:Gem::Requirement
192
+ none: false
193
+ requirements:
194
+ - - ! '>='
195
+ - !ruby/object:Gem::Version
196
+ version: '0'
197
+ segments:
198
+ - 0
199
+ hash: -3067973274556583158
200
+ requirements: []
201
+ rubyforge_project: gxt-widgets
202
+ rubygems_version: 1.8.25
203
+ signing_key:
204
+ specification_version: 3
205
+ summary: PageObject Widgets to simplify testing GXT applications
206
+ test_files:
207
+ - features/gxt_grid.feature
208
+ - features/gxt_grid_with_grouping.feature
209
+ - features/gxt_pager.feature
210
+ - features/step_definitions/common_steps.rb
211
+ - features/step_definitions/gxt_grid_steps.rb
212
+ - features/step_definitions/gxt_grid_with_grouping_steps.rb
213
+ - features/step_definitions/gxt_pager_steps.rb
214
+ - features/support/env.rb
215
+ - features/support/hooks.rb
216
+ - features/support/pages/basic_grid_example.rb
217
+ - features/support/pages/grouping_grid_example.rb
218
+ - features/support/pages/gxt_examples_page.rb
219
+ - features/support/pages/local_pagination_example.rb
220
+ - features/support/persistent_browser.rb
221
+ - spec/gxt-widgets/gxt_grid_row_spec.rb
222
+ - spec/gxt-widgets/gxt_grid_spec.rb
223
+ has_rdoc: