selenium_plus 0.0.8 → 0.0.9

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,21 @@
1
+ Feature: Verify iframe
2
+
3
+ Background:
4
+ When I login to home page
5
+
6
+ Scenario: Find table inside iframe
7
+ Then Horizontal table inside iframe should be:
8
+ | ID: | Name: | Company: |
9
+ | 1 | Jack | Google |
10
+ | 2 | Maggie | Microsoft |
11
+ And Vertical table text should be:
12
+ | ID: | Name: | Company: |
13
+ | 1 | Alex | Google |
14
+ | 2 | Eric | Microsoft |
15
+ And I search horizontal table inside iframe
16
+ And Section titles should be:
17
+ | Information tables |
18
+ | Table with no header |
19
+ | Table with no body |
20
+
21
+
@@ -0,0 +1,7 @@
1
+ Then /^Horizontal table inside iframe should be:$/ do |h_table|
2
+ @site.home_page.test_iframe.h_table_hashes.should == h_table.hashes
3
+ end
4
+
5
+ Then /^I search horizontal table inside iframe$/ do
6
+ @site.home_page.test_iframe.search_table
7
+ end
@@ -54,6 +54,12 @@ module SeleniumPlus
54
54
  end
55
55
  end
56
56
 
57
+ def iframe(name, iframe_class, *find_args)
58
+ define_method(name) do
59
+ iframe_class.new(find(*find_args))
60
+ end
61
+ end
62
+
57
63
  private
58
64
  # Define an existence check method
59
65
  # This method tries to find element by given locator with no wait time
@@ -0,0 +1,14 @@
1
+ module SeleniumPlus
2
+ class Iframe
3
+ extend Container
4
+ include Finders
5
+
6
+ #attr_reader :iframe_element
7
+
8
+ def initialize(iframe_element)
9
+ SeleniumPlus.driver.native.switch_to.frame(iframe_element[:id])
10
+ #@root_element = iframe_element
11
+ end
12
+
13
+ end
14
+ end
@@ -3,6 +3,10 @@ module SeleniumPlus
3
3
  extend Container
4
4
  include Finders
5
5
 
6
+ def initialize
7
+ SeleniumPlus.driver.native.switch_to.default_content
8
+ end
9
+
6
10
  def goto(url)
7
11
  SeleniumPlus.driver.visit(url)
8
12
  end
@@ -1,3 +1,3 @@
1
1
  module SeleniumPlus
2
- VERSION = '0.0.8'
2
+ VERSION = '0.0.9'
3
3
  end
data/lib/selenium_plus.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  $:.unshift(File.dirname(__FILE__))
2
2
 
3
- if ENV['COVERAGE']
3
+ if ENV['']
4
4
  require 'simplecov'
5
5
 
6
6
  SimpleCov.start do
@@ -18,6 +18,7 @@ require 'selenium_plus/driver'
18
18
  require 'selenium_plus/cucumber'
19
19
  require 'selenium_plus/page_obj/container'
20
20
  require 'selenium_plus/page_obj/page'
21
+ require 'selenium_plus/page_obj/iframe'
21
22
  require 'selenium_plus/page_obj/section'
22
23
  require 'selenium_plus/selenium/table'
23
24
  require 'selenium_plus/selenium/select'
@@ -118,5 +118,6 @@
118
118
  <dt>Milk</dt>
119
119
  <dd>White cold drink</dd>
120
120
  </dl>
121
+ <iframe id="my_iframe" src="iframe.html" height="100" width="400"></iframe>
121
122
  </body>
122
123
  </html>
@@ -0,0 +1,26 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>iframe Page</title>
5
+ </head>
6
+ <body>
7
+ <table id="iframe_h_table" class="horizontal_headers">
8
+ <tr>
9
+ <th>ID:</th>
10
+ <th>Name:</th>
11
+ <th>Company:</th>
12
+ </tr>
13
+ <tr>
14
+ <td>1</td>
15
+ <td>Jack</td>
16
+ <td>Google</td>
17
+ </tr>
18
+ <tr>
19
+ <td>2</td>
20
+ <td>Maggie</td>
21
+ <td>Microsoft</td>
22
+ </tr>
23
+ </table>
24
+ <input type="submit" value="Search" name="search" />
25
+ </body>
26
+ </html>
@@ -0,0 +1,17 @@
1
+ module Test
2
+
3
+ class TestIframe < SeleniumPlus::Iframe
4
+
5
+ element(:h_table, :id, 'iframe_h_table')
6
+ element(:search_btn, :css, 'input[name=search]')
7
+
8
+ def h_table_hashes
9
+ h_table.table_hashes
10
+ end
11
+
12
+ def search_table
13
+ search_btn.click
14
+ end
15
+
16
+ end
17
+ end
@@ -1,6 +1,7 @@
1
1
  module Test
2
2
  class HomePage < SeleniumPlus::Page
3
3
 
4
+ iframe(:test_iframe, TestIframe, :id, 'my_iframe')
4
5
  section(:info_section, InfoSection, :id, 'info')
5
6
 
6
7
  element(:show_btn, :css, 'input[value=Show]')
@@ -1,6 +1,7 @@
1
1
  require 'selenium_plus'
2
2
 
3
3
  Dir.glob("#{File.dirname(__FILE__)}/sections/*.rb").each{ |file| require file }
4
+ Dir.glob("#{File.dirname(__FILE__)}/iframes/*.rb").each{ |file| require file }
4
5
  Dir.glob("#{File.dirname(__FILE__)}/pages/*.rb").each{ |file| require file }
5
6
 
6
7
  class TestSite
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: selenium_plus
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
4
+ version: 0.0.9
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-03-12 00:00:00.000000000 Z
12
+ date: 2013-04-01 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake
16
- requirement: &70111134679200 !ruby/object:Gem::Requirement
16
+ requirement: &70365951197380 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70111134679200
24
+ version_requirements: *70365951197380
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: selenium-webdriver
27
- requirement: &70111134677940 !ruby/object:Gem::Requirement
27
+ requirement: &70365951196380 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: 2.25.0
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *70111134677940
35
+ version_requirements: *70365951196380
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: rspec
38
- requirement: &70111134677000 !ruby/object:Gem::Requirement
38
+ requirement: &70365951195280 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: 2.1.0
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *70111134677000
46
+ version_requirements: *70365951195280
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: simplecov
49
- requirement: &70111134676100 !ruby/object:Gem::Requirement
49
+ requirement: &70365951194380 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: 0.7.1
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *70111134676100
57
+ version_requirements: *70365951194380
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: cucumber
60
- requirement: &70111134675040 !ruby/object:Gem::Requirement
60
+ requirement: &70365951193320 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
@@ -65,7 +65,7 @@ dependencies:
65
65
  version: 1.2.1
66
66
  type: :development
67
67
  prerelease: false
68
- version_requirements: *70111134675040
68
+ version_requirements: *70365951193320
69
69
  description: SeleniumPlus creates a very thin layer between Selenium and your applications,
70
70
  it gives your a simple and quick way to describe your web site using the Page Object
71
71
  Model.
@@ -84,12 +84,14 @@ files:
84
84
  - features/drivers.feature
85
85
  - features/element.feature
86
86
  - features/finders.feature
87
+ - features/iframe.feature
87
88
  - features/select.feature
88
89
  - features/step_definitions/dlist_steps.rb
89
90
  - features/step_definitions/drivers_steps.rb
90
91
  - features/step_definitions/element_steps.rb
91
92
  - features/step_definitions/finder_steps.rb
92
93
  - features/step_definitions/general_steps.rb
94
+ - features/step_definitions/iframe_steps.rb
93
95
  - features/step_definitions/select_steps.rb
94
96
  - features/step_definitions/tables_steps.rb
95
97
  - features/support/env.rb
@@ -101,6 +103,7 @@ files:
101
103
  - lib/selenium_plus/exceptions.rb
102
104
  - lib/selenium_plus/finders.rb
103
105
  - lib/selenium_plus/page_obj/container.rb
106
+ - lib/selenium_plus/page_obj/iframe.rb
104
107
  - lib/selenium_plus/page_obj/page.rb
105
108
  - lib/selenium_plus/page_obj/section.rb
106
109
  - lib/selenium_plus/selenium/dlist.rb
@@ -110,7 +113,9 @@ files:
110
113
  - lib/selenium_plus/version.rb
111
114
  - selenium_plus.gemspec
112
115
  - test_site/html/home.html
116
+ - test_site/html/iframe.html
113
117
  - test_site/html/login.html
118
+ - test_site/iframes/test_iframe.rb
114
119
  - test_site/pages/home_page.rb
115
120
  - test_site/pages/login_page.rb
116
121
  - test_site/sections/info_section.rb
@@ -145,12 +150,14 @@ test_files:
145
150
  - features/drivers.feature
146
151
  - features/element.feature
147
152
  - features/finders.feature
153
+ - features/iframe.feature
148
154
  - features/select.feature
149
155
  - features/step_definitions/dlist_steps.rb
150
156
  - features/step_definitions/drivers_steps.rb
151
157
  - features/step_definitions/element_steps.rb
152
158
  - features/step_definitions/finder_steps.rb
153
159
  - features/step_definitions/general_steps.rb
160
+ - features/step_definitions/iframe_steps.rb
154
161
  - features/step_definitions/select_steps.rb
155
162
  - features/step_definitions/tables_steps.rb
156
163
  - features/support/env.rb