dojo_widgets 0.1 → 0.2

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: 7764b04444747dd3c08da2c3415c78214ae7475b
4
- data.tar.gz: ed1e5d4c00ef434b5f3481f3522f8cfdd8f9a29c
3
+ metadata.gz: d0caf79397099936b189e177713ba04f781dc4c4
4
+ data.tar.gz: 28239f981472d100181cd257451fb99c0d584731
5
5
  SHA512:
6
- metadata.gz: a446faee102b53caf860c410332a3df309888374c32ccb250184e74be228da6b4ff6dbb55135c94a50f0e1f48b58dc03e3ffc36fc9e9c7fa14216f5d23195acb
7
- data.tar.gz: 24fdcae0431c87d1267756e7dfa9d4e774bb93ae3ce7e13853fcc7c2dca854ced4be4db41da39e3958a91ecd990be821e6d9de8762608fbcf7562d85e1c26857
6
+ metadata.gz: b129641097f1af28883bf76c8176903c7b61b8c08e0007eab3fc51f11ecd4645fbfc98c7be36e99fd8ec941404c189e584852b5b012a39a7ee4c952c5799c74e
7
+ data.tar.gz: 48bc9efd251374cb7e13f2f3a9e21e94538f933f6ce0d0f301a49f106305e0413e2fe31f51a29e625c98cea1f4e6de49eee7eb089dda021115749e82c785d5a8
data/ChangeLog CHANGED
@@ -1,2 +1,6 @@
1
+ === Version 0.2 / 2013-8-7
2
+ * Added selected?, selected, and labels methods to Accordion
3
+ * Added Tabs widget
4
+
1
5
  === Version 0.1 / 2013-7-20
2
6
  * Included basic implementation for the Accordion widget
@@ -0,0 +1,8 @@
1
+
2
+ guard 'cucumber', :notification => true, :all_after_pass => false, :cli => '--profile focus' do
3
+ watch(%r{^features/.+\.feature$})
4
+ watch(%r{^features/support/.+$}) { 'features' }
5
+ watch(%r{^features/step_definitions/(.+)_steps\.rb$}) { |m| Dir[File.join("**/#{m[1]}.feature")][0] || 'features' }
6
+ watch(%r{^lib/.+\.rb$}) { "features" }
7
+ watch(%r{^cucumber.yml$}) { "features" }
8
+ end
data/Rakefile CHANGED
@@ -1 +1,20 @@
1
1
  require "bundler/gem_tasks"
2
+ require 'cucumber'
3
+ require 'cucumber/rake/task'
4
+
5
+ namespace :features do
6
+ Cucumber::Rake::Task.new(:watir_webdriver, "Run features with Watir") do |t|
7
+ t.profile = "watir_webdriver"
8
+ end
9
+
10
+ Cucumber::Rake::Task.new(:selenium_webdriver, "Run features with Selenium") do |t|
11
+ t.profile = "selenium_webdriver"
12
+ end
13
+
14
+ desc 'Run all features'
15
+ task :all => [:watir_webdriver, :selenium_webdriver]
16
+ end
17
+
18
+ task :default => 'features:all'
19
+
20
+
@@ -0,0 +1,9 @@
1
+ <%
2
+ std_opts = "--no-source --color --format pretty" # Cucumber::Formatter::Fuubar"
3
+ %>
4
+
5
+ default: DRIVER=WATIR <%= std_opts %> --tags ~@selenium_only
6
+ watir_webdriver: DRIVER=WATIR <%= std_opts %> --tags ~@selenium_only
7
+ selenium_webdriver: DRIVER=SELENIUM <%= std_opts %> --tags ~@watir_only
8
+ focus: DRIVER=WATIR <%= std_opts %> --tags ~@selenium_only --tags @focus
9
+ #focus: DRIVER=SELENIUM <%= std_opts %> --tags ~@watir_only --tags @focus
@@ -11,7 +11,7 @@ Gem::Specification.new do |gem|
11
11
  gem.email = ["jeff.morgan@leandog.com"]
12
12
  gem.description = %q{Wrapper around dijit controls for use with page-object gem}
13
13
  gem.summary = %q{Wrapper around dijit controls for use with page-object gem}
14
- gem.homepage = ""
14
+ gem.homepage = "https://github.com/cheezy/dojo_widgets"
15
15
 
16
16
  gem.files = `git ls-files`.split($/)
17
17
  gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
@@ -5,3 +5,18 @@ Feature: The Accordion Widget
5
5
  When I select the "Popups and Alerts" Accordion panel
6
6
  Then the Accordion panel for "Popups and Alerts" should be visible
7
7
 
8
+ Scenario: Asking if a panel is selected
9
+ Given I am on the dojo demo page
10
+ When I select the "Color Picker" Accordion panel
11
+ Then I should know that the "Color Picker" panel is selected
12
+
13
+ Scenario: Getting the title of the selected panel
14
+ Given I am on the dojo demo page
15
+ When I select the "Color Picker" Accordion panel
16
+ Then I should know that the text for the selected panel is "Color Picker"
17
+
18
+ Scenario: Getting the titles of all of the panels
19
+ Given I am on the dojo demo page
20
+ Then I should know that "Popups and Alerts" is one of the titles
21
+ And I should know that "Tree" is one of the titles
22
+ And I should know that "Color Picker" is one of the titles
@@ -1,11 +1,44 @@
1
+
1
2
  Given(/^I am on the dojo demo page$/) do
2
3
  visit DojoDemoPage
3
4
  end
4
5
 
5
6
  When(/^I select the "(.*?)" Accordion panel$/) do |label|
6
- on(DojoDemoPage).the_accordion.select_panel label
7
+ on(DojoDemoPage).the_accordion.select label
7
8
  end
8
9
 
9
10
  Then(/^the Accordion panel for "(.*?)" should be visible$/) do |label|
10
11
  on(DojoDemoPage).the_accordion.panel_for(label).should be_visible
11
12
  end
13
+
14
+ Then(/^I should know that the "(.*?)" panel is selected$/) do |label|
15
+ on(DojoDemoPage).the_accordion.selected?(label).should be_true
16
+ end
17
+
18
+ Then(/^I should know that the text for the selected panel is "(.*?)"$/) do |label|
19
+ on(DojoDemoPage).the_accordion.selected.should == label
20
+ end
21
+
22
+ Then(/^I should know that "(.*?)" is one of the titles$/) do |label|
23
+ on(DojoDemoPage).the_accordion.labels.should include label
24
+ end
25
+
26
+ When(/^I select the "(.*?)" tab$/) do |label|
27
+ on(DojoDemoPage).the_tabs.select label
28
+ end
29
+
30
+ Then(/^I should see the word "(.*?)"$/) do |text|
31
+ on(DojoDemoPage).text.should include text
32
+ end
33
+
34
+ Then(/^the selected tab title should be "(.*?)"$/) do |label|
35
+ on(DojoDemoPage).the_tabs.selected.should == label
36
+ end
37
+
38
+ Then(/^the know that the "(.*?)" tab is selected$/) do |label|
39
+ on(DojoDemoPage).the_tabs.selected?(label).should be_true
40
+ end
41
+
42
+ Then(/^I should know that "(.*?)" is one of the tabs$/) do |label|
43
+ on(DojoDemoPage).the_tabs.labels.should include label
44
+ end
@@ -7,10 +7,27 @@ require 'watir-webdriver'
7
7
 
8
8
  World(PageObject::PageFactory)
9
9
 
10
+ module PersistentBrowser
11
+
12
+ @@browser = false
13
+
14
+ def self.get_browser
15
+ unless @@browser
16
+ @@browser = Watir::Browser.new :firefox if ENV['DRIVER'] == 'WATIR'
17
+ @@browser = Selenium::WebDriver.for :firefox if ENV['DRIVER'] == 'SELENIUM'
18
+ end
19
+ @@browser
20
+ end
21
+
22
+ def self.quit
23
+ @@browser.quit
24
+ end
25
+ end
26
+
10
27
  Before do
11
- @browser = Watir::Browser.new :firefox
28
+ @browser = PersistentBrowser.get_browser
12
29
  end
13
30
 
14
- After do
15
- @browser.close
31
+ at_exit do
32
+ PersistentBrowser.quit
16
33
  end
@@ -4,6 +4,7 @@ class DojoDemoPage
4
4
  page_url 'http://demos.dojotoolkit.org/demos/themePreviewer/demo.html'
5
5
 
6
6
  dojo_accordion(:the_accordion, :id => 'leftAccordion')
7
+ dojo_tabs(:the_tab, :id => 'topTabs_tablist')
7
8
 
8
9
  def initialize_page
9
10
  wait_until(10) do
@@ -14,5 +15,9 @@ class DojoDemoPage
14
15
  def the_accordion
15
16
  the_accordion_element
16
17
  end
18
+
19
+ def the_tabs
20
+ the_tab_element
21
+ end
17
22
 
18
23
  end
@@ -0,0 +1,22 @@
1
+ Feature: The Tab Widget
2
+
3
+ Scenario: Selecting a tab
4
+ Given I am on the dojo demo page
5
+ When I select the "Sliders" tab
6
+ Then I should see the word "Enabled"
7
+
8
+ Scenario: Getting the title of the currently selected tab
9
+ Given I am on the dojo demo page
10
+ When I select the "Select Widgets" tab
11
+ Then the selected tab title should be "Select Widgets"
12
+
13
+ Scenario: Knowing if a tab is selected
14
+ Given I am on the dojo demo page
15
+ When I select the "Select Widgets" tab
16
+ Then the know that the "Select Widgets" tab is selected
17
+
18
+ Scenario: Getting all of the tab labels
19
+ Given I am on the dojo demo page
20
+ Then I should know that "Textarea" is one of the tabs
21
+ And I should know that "Sliders" is one of the tabs
22
+ And I should know that "Editor" is one of the tabs
@@ -1,10 +1,12 @@
1
- require "page-object"
2
- require "dojo_widgets/version"
3
- require "dojo_widgets/accordion"
1
+ require 'page-object'
2
+ require 'dojo_widgets/version'
3
+ require 'dojo_widgets/accordion'
4
+ require 'dojo_widgets/tabs'
4
5
 
5
6
  module DojoWidgets
6
7
 
7
8
  PageObject.register_widget(:dojo_accordion, DojoWidgets::Accordion, 'div')
9
+ PageObject.register_widget(:dojo_tabs, DojoWidgets::Tabs, 'div')
8
10
 
9
11
  end
10
12
 
@@ -2,10 +2,25 @@
2
2
  module DojoWidgets
3
3
  class Accordion < PageObject::Elements::Div
4
4
 
5
- def select_panel(label)
5
+ def select(label)
6
6
  span_element(:class => 'dijitAccordionText', :text => label).click
7
7
  end
8
8
 
9
+ def selected?(label)
10
+ selected == label
11
+ end
12
+
13
+ def selected
14
+ container = div_element(:class => 'dijitSelected')
15
+ container.div_element(:class => 'dijitAccordionTitleFocus').text
16
+ end
17
+
18
+ def labels
19
+ span_elements(:class => 'dijitAccordionText').collect do |span|
20
+ span.text
21
+ end
22
+ end
23
+
9
24
  def panel_for(label)
10
25
  panels = div_elements(:class => 'dijitAccordionInnerContainer')
11
26
  the_panel = panels.find do |panel|
@@ -0,0 +1,22 @@
1
+
2
+ module DojoWidgets
3
+ class Tabs < PageObject::Elements::Div
4
+
5
+ def select(label)
6
+ span_element(:class => 'tabLabel', :text => label).click
7
+ end
8
+
9
+ def selected
10
+ div_element(:class => 'dijitTabChecked').text
11
+ end
12
+
13
+ def selected?(label)
14
+ selected == label
15
+ end
16
+
17
+ def labels
18
+ span_elements(:class => 'tabLabel').collect { |span| span.text }
19
+ end
20
+
21
+ end
22
+ end
@@ -1,3 +1,3 @@
1
1
  module DojoWidgets
2
- VERSION = "0.1"
2
+ VERSION = "0.2"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dojo_widgets
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.1'
4
+ version: '0.2'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeffrey S. Morgan
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-07-20 00:00:00.000000000 Z
11
+ date: 2013-08-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: page-object
@@ -62,18 +62,22 @@ files:
62
62
  - .gitignore
63
63
  - ChangeLog
64
64
  - Gemfile
65
+ - Guardfile
65
66
  - LICENSE.txt
66
67
  - README.md
67
68
  - Rakefile
69
+ - cucumber.yml
68
70
  - dojo_widgets.gemspec
69
71
  - features/accordion.feature
70
72
  - features/step_definitions/dojo_demo_steps.rb
71
73
  - features/support/env.rb
72
74
  - features/support/pages/dojo_demo_page.rb
75
+ - features/tab.feature
73
76
  - lib/dojo_widgets.rb
74
77
  - lib/dojo_widgets/accordion.rb
78
+ - lib/dojo_widgets/tabs.rb
75
79
  - lib/dojo_widgets/version.rb
76
- homepage: ''
80
+ homepage: https://github.com/cheezy/dojo_widgets
77
81
  licenses:
78
82
  - MIT
79
83
  metadata: {}
@@ -102,3 +106,4 @@ test_files:
102
106
  - features/step_definitions/dojo_demo_steps.rb
103
107
  - features/support/env.rb
104
108
  - features/support/pages/dojo_demo_page.rb
109
+ - features/tab.feature