selenium_plus 0.0.8 → 0.0.9
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.
- data/features/iframe.feature +21 -0
- data/features/step_definitions/iframe_steps.rb +7 -0
- data/lib/selenium_plus/page_obj/container.rb +6 -0
- data/lib/selenium_plus/page_obj/iframe.rb +14 -0
- data/lib/selenium_plus/page_obj/page.rb +4 -0
- data/lib/selenium_plus/version.rb +1 -1
- data/lib/selenium_plus.rb +2 -1
- data/test_site/html/home.html +1 -0
- data/test_site/html/iframe.html +26 -0
- data/test_site/iframes/test_iframe.rb +17 -0
- data/test_site/pages/home_page.rb +1 -0
- data/test_site/test_site.rb +1 -0
- metadata +19 -12
@@ -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
|
+
|
@@ -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
|
data/lib/selenium_plus.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
$:.unshift(File.dirname(__FILE__))
|
2
2
|
|
3
|
-
if ENV['
|
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'
|
data/test_site/html/home.html
CHANGED
@@ -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
|
data/test_site/test_site.rb
CHANGED
@@ -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.
|
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-
|
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: &
|
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: *
|
24
|
+
version_requirements: *70365951197380
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: selenium-webdriver
|
27
|
-
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: *
|
35
|
+
version_requirements: *70365951196380
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: rspec
|
38
|
-
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: *
|
46
|
+
version_requirements: *70365951195280
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: simplecov
|
49
|
-
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: *
|
57
|
+
version_requirements: *70365951194380
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: cucumber
|
60
|
-
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: *
|
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
|