gxt-widgets 0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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,21 @@
1
+ Gemfile.lock
2
+
3
+ .idea/.name
4
+
5
+ .idea/.rakeTasks
6
+
7
+ *.iml
8
+
9
+ .idea/dictionaries/williamjpowell.xml
10
+
11
+ .idea/encodings.xml
12
+
13
+ .idea/misc.xml
14
+
15
+ .idea/modules.xml
16
+
17
+ .idea/scopes/scope_settings.xml
18
+
19
+ .idea/vcs.xml
20
+
21
+ .idea/workspace.xml
@@ -0,0 +1,8 @@
1
+ language: ruby
2
+ rvm:
3
+ - 1.8.7
4
+ - 1.9.2
5
+ - 1.9.3
6
+ before_install:
7
+ - "export DISPLAY=:99.0"
8
+ - "sh -e /etc/init.d/xvfb start"
data/Gemfile ADDED
@@ -0,0 +1,11 @@
1
+ source "http://rubygems.org"
2
+
3
+ # adding rake so travis-ci will build properly
4
+ gem 'rake'
5
+ gem 'fuubar-cucumber'
6
+ gem 'rb-fsevent', :require => false if RUBY_PLATFORM =~ /darwin/i
7
+ gem 'growl'
8
+ gem 'guard-rspec'
9
+ gem 'guard-cucumber'
10
+
11
+ gemspec
@@ -0,0 +1,33 @@
1
+ require 'rubygems'
2
+ require 'bundler/gem_tasks'
3
+ require 'cucumber'
4
+ require 'cucumber/rake/task'
5
+ require 'rspec/core/rake_task'
6
+
7
+ Bundler::GemHelper.install_tasks
8
+
9
+ RSpec::Core::RakeTask.new(:spec) do |spec|
10
+ spec.ruby_opts = "-I lib:spec"
11
+ spec.pattern = 'spec/**/*_spec.rb'
12
+ end
13
+
14
+ task :spec
15
+
16
+ namespace :features do
17
+ Cucumber::Rake::Task.new(:watir_webdriver, "Run features with Watir") do |t|
18
+ t.profile = "default"
19
+ end
20
+
21
+ Cucumber::Rake::Task.new(:selenium_webdriver, "Run features with Selenium") do |t|
22
+ t.profile = "sfirefox"
23
+ end
24
+
25
+ desc 'Run all features'
26
+ task :all => [:watir_webdriver, :selenium_webdriver]
27
+ end
28
+
29
+ desc 'Run all specs and cukes'
30
+ task :test => ['spec', 'features:all']
31
+
32
+ task :default => :test
33
+
@@ -0,0 +1,12 @@
1
+ <%
2
+ std_opts = "--no-source --color --format Cucumber::Formatter::Fuubar --tags ~@ignore"
3
+ %>
4
+
5
+ default: BROWSER=firefox DRIVER=WATIR <%= std_opts %> --tags ~@selenium_only
6
+ sfirefox: BROWSER=firefox DRIVER=SELENIUM <%= std_opts %> --tags ~@watir_only
7
+ wchrome: BROWSER=chrome DRIVER=WATIR <%= std_opts %> --tags ~@selenium_only
8
+ schrome: BROWSER=chrome DRIVER=SELENIUM <%= std_opts %> --tags ~@watir_only
9
+ wie: BROWSER=ie DRIVER=WATIR <%= std_opts %> --tags ~@selenium_only
10
+ sie: BROWSER=ie DRIVER=SELENIUM <%= std_opts %> --tags ~@watir_only
11
+ focus: BROWSER=firefox DRIVER=WATIR <%= std_opts %> --tags @focus ~@selenium_only
12
+
@@ -0,0 +1,87 @@
1
+ Feature: Gxt Grid
2
+ In order to interact with tables
3
+ Testers will need access and interrogation ability
4
+
5
+
6
+ Background:
7
+ Given I am on the Gxt Examples page
8
+ And I have the Basic Grid opened
9
+
10
+ Scenario: Retrieve a table
11
+ When I retrieve a GxtGrid widget
12
+ Then I should know it is visible
13
+
14
+ @watir_only
15
+ Scenario: Determine if a table exists
16
+ When I retrieve a GxtGrid widget
17
+ Then I should know it exists
18
+
19
+ Scenario: Retrieve the data from a table
20
+ When I retrieve a GxtGrid widget
21
+ Then the data for row "1" should be "Hollie Voss" and "General Administration"
22
+ And the table should have "13" rows
23
+ And row "1" should have "5" columns
24
+ And the data for the first row should be "Employee Name" and "Department"
25
+ And the data for the last row should be "Buster misjenou" and "Accounts"
26
+
27
+ Scenario: Retrieve data from a table using a row header
28
+ When I retrieve a GxtGrid widget
29
+ Then the data for row "Gail Horton" should be "Gail Horton" and "Marketing"
30
+
31
+ Scenario: Retrieve data from a table using a partial row header
32
+ When I retrieve a GxtGrid widget
33
+ Then the data for row "Newman" should be "Dirk Newman" and "Information Technology"
34
+
35
+ Scenario: Retrieve data from a table using a row header in the 2nd column
36
+ When I retrieve a GxtGrid widget
37
+ Then the data for row "General Administration" should be "Hollie Voss" and "General Administration"
38
+
39
+ Scenario: Retrieve data from a table using a partial row header in the 2nd column
40
+ When I retrieve a GxtGrid widget
41
+ Then the data for row "Administration" should be "Hollie Voss" and "General Administration"
42
+
43
+ Scenario: Retrieve data from a table using a column header
44
+ When I retrieve a GxtGrid widget
45
+ Then the data for column "Slary" and row "2" should be "120000.00"
46
+
47
+ Scenario: Retrieve data from a table using a partial column header
48
+ When I retrieve a GxtGrid widget
49
+ Then the data for column "esignation" and row "2" should be "CTO"
50
+
51
+ Scenario: Retrieve data from a table using both headers
52
+ When I retrieve a GxtGrid widget
53
+ Then the data for row "Emerson Milton" and column "Department" should be "Information Technology"
54
+
55
+ Scenario: Retrieve data from a table with an incorrect row header
56
+ When I retrieve a GxtGrid widget
57
+ Then the data for row "Data20" should be nil
58
+
59
+ Scenario: Retrieve data from a table with an incorrect column header
60
+ When I retrieve a GxtGrid widget
61
+ Then the data for row "Chad Andrews" and column "Data20" should be nil
62
+
63
+ Scenario: Sort Ascending by Employee Name
64
+ When I retrieve a GxtGrid widget
65
+ And I open the "Employee Name" column menu
66
+ And I sort ascending
67
+ Then the data for the second row should be "Bell Snedden" and "Information Technology"
68
+
69
+ Scenario: Sort Descending by Employee Name
70
+ When I retrieve a GxtGrid widget
71
+ And I open the "Employee Name" column menu
72
+ And I sort descending
73
+ Then the data for the second row should be "Hollie Voss" and "General Administration"
74
+
75
+ Scenario: Deselect a column from the Column Menu
76
+ When I retrieve a GxtGrid widget
77
+ And I open the "Department" column menu
78
+ And I deselect the "Department" column
79
+ Then The "Department" column should not appear in the table
80
+
81
+ Scenario: Deselect then select a column from the Column Menu
82
+ Given I retrieve a GxtGrid widget
83
+ And I open the "Department" column menu
84
+ And I deselect the "Department" column
85
+ And The "Department" column should not appear in the table
86
+ When I select the "Department" column
87
+ Then The "Department" column should appear in the table
@@ -0,0 +1,48 @@
1
+ @ignore
2
+ Feature: Gxt Grid With Grouping
3
+ As a Gxt Developer
4
+ I want to control a Gxt Grid with grouping using a Widget
5
+ So that I can interact with the grid and groups as a single control
6
+
7
+ Background:
8
+ Given I am on the Gxt Examples page
9
+ And I open the Grouping Grid Example
10
+ And I retrieve a GxtGroupingGrid widget
11
+
12
+ Scenario: I should know the group headings and count
13
+ Then The grid should contain 4 groups
14
+ And The group headings should contain
15
+ |Accounts|General Administration|Information Technology|Marketing|
16
+
17
+ Scenario: I should be able to collapse a group
18
+ When The "Information Technology" Group is expanded
19
+ And I collapse the "Information Technology" group
20
+ Then The rows should not be visible
21
+
22
+ Scenario: I should be able to expand a group
23
+ When The "Information Technology" Group is collapsed
24
+ And I expand the "Information Technology" group
25
+ Then the rows should be visible
26
+
27
+ Scenario: I should be able to sort (ascending) groups by the grouping column
28
+ When The data is grouped by "Department"
29
+ And I sort the "Department" column Ascending
30
+ Then the group headings should contain in order
31
+ |Accounts|General Administration|Information Technology|Marketing|
32
+
33
+ Scenario: I should be able to sort (descending) groups by the grouping column
34
+ When The data is grouped by "Department"
35
+ And I sort the "Department" column Descending
36
+ Then the group headings should contain in order
37
+ |Marketing|Information Technology|General Administration|Accounts|
38
+
39
+ Scenario: I should be able to use the column menu to change the grouping field
40
+ When I click on the "Designation" column drop down menu
41
+ And I select "Group By This Field"
42
+ Then The grid should contain 7 groups
43
+ And The group headings should contain
44
+ |CTO|Executive|Executive Director|General Manager|Project Manager|S/W Engineer|Senior S/W Engineer|
45
+
46
+
47
+
48
+
@@ -0,0 +1,37 @@
1
+ Feature: Use Widgets to controls the gxt Local Pagination example
2
+ As a gxt developer
3
+ I want test widgets for Local pagination
4
+ So that I can easily control control common components
5
+ on my application.
6
+
7
+ Background:
8
+ Given I am on the Gxt Examples page
9
+ And I have Local Pagination open
10
+
11
+ Scenario: Click next page
12
+ When I click next page
13
+ Then I should be on page "2"
14
+ And "Chad Andrews" should be listed in the grid
15
+
16
+ Scenario: Click last page
17
+ When I click last page
18
+ Then I should be on page "3"
19
+ And "Claudio Engle" should be listed in the grid
20
+
21
+ Scenario: Click fist page
22
+ When I click last page
23
+ And I click on previous page
24
+ Then I should be on page "2"
25
+ And "Chad Andrews" should be listed in the grid
26
+
27
+ Scenario: Click previous page
28
+ When I click last page
29
+ And I click on first page
30
+ Then I should be on page "1"
31
+ And "Hollie Voss" should be listed in the grid
32
+
33
+ Scenario: Type page 3 into the box
34
+ When type "3" into the page box
35
+ Then I should be on page "3"
36
+ And "Claudio Engle" should be listed in the grid
37
+
@@ -0,0 +1,11 @@
1
+ Given /^I am on the Gxt Examples page$/ do
2
+ @page = visit_page GxtExamplesPage
3
+ end
4
+
5
+ Then /^I should know it is visible$/ do
6
+ @element.should be_visible
7
+ end
8
+
9
+ Then /^I should know it exists$/ do
10
+ @element.should exist
11
+ end
@@ -0,0 +1,131 @@
1
+ When /^I have the Basic Grid opened$/ do
2
+ @page.basic_grid_element.click
3
+ @page = BasicGridExample.new(@browser)
4
+ end
5
+
6
+ When /^I retrieve a GxtGrid widget$/ do
7
+ @element = @page.grid_element
8
+ end
9
+
10
+
11
+ When /^the GxtGrid should have "(\d+)" rows$/ do |rows|
12
+ @element.rows.should == rows.to_i
13
+ end
14
+
15
+ Then /^the data for row "([^\"]*)" should be "([^\"]*)" and "([^\"]*)"$/ do |row, col1, col2|
16
+ row = (row.to_i) if row.to_i > 0
17
+ table_row = @element[row]
18
+ table_row[0].text.should == col1
19
+ table_row[1].text.should == col2
20
+ end
21
+
22
+
23
+ When /^I retrieve the data from the table cell$/ do
24
+ @cell_data = @page.cell_id
25
+ end
26
+
27
+ Then /^the cell data should be '([^"]*)'$/ do |expected|
28
+ @cell_data.should == expected
29
+ end
30
+
31
+ When /^I retrieve a GxtGrid widget by "([^\"]*)"$/ do |how|
32
+ @element = @page.send "table_#{how}_element"
33
+ end
34
+
35
+ When /^I retrieve a GxtGrid widget by "([^\"]*)" and "([^\"]*)"$/ do |param1, param2|
36
+ @element = @page.send "table_#{param1}_#{param2}_element"
37
+ end
38
+
39
+ When /^I retrieve a GxtGrid widget while the script is executing$/ do
40
+ @element = @page.table_element(:id => 'table_id')
41
+ end
42
+
43
+ Then /^the data for the first row should be "([^\"]*)" and "([^\"]*)"$/ do |col1, col2|
44
+ @element.first_row[0].text.should == col1
45
+ @element.first_row[1].text.should == col2
46
+ end
47
+
48
+ Then /^the data for the last row should be "([^\"]*)" and "([^\"]*)"$/ do |col1, col2|
49
+ @element.last_row[0].text.should == col1
50
+ @element.last_row[1].text.should == col2
51
+ end
52
+
53
+ Then /^I should see that the table exists$/ do
54
+ @page.table_id?.should == true
55
+ end
56
+
57
+ Then /^the data for column "([^\"]*)" and row "([^\"]*)" should be "([^\"]*)"$/ do |column, row, value|
58
+ @element[row.to_i][column].text.should == value
59
+ end
60
+
61
+ Then /^the data for row "([^\"]*)" and column "([^\"]*)" should be "([^\"]*)"$/ do |row, column, value|
62
+ @element[row][column].text.should == value
63
+ end
64
+
65
+ Then /^the data for row "([^\"]*)" should be nil$/ do |row|
66
+ @element[row].should be_nil
67
+ end
68
+
69
+ Then /^the data for row "([^\"]*)" and column "([^\"]*)" should be nil$/ do |row, column|
70
+ @element[row][column].should be_nil
71
+ end
72
+
73
+ Then /^I should see the text includes "([^"]*)" when I retrieve it by "([^"]*)"$/ do |text, how|
74
+ @page.send("table_#{how}").should include text
75
+ end
76
+
77
+ Then /^the table should have "([^\"]*)" rows$/ do |rows|
78
+ @element.rows.should == rows.to_i
79
+ end
80
+
81
+ Then /^each row should contain "([^\"]*)"$/ do |text|
82
+ @element.each do |row|
83
+ row.text.should include text
84
+ end
85
+ end
86
+
87
+ Then /^row "([^\"]*)" should have "([^\"]*)" columns$/ do |row, cols|
88
+ @element[row.to_i - 1].columns.should == cols.to_i
89
+ end
90
+
91
+ Then /^each column should contain "([^\"]*)"$/ do |text|
92
+ row = @element[0]
93
+ row.each do |column|
94
+ column.text.should include text
95
+ end
96
+ end
97
+ When /^the data for the second row should be "([^"]*)" and "([^"]*)"$/ do |col1, col2|
98
+ @element[1][0].text.should == col1
99
+ @element[1][1].text.should == col2
100
+ end
101
+
102
+ When /^I sort ascending$/ do
103
+ @page.column_menu_element.sort_ascending
104
+ end
105
+
106
+ When /^I sort descending$/ do
107
+ @page.column_menu_element.sort_descending
108
+ end
109
+
110
+ When /^I deselect the "([^"]*)" column$/ do |column_name|
111
+ @page.column_menu_element.open_column_selection_menu
112
+ @page.column_selection_menu_element.exclude_column(column_name)
113
+ end
114
+
115
+ Then /^The "([^"]*)" column should not appear in the table$/ do |column_name|
116
+ @element.header.each do |column_header|
117
+ column_header.text.should_not include column_name
118
+ end
119
+ end
120
+
121
+ When /^I select the "([^"]*)" column$/ do |column_name|
122
+ @page.column_menu_element.open_column_selection_menu
123
+ @page.column_selection_menu_element.include_column(column_name)
124
+ end
125
+ Then /^The "([^"]*)" column should appear in the table$/ do |column_name|
126
+ @element.header[column_name].exists?.should ==true
127
+ end
128
+
129
+ When /^I open the "([^"]*)" column menu$/ do |column|
130
+ @element.header[column].open_menu
131
+ end
@@ -0,0 +1,8 @@
1
+ When /^I open the Grouping Grid Example$/ do
2
+ @page.grouping_grid_element.click
3
+ @page = GroupingGridExample.new(@browser)
4
+ end
5
+
6
+ When /^I retrieve a GxtGroupingGrid widget$/ do
7
+ @element = @page.grouping_grid_element
8
+ end
@@ -0,0 +1,32 @@
1
+ When /^I have Local Pagination open$/ do
2
+ @page.local_pagination_element.click
3
+ @page = LocalPaginationExample.new(@browser)
4
+ end
5
+
6
+ When /^I click next page$/ do
7
+ @page.pager_element.next
8
+ end
9
+
10
+ Then /^I should be on page "(\d+)"$/ do |page_expected|
11
+ @page.pager_element.page.should == page_expected
12
+ end
13
+
14
+ When /^"([^"]*)" should be listed in the grid$/ do |name_expected|
15
+ @page.grid_element[1][0].text.should == name_expected
16
+ end
17
+
18
+ When /^I click last page$/ do
19
+ @page.pager_element.last
20
+ end
21
+
22
+ When /^I click on previous page$/ do
23
+ @page.pager_element.previous
24
+ end
25
+
26
+ When /^I click on first page$/ do
27
+ @page.pager_element.first
28
+ end
29
+
30
+ When /^type "(\d+)" into the page box$/ do |page|
31
+ @page.pager_element.page=page
32
+ end