symbiont 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/HISTORY.md +6 -0
- data/cucumber.yml +4 -0
- data/lib/symbiont/version.rb +1 -1
- data/specs/button.feature +41 -0
- data/specs/definitions/pages.rb +58 -0
- data/specs/frame.feature +5 -0
- data/specs/link.feature +32 -0
- data/specs/simple_test.feature +13 -0
- data/specs/support/env.rb +18 -0
- data/specs/support/hooks.rb +11 -0
- data/specs/support/test_steps/action_steps.rb +207 -0
- data/specs/support/test_steps/simple_test_steps.rb +8 -0
- data/specs/text_field.feature +37 -0
- metadata +19 -9
- data/test/symbiont_test.rb +0 -158
data/HISTORY.md
CHANGED
@@ -1,6 +1,12 @@
|
|
1
1
|
Change Log and History
|
2
2
|
======================
|
3
3
|
|
4
|
+
Version 0.0.4 / 2012-04-14
|
5
|
+
--------------------------
|
6
|
+
|
7
|
+
A very minor update to make sure all tests are in place and working correctly. This release is in preparation to getting the minor release schedule going.
|
8
|
+
|
9
|
+
|
4
10
|
Version 0.0.3 / 2012-04-11
|
5
11
|
--------------------------
|
6
12
|
|
data/cucumber.yml
ADDED
data/lib/symbiont/version.rb
CHANGED
@@ -0,0 +1,41 @@
|
|
1
|
+
Feature: Ability to Support Button Web Objects
|
2
|
+
|
3
|
+
Scenario: Reference a button
|
4
|
+
When on the test page
|
5
|
+
Then the click me button should exist
|
6
|
+
And the click me button should be visible
|
7
|
+
And the click me button should be enabled
|
8
|
+
And the click me button object should be usable
|
9
|
+
|
10
|
+
Scenario: Get text from a button
|
11
|
+
When on the test page
|
12
|
+
Then the text of the click me button should be "Click Me"
|
13
|
+
|
14
|
+
Scenario: Click a button
|
15
|
+
When the click me button on the test page is clicked
|
16
|
+
Then the success page appears
|
17
|
+
|
18
|
+
Scenario: A non-existent button
|
19
|
+
When on the test page
|
20
|
+
Then the fake button should not exist
|
21
|
+
But the fake button object should be usable
|
22
|
+
|
23
|
+
Scenario: A disabled button
|
24
|
+
When on the test page
|
25
|
+
Then the disabled button should exist
|
26
|
+
And the disabled button should be visible
|
27
|
+
And the disabled button should not be enabled
|
28
|
+
And the text of the disabled button should be "Can't Click Me"
|
29
|
+
But the disabled button object should be usable
|
30
|
+
|
31
|
+
Scenario Outline: Finding buttons with locators
|
32
|
+
When the click me button on the test page is clicked by "<locator>"
|
33
|
+
Then the success page appears
|
34
|
+
|
35
|
+
Scenarios:
|
36
|
+
| locator |
|
37
|
+
| id |
|
38
|
+
| name |
|
39
|
+
| class |
|
40
|
+
| xpath |
|
41
|
+
| index |
|
@@ -0,0 +1,58 @@
|
|
1
|
+
class LoggingIn
|
2
|
+
include Symbiont
|
3
|
+
begin_at "http://localhost:4567"
|
4
|
+
|
5
|
+
within_frame(id: "loginSection") do |frame|
|
6
|
+
text_field :clientCode, id: "clientCode", frame: frame
|
7
|
+
text_field :loginName, id: "loginName", frame: frame
|
8
|
+
text_field :loginPassword, id: "password", frame: frame
|
9
|
+
button :login, id: "btnSubmit", frame: frame
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
class LandingPage
|
14
|
+
include Symbiont
|
15
|
+
|
16
|
+
url_is "http://localhost:4567"
|
17
|
+
title_is "Login | Test App"
|
18
|
+
look_for :static_test_page
|
19
|
+
|
20
|
+
link :static_test_page, id: "testPage"
|
21
|
+
link :test_app, id: "home_link"
|
22
|
+
link :fake_link, id: "fakeLink"
|
23
|
+
end
|
24
|
+
|
25
|
+
class TestPage
|
26
|
+
include Symbiont
|
27
|
+
|
28
|
+
url_is "http://localhost:4567/test_page"
|
29
|
+
title_is "Test Page | Test App"
|
30
|
+
|
31
|
+
link :avengersID, id: "avengers_assemble_id"
|
32
|
+
link :avengersName, name: "avengers_assemble_name"
|
33
|
+
link :avengersClass, class: "avengers_assemble_class"
|
34
|
+
link :avengersXPath, xpath: "id('avengers_assemble_id')"
|
35
|
+
link :avengersIndex, {id: "avengers_assemble_id", index: 0}
|
36
|
+
|
37
|
+
button :clickme, id: "clickme_id"
|
38
|
+
|
39
|
+
button :clickmeID, id: "clickme_id"
|
40
|
+
button :clickmeName, name: "clickme_name"
|
41
|
+
button :clickmeClass, class: "clickme_class"
|
42
|
+
button :clickmeXPath, xpath: "//input[@id='clickme_id']"
|
43
|
+
button :clickmeIndex, {id: "clickme_id", index: 0}
|
44
|
+
|
45
|
+
button :fake_button, id: "fakeButton"
|
46
|
+
button :disabled_button, id: "cantclickme_id"
|
47
|
+
|
48
|
+
text_field :book_title, id: "title"
|
49
|
+
|
50
|
+
text_field :bookTitleID, id: "title"
|
51
|
+
text_field :bookTitleName, name: "bookName"
|
52
|
+
text_field :bookTitleClass, class: "bookClass"
|
53
|
+
text_field :bookTitleXPath, xpath: "//input[@id='title']"
|
54
|
+
text_field :bookTitleIndex, {id: "title", index: 0}
|
55
|
+
|
56
|
+
text_field :fake_text_field, id: "fakeTextField"
|
57
|
+
text_field :disabled_text_field, id: "pub_id"
|
58
|
+
end
|
data/specs/frame.feature
ADDED
data/specs/link.feature
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
Feature: Ability to Support Link Web Objects
|
2
|
+
|
3
|
+
Scenario: Reference a link
|
4
|
+
When on the landing page
|
5
|
+
Then the test page link should exist
|
6
|
+
And the test page link should be visible
|
7
|
+
And the test page link object should be usable
|
8
|
+
|
9
|
+
Scenario: Get text from a link
|
10
|
+
When on the landing page
|
11
|
+
Then the text of the home page link should be "Test App"
|
12
|
+
|
13
|
+
Scenario: Click a link
|
14
|
+
When the test page link on the landing page is clicked
|
15
|
+
Then the static test page appears
|
16
|
+
|
17
|
+
Scenario: A non-existent link
|
18
|
+
When on the landing page
|
19
|
+
Then the fake link should not exist
|
20
|
+
But the fake page link object should be usable
|
21
|
+
|
22
|
+
Scenario Outline: Finding links with locators
|
23
|
+
When the avengers link on the test page is clicked by "<locator>"
|
24
|
+
Then the success page appears
|
25
|
+
|
26
|
+
Scenarios:
|
27
|
+
| locator |
|
28
|
+
| id |
|
29
|
+
| name |
|
30
|
+
| class |
|
31
|
+
| xpath |
|
32
|
+
| index |
|
@@ -0,0 +1,13 @@
|
|
1
|
+
Feature: Simple Test of Symbiont and Cucumber
|
2
|
+
|
3
|
+
Scenario: Browser is started for first scenario.
|
4
|
+
When the first scenario is executed
|
5
|
+
Then a browser should be available
|
6
|
+
|
7
|
+
Scenario: Browser is started for second scenario.
|
8
|
+
When the second scenario is executed
|
9
|
+
Then a browser should be available
|
10
|
+
|
11
|
+
Scenario: Browser is started for third scenario.
|
12
|
+
When the third scenario is executed
|
13
|
+
Then a browser should be available
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'symbiont'
|
2
|
+
|
3
|
+
module Symbiont
|
4
|
+
module Browser
|
5
|
+
|
6
|
+
def self.start
|
7
|
+
unless @browser
|
8
|
+
@browser = Watir::Browser.new(ENV['BROWSER'])
|
9
|
+
end
|
10
|
+
@browser
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.stop
|
14
|
+
@browser.quit if @browser
|
15
|
+
end
|
16
|
+
|
17
|
+
end # module: Browser
|
18
|
+
end # module: Symbiont
|
@@ -0,0 +1,207 @@
|
|
1
|
+
When (/^on the landing page$/) do
|
2
|
+
@page = LandingPage.new(@browser, true)
|
3
|
+
end
|
4
|
+
|
5
|
+
When (/^on the test page$/) do
|
6
|
+
@page = TestPage.new(@browser, true)
|
7
|
+
end
|
8
|
+
|
9
|
+
When (/^the test page link on the landing page is clicked$/) do
|
10
|
+
step %{on the landing page}
|
11
|
+
@page.static_test_page
|
12
|
+
end
|
13
|
+
|
14
|
+
When (/^the avengers link on the test page is clicked by "([^"]*)"$/) do |locator|
|
15
|
+
@page = TestPage.new(@browser, true)
|
16
|
+
@page.avengersID if locator == "id"
|
17
|
+
@page.avengersName if locator == "name"
|
18
|
+
@page.avengersClass if locator == "class"
|
19
|
+
@page.avengersXPath if locator == "xpath"
|
20
|
+
@page.avengersIndex if locator == "index"
|
21
|
+
end
|
22
|
+
|
23
|
+
When (/^the book title on the test page is set to "([^"]*)"$/) do |text|
|
24
|
+
step %{on the test page}
|
25
|
+
@page.book_title = "Revelation Space"
|
26
|
+
end
|
27
|
+
|
28
|
+
When (/^the book title on the test page is set by "([^"]*)"$/) do |locator|
|
29
|
+
title = "Revelation Space"
|
30
|
+
@page = TestPage.new(@browser, true)
|
31
|
+
@page.bookTitleID = title if locator == "id"
|
32
|
+
@page.bookTitleName = title if locator == "name"
|
33
|
+
@page.bookTitleClass = title if locator == "class"
|
34
|
+
@page.bookTitleXPath = title if locator == "xpath"
|
35
|
+
@page.bookTitleIndex = title if locator == "index"
|
36
|
+
end
|
37
|
+
|
38
|
+
When (/^the login form on the login page is filled in with standard data$/) do
|
39
|
+
@activity = LoggingIn.new(@browser)
|
40
|
+
@activity.start
|
41
|
+
@activity.clientCode = "Testing"
|
42
|
+
@activity.loginName = "jnyman"
|
43
|
+
@activity.loginPassword = "P@ssw0rd!"
|
44
|
+
@activity.login
|
45
|
+
end
|
46
|
+
|
47
|
+
Then (/^the test page link should exist$/) do
|
48
|
+
@page.static_test_page_exists?.should == true
|
49
|
+
@page.static_test_page?.should == true
|
50
|
+
end
|
51
|
+
|
52
|
+
Then (/^the fake link should not exist$/) do
|
53
|
+
@page.fake_link_exists?.should == false
|
54
|
+
end
|
55
|
+
|
56
|
+
Then (/^the test page link should be visible$/) do
|
57
|
+
@page.static_test_page_visible?.should == true
|
58
|
+
@page.static_test_page_?.should == true
|
59
|
+
end
|
60
|
+
|
61
|
+
Then (/^the text of the home page link should be "([^"]*)"$/) do |text|
|
62
|
+
@page.test_app_text.should == text
|
63
|
+
end
|
64
|
+
|
65
|
+
Then (/^the test page link object should be usable$/) do
|
66
|
+
@object = @page.static_test_page_link
|
67
|
+
@object.should be_instance_of Symbiont::WebObjects::Link
|
68
|
+
end
|
69
|
+
|
70
|
+
Then (/^the fake page link object should be usable$/) do
|
71
|
+
@object = @page.fake_link_object
|
72
|
+
@object.should be_instance_of Symbiont::WebObjects::Link
|
73
|
+
end
|
74
|
+
|
75
|
+
Then (/^the click me button should exist$/) do
|
76
|
+
@page.clickme_exists?.should == true
|
77
|
+
@page.clickme?.should == true
|
78
|
+
end
|
79
|
+
|
80
|
+
Then (/^the click me button should be visible$/) do
|
81
|
+
@page.clickme_visible?.should == true
|
82
|
+
@page.clickme_?.should == true
|
83
|
+
end
|
84
|
+
|
85
|
+
Then (/^the click me button should be enabled$/) do
|
86
|
+
@page.clickme_enabled?.should == true
|
87
|
+
@page.clickme!.should == true
|
88
|
+
end
|
89
|
+
|
90
|
+
Then (/^the click me button object should be usable$/) do
|
91
|
+
@object = @page.clickme_button
|
92
|
+
@object.should be_instance_of Symbiont::WebObjects::Button
|
93
|
+
end
|
94
|
+
|
95
|
+
Then (/^the text of the click me button should be "([^"]*)"$/) do |text|
|
96
|
+
@page.clickme_text.should == text
|
97
|
+
end
|
98
|
+
|
99
|
+
When (/^the click me button on the test page is clicked$/) do
|
100
|
+
step %{on the test page}
|
101
|
+
@page.clickme
|
102
|
+
end
|
103
|
+
|
104
|
+
When (/^the click me button on the test page is clicked by "([^"]*)"$/) do |locator|
|
105
|
+
@page = TestPage.new(@browser, true)
|
106
|
+
@page.clickmeID if locator == "id"
|
107
|
+
@page.clickmeName if locator == "name"
|
108
|
+
@page.clickmeClass if locator == "class"
|
109
|
+
@page.clickmeXPath if locator == "xpath"
|
110
|
+
@page.clickmeIndex if locator == "index"
|
111
|
+
end
|
112
|
+
|
113
|
+
Then (/^the fake button should not exist$/) do
|
114
|
+
@page.fake_button_exists?.should == false
|
115
|
+
end
|
116
|
+
|
117
|
+
Then (/^the fake button object should be usable$/) do
|
118
|
+
@object = @page.fake_button_object
|
119
|
+
@object.should be_instance_of Symbiont::WebObjects::Button
|
120
|
+
end
|
121
|
+
|
122
|
+
Then (/^the disabled button should exist$/) do
|
123
|
+
@page.disabled_button_exists?.should == true
|
124
|
+
end
|
125
|
+
|
126
|
+
Then (/^the disabled button should be visible$/) do
|
127
|
+
@page.disabled_button_visible?.should == true
|
128
|
+
end
|
129
|
+
|
130
|
+
Then (/^the disabled button should not be enabled$/) do
|
131
|
+
@page.disabled_button_enabled?.should == false
|
132
|
+
end
|
133
|
+
|
134
|
+
Then (/^the disabled button object should be usable$/) do
|
135
|
+
@object = @page.disabled_button_object
|
136
|
+
@object.should be_instance_of Symbiont::WebObjects::Button
|
137
|
+
end
|
138
|
+
|
139
|
+
Then (/^the text of the disabled button should be "([^"]*)"$/) do |text|
|
140
|
+
@page.disabled_button_text.should == text
|
141
|
+
end
|
142
|
+
|
143
|
+
Then (/^the book title text field should exist$/) do
|
144
|
+
@page.book_title_exists?.should == true
|
145
|
+
@page.book_title?.should == true
|
146
|
+
end
|
147
|
+
|
148
|
+
Then (/^the book title text field should be visible$/) do
|
149
|
+
@page.book_title_visible?.should == true
|
150
|
+
@page.book_title_?.should == true
|
151
|
+
end
|
152
|
+
|
153
|
+
Then (/^the book title text field should be enabled$/) do
|
154
|
+
@page.book_title_enabled?.should == true
|
155
|
+
@page.book_title!.should == true
|
156
|
+
end
|
157
|
+
|
158
|
+
Then (/^the book title text field object should be usable$/) do
|
159
|
+
@object = @page.book_title_object
|
160
|
+
@object.should be_instance_of Symbiont::WebObjects::TextField
|
161
|
+
end
|
162
|
+
|
163
|
+
Then (/^the book title should be "([^"]*)"$/) do |text|
|
164
|
+
@page.book_title.should == text
|
165
|
+
end
|
166
|
+
|
167
|
+
Then (/^the fake text field should not exist$/) do
|
168
|
+
@page.fake_text_field_exists?.should == false
|
169
|
+
end
|
170
|
+
|
171
|
+
Then (/^the fake text field object should be usable$/) do
|
172
|
+
@object = @page.fake_text_field_object
|
173
|
+
@object.should be_instance_of Symbiont::WebObjects::TextField
|
174
|
+
end
|
175
|
+
|
176
|
+
Then (/^the disabled text field should exist$/) do
|
177
|
+
@page.disabled_text_field_exists?.should == true
|
178
|
+
end
|
179
|
+
|
180
|
+
Then (/^the disabled text field should be visible$/) do
|
181
|
+
@page.disabled_text_field_visible?.should == true
|
182
|
+
end
|
183
|
+
|
184
|
+
Then (/^the disabled text field should not be enabled$/) do
|
185
|
+
@page.disabled_text_field_enabled?.should == false
|
186
|
+
end
|
187
|
+
|
188
|
+
Then (/^the text of the disabled text field should be "([^"]*)"$/) do |text|
|
189
|
+
@page.disabled_text_field.should == text
|
190
|
+
end
|
191
|
+
|
192
|
+
Then (/^the disabled text field object should be usable$/) do
|
193
|
+
@object = @page.disabled_text_field_object
|
194
|
+
@object.should be_instance_of Symbiont::WebObjects::TextField
|
195
|
+
end
|
196
|
+
|
197
|
+
Then (/^the success page appears$/) do
|
198
|
+
@browser.title.should == "Success Page: 1 | Test App"
|
199
|
+
end
|
200
|
+
|
201
|
+
Then (/^the static test page appears$/) do
|
202
|
+
@browser.title.should == "Test Page | Test App"
|
203
|
+
end
|
204
|
+
|
205
|
+
Then (/^the entities page appears$/) do
|
206
|
+
@browser.title.should == "Landing Page | Test App"
|
207
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
Feature: Ability to Support Text Field Web Objects
|
2
|
+
|
3
|
+
Scenario: Reference a text field
|
4
|
+
When on the test page
|
5
|
+
Then the book title text field should exist
|
6
|
+
And the book title text field should be visible
|
7
|
+
And the book title text field should be enabled
|
8
|
+
And the book title text field object should be usable
|
9
|
+
|
10
|
+
Scenario: Set text in a text field and get text from it
|
11
|
+
When the book title on the test page is set to "Revelation Space"
|
12
|
+
Then the book title should be "Revelation Space"
|
13
|
+
|
14
|
+
Scenario: A non-existent text field
|
15
|
+
When on the test page
|
16
|
+
Then the fake text field should not exist
|
17
|
+
But the fake text field object should be usable
|
18
|
+
|
19
|
+
Scenario: A disabled text field
|
20
|
+
When on the test page
|
21
|
+
Then the disabled text field should exist
|
22
|
+
And the disabled text field should be visible
|
23
|
+
And the disabled text field should not be enabled
|
24
|
+
And the text of the disabled text field should be "ESC:001678:FNC"
|
25
|
+
But the disabled text field object should be usable
|
26
|
+
|
27
|
+
Scenario Outline: Finding text fields with locators
|
28
|
+
When the book title on the test page is set by "<locator>"
|
29
|
+
Then the book title should be "Revelation Space"
|
30
|
+
|
31
|
+
Scenarios:
|
32
|
+
| locator |
|
33
|
+
| id |
|
34
|
+
| name |
|
35
|
+
| class |
|
36
|
+
| xpath |
|
37
|
+
| index |
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: symbiont
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
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: 2012-04-
|
12
|
+
date: 2012-04-14 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|
16
|
-
requirement: &
|
16
|
+
requirement: &25920216 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: 2.9.0
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *25920216
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: simplecov
|
27
|
-
requirement: &
|
27
|
+
requirement: &25919832 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: 0.6.1
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *25919832
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: watir-webdriver
|
38
|
-
requirement: &
|
38
|
+
requirement: &25919460 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - =
|
@@ -43,7 +43,7 @@ dependencies:
|
|
43
43
|
version: 0.5.3
|
44
44
|
type: :runtime
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *25919460
|
47
47
|
description: An endosymbiotic facultative library for web application testing.
|
48
48
|
email:
|
49
49
|
- jeffnyman@gmail.com
|
@@ -57,6 +57,7 @@ files:
|
|
57
57
|
- LICENSE
|
58
58
|
- README.md
|
59
59
|
- Rakefile
|
60
|
+
- cucumber.yml
|
60
61
|
- lib/symbiont.rb
|
61
62
|
- lib/symbiont/enclosers.rb
|
62
63
|
- lib/symbiont/factory.rb
|
@@ -80,8 +81,17 @@ files:
|
|
80
81
|
- spec/symbiont/platform_object_spec.rb
|
81
82
|
- spec/symbiont/symbiont_spec.rb
|
82
83
|
- spec/symbiont/web_object_spec.rb
|
84
|
+
- specs/button.feature
|
85
|
+
- specs/definitions/pages.rb
|
86
|
+
- specs/frame.feature
|
87
|
+
- specs/link.feature
|
88
|
+
- specs/simple_test.feature
|
89
|
+
- specs/support/env.rb
|
90
|
+
- specs/support/hooks.rb
|
91
|
+
- specs/support/test_steps/action_steps.rb
|
92
|
+
- specs/support/test_steps/simple_test_steps.rb
|
93
|
+
- specs/text_field.feature
|
83
94
|
- symbiont.gemspec
|
84
|
-
- test/symbiont_test.rb
|
85
95
|
homepage: https://github.com/jnyman/symbiont
|
86
96
|
licenses:
|
87
97
|
- MIT
|
data/test/symbiont_test.rb
DELETED
@@ -1,158 +0,0 @@
|
|
1
|
-
$LOAD_PATH.unshift(File.expand_path('../lib', File.dirname(__FILE__)))
|
2
|
-
|
3
|
-
require 'symbiont'
|
4
|
-
require 'symbiont/factory'
|
5
|
-
|
6
|
-
class LoginPage
|
7
|
-
include Symbiont
|
8
|
-
|
9
|
-
url_is "http://localhost:4567"
|
10
|
-
title_is "Login | Test App"
|
11
|
-
look_for(:testPage)
|
12
|
-
|
13
|
-
link :testPage, id: "testPage"
|
14
|
-
end
|
15
|
-
|
16
|
-
class LoggingIn
|
17
|
-
include Symbiont
|
18
|
-
begin_at "http://localhost:4567"
|
19
|
-
|
20
|
-
within_frame(id: "loginSection") do |frame|
|
21
|
-
text_field :clientCode, id: "clientCode", frame: frame
|
22
|
-
text_field :loginName, id: "loginName", frame: frame
|
23
|
-
text_field :loginPassword, id: "password", frame: frame
|
24
|
-
button :login, id: "btnSubmit", frame: frame
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
class TestPage
|
29
|
-
include Symbiont
|
30
|
-
|
31
|
-
begin_at "http://localhost:4567/test_page"
|
32
|
-
title_is "Test Page | Test App"
|
33
|
-
|
34
|
-
link :fake_link, id: "fakeLink"
|
35
|
-
button :clickme, id: "clickme_id"
|
36
|
-
button :fake_button, id: "fakeButton"
|
37
|
-
button :disabled_button, id: "cantclickme_id"
|
38
|
-
text_field :book_title, id: "title"
|
39
|
-
text_field :fake_text_field, id: "fakeTextField"
|
40
|
-
text_field :disabled_text_field, id: "pub_id"
|
41
|
-
end
|
42
|
-
|
43
|
-
@browser = Watir::Browser.new(:firefox)
|
44
|
-
|
45
|
-
puts "* Frame Tests"
|
46
|
-
|
47
|
-
action = LoggingIn.new(@browser)
|
48
|
-
action.start
|
49
|
-
|
50
|
-
clientCode = action.clientCode_object
|
51
|
-
puts "\t'Client Code' text field object is type: #{clientCode}"
|
52
|
-
puts "\t'Client Code' text field exists? #{action.clientCode_exists?}"
|
53
|
-
puts "\t'Client Code' text field visible? #{action.clientCode_visible?}"
|
54
|
-
puts "\t'Client Code' text field enabled? #{action.clientCode_enabled?}"
|
55
|
-
action.clientCode = "QA"
|
56
|
-
action.loginName = "jnyman"
|
57
|
-
action.loginPassword = "password"
|
58
|
-
loginName = action.loginName
|
59
|
-
puts "\t'Login Name' text field value is: #{loginName}"
|
60
|
-
|
61
|
-
login = action.login_object
|
62
|
-
puts "\t'Log In' text field object is type: #{login}"
|
63
|
-
puts "\t'Log In' text field exists? #{action.login_exists?}"
|
64
|
-
puts "\t'Log In' text field visible? #{action.login_visible?}"
|
65
|
-
puts "\t'Log In' text field enabled? #{action.login_enabled?}"
|
66
|
-
puts "\t'Log In' button object text is: #{action.login_text}"
|
67
|
-
|
68
|
-
action = LoginPage.new(@browser)
|
69
|
-
action.view
|
70
|
-
action.has_title?
|
71
|
-
action.has_object?
|
72
|
-
|
73
|
-
puts "* Link Tests"
|
74
|
-
|
75
|
-
puts "** Basic Text Link Tests"
|
76
|
-
|
77
|
-
puts "\t'Test Page' link object exists? #{action.testPage_exists?}"
|
78
|
-
puts "\t'Test Page' link object exists? #{action.testPage?}"
|
79
|
-
puts "\t'Test Page' link object visible? #{action.testPage_visible?}"
|
80
|
-
puts "\t'Test Page' link object visible? #{action.testPage_?}"
|
81
|
-
test_page = action.testPage_object
|
82
|
-
puts "\t'Test Page' link object is type: #{test_page}"
|
83
|
-
puts "\t'Test Page' link object text is: #{action.testPage_text}"
|
84
|
-
puts "\t'Test Page' link object text is: #{test_page.text}"
|
85
|
-
|
86
|
-
action.testPage
|
87
|
-
action = TestPage.new(@browser)
|
88
|
-
|
89
|
-
puts "** Fake Link Tests"
|
90
|
-
|
91
|
-
test_link = action.fake_link_object
|
92
|
-
puts "\tFake link object is type: #{test_link}"
|
93
|
-
puts "\tFake link exists? #{action.fake_link?}"
|
94
|
-
|
95
|
-
puts "* Text Field Tests"
|
96
|
-
|
97
|
-
puts "** Enabled Text Field Tests"
|
98
|
-
|
99
|
-
puts "\t'Book Title' text field object exists? #{action.book_title_exists?}"
|
100
|
-
puts "\t'Book Title' text field object exists? #{action.book_title?}"
|
101
|
-
puts "\t'Book Title' text field object visible? #{action.book_title_visible?}"
|
102
|
-
puts "\t'Book Title' text field object exists? #{action.book_title_?}"
|
103
|
-
puts "\t'Book Title' text field object enabled? #{action.book_title_enabled?}"
|
104
|
-
puts "\t'Book Title' text field object enabled? #{action.book_title!}"
|
105
|
-
|
106
|
-
bookTitle = action.book_title_object
|
107
|
-
puts "\t'Book Title' text field object is type: #{bookTitle}"
|
108
|
-
action.book_title = "Revelation Space"
|
109
|
-
book = action.book_title
|
110
|
-
puts "\t'Book Title' text field value is: '#{book}'"
|
111
|
-
|
112
|
-
puts "** Disabled Text Field Tests"
|
113
|
-
|
114
|
-
disabledTextField = action.disabled_text_field_object
|
115
|
-
puts "\tDisabled text field object is type: #{disabledTextField}"
|
116
|
-
puts "\tDisabled text field object exists? #{action.disabled_text_field?}"
|
117
|
-
puts "\tDisabled text field object visible? #{action.disabled_text_field_?}"
|
118
|
-
puts "\tDisabled text field object enabled? #{action.disabled_text_field!}"
|
119
|
-
|
120
|
-
puts "** Fake Text Field Tests"
|
121
|
-
|
122
|
-
fakeTextField = action.fake_text_field_object
|
123
|
-
puts "\tFake text field object is type: #{fakeTextField}"
|
124
|
-
puts "\tFake text field object exists? #{action.fake_text_field_exists?}"
|
125
|
-
|
126
|
-
puts "* Button Tests"
|
127
|
-
|
128
|
-
puts "** Enabled Button Tests"
|
129
|
-
|
130
|
-
puts "\t'Click Me' button object exists? #{action.clickme_exists?}"
|
131
|
-
puts "\t'Click Me' button object exists? #{action.clickme?}"
|
132
|
-
puts "\t'Click Me' button object visible? #{action.clickme_visible?}"
|
133
|
-
puts "\t'Click Me' button object exists? #{action.clickme_?}"
|
134
|
-
puts "\t'Click Me' button object enabled? #{action.clickme_enabled?}"
|
135
|
-
puts "\t'Click Me' button object enabled? #{action.clickme!}"
|
136
|
-
click_me = action.clickme_object
|
137
|
-
puts "\t'Click Me' button object is type: #{click_me}"
|
138
|
-
puts "\t'Click Me' button object text is: #{action.clickme_text}"
|
139
|
-
puts "\t'Click Me' button object text is: #{click_me.text}"
|
140
|
-
|
141
|
-
puts "** Disabled Button Tests"
|
142
|
-
|
143
|
-
cant_click_me = action.disabled_button_object
|
144
|
-
puts "\t'Can't Click Me' button object is type: #{cant_click_me}"
|
145
|
-
puts "\t'Can't Click Me' button object exists? #{action.disabled_button?}"
|
146
|
-
puts "\t'Can't Click Me' button object visible? #{action.disabled_button_?}"
|
147
|
-
puts "\t'Can't Click Me' button object enabled? #{action.disabled_button!}"
|
148
|
-
puts "\t'Can't Click Me' button object text is: #{action.disabled_button_text}"
|
149
|
-
|
150
|
-
puts "** Fake Button Tests"
|
151
|
-
|
152
|
-
fake_button = action.fake_button_object
|
153
|
-
puts "\tFake button object is type: #{fake_button}"
|
154
|
-
puts "\tFake button object exists? #{action.fake_button?}"
|
155
|
-
|
156
|
-
action.clickme
|
157
|
-
|
158
|
-
@browser.close
|