sakai-cle-test-api 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +7 -0
- data/README.md +44 -0
- data/lib/sakai-cle-test-api.rb +33 -0
- data/lib/sakai-cle-test-api/admin_page_elements.rb +1462 -0
- data/lib/sakai-cle-test-api/app_functions.rb +752 -0
- data/lib/sakai-cle-test-api/common_page_elements.rb +2045 -0
- data/lib/sakai-cle-test-api/site_page_elements.rb +6130 -0
- data/sakai-cle-test-api.gemspec +16 -0
- metadata +118 -0
data/Gemfile
ADDED
data/README.md
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
# Sakai CLE Functional Testing API
|
2
|
+
|
3
|
+
## Description:
|
4
|
+
|
5
|
+
This is the development project for the Sakai CLE Functional Testing API gem for Ruby.
|
6
|
+
|
7
|
+
This API provides a framework for interacting with web sites for Sakai-OAE, using
|
8
|
+
Ruby and Watir-webdriver--but without needing to know either in detail.
|
9
|
+
|
10
|
+
## Requirements:
|
11
|
+
|
12
|
+
### Ruby 1.9.2 or higher
|
13
|
+
|
14
|
+
### Ruby Gems:
|
15
|
+
[Watir-Webdriver](http://www.watirwebdriver.com)
|
16
|
+
[Page-Object](https://github.com/cheezy/page-object)
|
17
|
+
|
18
|
+
If you're just going to use the API for testing, then simply install it as you would any other Ruby gem: `gem install sakai-cle-test-api`
|
19
|
+
|
20
|
+
This repo is here if you're going to take part in extending the capabilities of the gem.
|
21
|
+
|
22
|
+
## A Basic Usage Example for CLE:
|
23
|
+
|
24
|
+
````ruby
|
25
|
+
#!/usr/bin/env ruby
|
26
|
+
require 'sakai-cle-test-api'
|
27
|
+
|
28
|
+
# create an instance of the SakaiCLE class, providing your test browser and the URL of
|
29
|
+
# The Sakai CLE welcome/login page...
|
30
|
+
sakai = SakaiCLE.new(:chrome, "https://cle-1.qa.rsmart.com/xsl-portal")
|
31
|
+
|
32
|
+
# Log in with your test user and password...
|
33
|
+
workspace = sakai.login("username", "password")
|
34
|
+
````
|
35
|
+
|
36
|
+
## Contribute
|
37
|
+
|
38
|
+
* Fork the project.
|
39
|
+
* Test drive your feature addition or bug fix. Adding specs is important and I will not accept a pull request that does not have tests.
|
40
|
+
* Make sure you describe your new feature with a cucumber scenario.
|
41
|
+
* Make sure you provide RDoc comments for any new public method you add. Remember, others will be using this gem.
|
42
|
+
* Commit, do not mess with Rakefile, version, or ChangeLog.
|
43
|
+
(if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
|
44
|
+
* Send me a pull request. Bonus points for topic branches.
|
@@ -0,0 +1,33 @@
|
|
1
|
+
require 'kuali-sakai-common-lib'
|
2
|
+
require 'watir-webdriver'
|
3
|
+
require 'page-object'
|
4
|
+
require 'cgi'
|
5
|
+
|
6
|
+
require 'sakai-cle-test-api/admin_page_elements'
|
7
|
+
require 'sakai-cle-test-api/app_functions'
|
8
|
+
require 'sakai-cle-test-api/common_page_elements'
|
9
|
+
require 'sakai-cle-test-api/site_page_elements'
|
10
|
+
|
11
|
+
# Initialize this class at the start of your test cases to
|
12
|
+
# open the specified test browser at the specified Sakai welcome page URL.
|
13
|
+
#
|
14
|
+
# The initialization will return the LoginPage class object as well as
|
15
|
+
# create the @browser variable used throughout the page classes.
|
16
|
+
class SakaiCLE
|
17
|
+
|
18
|
+
attr_reader :browser
|
19
|
+
|
20
|
+
def initialize(web_browser, url)
|
21
|
+
|
22
|
+
@url = url
|
23
|
+
@browser = Watir::Browser.new web_browser
|
24
|
+
@browser.window.resize_to(1400,900)
|
25
|
+
@browser.goto @url
|
26
|
+
@browser.button(:id=>"footer_logo_button").wait_until_present
|
27
|
+
|
28
|
+
$frame_index = 0 # TODO - Need to remove this and all dependent code.
|
29
|
+
|
30
|
+
Login.new @browser
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
@@ -0,0 +1,1462 @@
|
|
1
|
+
# Navigation links in Sakai's non-site pages
|
2
|
+
#
|
3
|
+
# == Synopsis
|
4
|
+
#
|
5
|
+
# Defines all objects in Sakai Pages that are found in the
|
6
|
+
# context of the Admin user, in "My Workspace". No classes in this
|
7
|
+
# script should refer to pages that appear in the context of
|
8
|
+
# a particular Site, even though, as in the case of Resources,
|
9
|
+
# Announcements, and Help, the page may exist in both contexts.
|
10
|
+
#
|
11
|
+
# Most classes use the PageObject gem
|
12
|
+
# to create methods to interact with the objects on the pages.
|
13
|
+
#
|
14
|
+
# Author :: Abe Heward (aheward@rsmart.com)
|
15
|
+
|
16
|
+
# Page-object is the gem that parses each of the listed objects.
|
17
|
+
# For an introduction to the tool, written by the author, visit:
|
18
|
+
# http://www.cheezyworld.com/2011/07/29/introducing-page-object-gem/
|
19
|
+
#
|
20
|
+
# For more extensive detail, visit:
|
21
|
+
# https://github.com/cheezy/page-object/wiki/page-object
|
22
|
+
#
|
23
|
+
# Also, see the bottom of this script for a Page Class template for
|
24
|
+
# copying when you create a new class.
|
25
|
+
|
26
|
+
#require 'page-object'
|
27
|
+
#require File.dirname(__FILE__) + '/app_functions.rb'
|
28
|
+
|
29
|
+
#================
|
30
|
+
# Aliases Pages
|
31
|
+
#================
|
32
|
+
|
33
|
+
# The Aliases page - "icon-sakai-aliases", found in the Administration Workspace
|
34
|
+
class Aliases
|
35
|
+
|
36
|
+
include PageObject
|
37
|
+
include ToolsMenu
|
38
|
+
|
39
|
+
in_frame(:index=>0) do |frame|
|
40
|
+
link(:new_alias, :text=>"New Alias", :frame=>frame)
|
41
|
+
text_field(:search_field, :id=>"search", :frame=>frame)
|
42
|
+
link(:search_button, :text=>"Search", :frame=>frame)
|
43
|
+
select_list(:select_page_size, :id=>"selectPageSize", :frame=>frame)
|
44
|
+
button(:next, :name=>"eventSubmit_doList_next", :frame=>frame)
|
45
|
+
button(:last, :name=>"eventSubmit_doList_last", :frame=>frame)
|
46
|
+
button(:previous, :name=>"eventSubmit_doList_prev", :frame=>frame)
|
47
|
+
button(:first, :name=>"eventSubmit_doList_first", :frame=>frame)
|
48
|
+
end
|
49
|
+
|
50
|
+
end
|
51
|
+
|
52
|
+
# The Page that appears when you create a New Alias
|
53
|
+
class AliasesCreate
|
54
|
+
|
55
|
+
include PageObject
|
56
|
+
include ToolsMenu
|
57
|
+
|
58
|
+
in_frame(:class=>"portletMainIframe") do |frame|
|
59
|
+
text_field(:alias_name, :id=>"id", :frame=>frame)
|
60
|
+
text_field(:target, :id=>"target", :frame=>frame)
|
61
|
+
button(:save, :name=>"eventSubmit_doSave", :frame=>frame)
|
62
|
+
button(:cancel, :name=>"eventSubmit_doCancel", :frame=>frame)
|
63
|
+
|
64
|
+
end
|
65
|
+
|
66
|
+
end
|
67
|
+
|
68
|
+
# Page for editing an existing Alias record
|
69
|
+
class EditAlias
|
70
|
+
|
71
|
+
include PageObject
|
72
|
+
include ToolsMenu
|
73
|
+
|
74
|
+
in_frame(:class=>"portletMainIframe") do |frame|
|
75
|
+
link(:remove_alias, :text=>"Remove Alias", :frame=>frame)
|
76
|
+
text_field(:target, :id=>"target", :frame=>frame)
|
77
|
+
button(:save, :name=>"eventSubmit_doSave", :frame=>frame)
|
78
|
+
button(:cancel, :name=>"eventSubmit_doCancel", :frame=>frame)
|
79
|
+
|
80
|
+
end
|
81
|
+
|
82
|
+
end
|
83
|
+
|
84
|
+
|
85
|
+
#================
|
86
|
+
# Login Pages
|
87
|
+
#================
|
88
|
+
|
89
|
+
# This is the page where users log in to the site.
|
90
|
+
class Login
|
91
|
+
|
92
|
+
include ToolsMenu
|
93
|
+
|
94
|
+
def search_public_courses_and_projects
|
95
|
+
self.frame(:index=>0).link(:text=>"Search Public Courses and Projects").click
|
96
|
+
SearchPublic.new(@browser)
|
97
|
+
end
|
98
|
+
|
99
|
+
# Logs in to Sakai using the
|
100
|
+
# specified credentials. Then it
|
101
|
+
# instantiates the MyWorkspace class.
|
102
|
+
def login(username, password)
|
103
|
+
frame = self.frame(:id, "ifrm")
|
104
|
+
frame.text_field(:id, "eid").set username
|
105
|
+
frame.text_field(:id, "pw").set password
|
106
|
+
frame.form(:method, "post").submit
|
107
|
+
$frame_index=0
|
108
|
+
MyWorkspace.new(@browser)
|
109
|
+
end
|
110
|
+
alias log_in login
|
111
|
+
alias sign_in login
|
112
|
+
|
113
|
+
end
|
114
|
+
|
115
|
+
# The page where you search for public courses and projects.
|
116
|
+
class SearchPublic
|
117
|
+
|
118
|
+
include ToolsMenu
|
119
|
+
|
120
|
+
def home
|
121
|
+
@browser.frame(:index=>0).link(:text=>"Home").click
|
122
|
+
Login.new(@browser)
|
123
|
+
end
|
124
|
+
|
125
|
+
def search_for=(string)
|
126
|
+
@browser.frame(:index=>0).text_field(:id=>"searchbox").set(Regexp.escape(string))
|
127
|
+
end
|
128
|
+
|
129
|
+
def search_for_sites
|
130
|
+
@browser.frame(:index=>0).button(:value=>"Search for Sites").click
|
131
|
+
SearchPublicResults.new(@browser)
|
132
|
+
end
|
133
|
+
|
134
|
+
end
|
135
|
+
|
136
|
+
# The page showing the results list of Site matches to a search of public sites/projects.
|
137
|
+
class SearchPublicResults
|
138
|
+
|
139
|
+
include ToolsMenu
|
140
|
+
|
141
|
+
def click_site(site_name)
|
142
|
+
@browser.frame(:index=>0).link(:text=>site_name).click
|
143
|
+
SiteSummaryPage.new(@browser)
|
144
|
+
end
|
145
|
+
|
146
|
+
def home
|
147
|
+
@browser.frame(:id=>"ifrm").link(:text=>"Home").click
|
148
|
+
Login.new(@browser)
|
149
|
+
end
|
150
|
+
|
151
|
+
end
|
152
|
+
|
153
|
+
# The page that appears when you click a Site in the Site Search Results page, when not logged
|
154
|
+
# in to Sakai.
|
155
|
+
class SiteSummaryPage
|
156
|
+
|
157
|
+
include ToolsMenu
|
158
|
+
|
159
|
+
def return_to_list
|
160
|
+
@browser.frame(:index=>0).button(:value=>"Return to List").click
|
161
|
+
SearchPublicResults.new(@browser)
|
162
|
+
end
|
163
|
+
|
164
|
+
def syllabus_attachments
|
165
|
+
links = []
|
166
|
+
@browser.frame(:id=>"ifrm").links.each do |link|
|
167
|
+
if link.href=~/Syllabus/
|
168
|
+
links << link.text
|
169
|
+
end
|
170
|
+
end
|
171
|
+
return links
|
172
|
+
end
|
173
|
+
|
174
|
+
end
|
175
|
+
|
176
|
+
|
177
|
+
#================
|
178
|
+
# Profile Pages
|
179
|
+
#================
|
180
|
+
|
181
|
+
#
|
182
|
+
class Profile
|
183
|
+
|
184
|
+
include PageObject
|
185
|
+
include ToolsMenu
|
186
|
+
|
187
|
+
def edit_my_profile
|
188
|
+
frm.link(:text=>"Edit my Profile").click
|
189
|
+
EditProfile.new(@browser)
|
190
|
+
end
|
191
|
+
|
192
|
+
def show_my_profile
|
193
|
+
frm.link(:text=>"Show my Profile").click
|
194
|
+
Profile.new @browser
|
195
|
+
end
|
196
|
+
|
197
|
+
def photo
|
198
|
+
source = frm.image(:id=>"profileForm:image1").src
|
199
|
+
return source.split("/")[-1]
|
200
|
+
end
|
201
|
+
|
202
|
+
def email
|
203
|
+
frm.link(:id=>"profileForm:email").text
|
204
|
+
end
|
205
|
+
|
206
|
+
end
|
207
|
+
|
208
|
+
#
|
209
|
+
class EditProfile
|
210
|
+
|
211
|
+
include PageObject
|
212
|
+
include ToolsMenu
|
213
|
+
|
214
|
+
def save
|
215
|
+
frm.button(:value=>"Save").click
|
216
|
+
Profile.new(@browser)
|
217
|
+
end
|
218
|
+
|
219
|
+
def picture_file=(filename)
|
220
|
+
frm.file_field(:name=>"editProfileForm:uploadFile.uploadId").set(File.expand_path(File.dirname(__FILE__)) + "/../../data/sakai-cle-test-api/" + filename)
|
221
|
+
end
|
222
|
+
|
223
|
+
in_frame(:class=>"portletMainIframe") do |frame|
|
224
|
+
text_field(:first_name, :id=>"editProfileForm:first_name", :frame=>frame)
|
225
|
+
text_field(:last_name, :id=>"editProfileForm:lname", :frame=>frame)
|
226
|
+
text_field(:nickname, :id=>"editProfileForm:nickname", :frame=>frame)
|
227
|
+
text_field(:position, :id=>"editProfileForm:position", :frame=>frame)
|
228
|
+
text_field(:email, :id=>"editProfileForm:email", :frame=>frame)
|
229
|
+
radio_button(:upload_new_picture, :value=>"pictureUpload", :frame=>frame)
|
230
|
+
end
|
231
|
+
end
|
232
|
+
|
233
|
+
|
234
|
+
#================
|
235
|
+
# Profile2 Pages
|
236
|
+
#================
|
237
|
+
|
238
|
+
module Profile2Nav
|
239
|
+
|
240
|
+
def preferences
|
241
|
+
frm.link(:class=>"icon preferences").click
|
242
|
+
Profile2Preferences.new @browser
|
243
|
+
end
|
244
|
+
|
245
|
+
def privacy
|
246
|
+
frm.link(:text=>"Privacy").click
|
247
|
+
Profile2Privacy.new @browser
|
248
|
+
end
|
249
|
+
|
250
|
+
def my_profile
|
251
|
+
frm.link(:text=>"My profile").click
|
252
|
+
Profile2.new(@browser)
|
253
|
+
end
|
254
|
+
|
255
|
+
def connections
|
256
|
+
frm.link(:class=>"icon connections").click
|
257
|
+
Profile2Connections.new @browser
|
258
|
+
end
|
259
|
+
|
260
|
+
def pictures
|
261
|
+
frm.link(:text=>"Pictures").click
|
262
|
+
Profile2Pictures.new @browser
|
263
|
+
end
|
264
|
+
|
265
|
+
def messages
|
266
|
+
frm.link(:text=>"Messages").click
|
267
|
+
Profile2Messages.new @browser
|
268
|
+
end
|
269
|
+
|
270
|
+
def search_for_connections
|
271
|
+
frm.link(:class=>"icon search").click
|
272
|
+
Profile2Search.new @browser
|
273
|
+
end
|
274
|
+
|
275
|
+
end
|
276
|
+
|
277
|
+
#
|
278
|
+
class Profile2
|
279
|
+
|
280
|
+
include PageObject
|
281
|
+
include ToolsMenu
|
282
|
+
include Profile2Nav
|
283
|
+
|
284
|
+
def edit_basic_info
|
285
|
+
frm.div(:id=>"mainPanel").span(:text=>"Basic Information").fire_event("onmouseover")
|
286
|
+
frm.div(:id=>"mainPanel").link(:href=>/myInfo:editButton/).click
|
287
|
+
sleep 0.5
|
288
|
+
Profile2.new @browser
|
289
|
+
end
|
290
|
+
|
291
|
+
def edit_contact_info
|
292
|
+
frm.div(:id=>"mainPanel").span(:text=>"Contact Information").fire_event("onmouseover")
|
293
|
+
frm.div(:id=>"mainPanel").link(:href=>/myContact:editButton/).click
|
294
|
+
sleep 0.5
|
295
|
+
Profile2.new @browser
|
296
|
+
end
|
297
|
+
|
298
|
+
def edit_staff_info
|
299
|
+
frm.div(:id=>"mainPanel").span(:text=>"Staff Information").fire_event("onmouseover")
|
300
|
+
frm.div(:id=>"mainPanel").link(:href=>/myStaff:editButton/).click
|
301
|
+
sleep 0.5
|
302
|
+
Profile2.new @browser
|
303
|
+
end
|
304
|
+
|
305
|
+
def edit_student_info
|
306
|
+
frm.div(:id=>"mainPanel").span(:text=>"Student Information").fire_event("onmouseover")
|
307
|
+
frm.div(:id=>"mainPanel").link(:href=>/myStudent:editButton/).click
|
308
|
+
sleep 0.5
|
309
|
+
Profile2.new @browser
|
310
|
+
end
|
311
|
+
|
312
|
+
def edit_social_networking
|
313
|
+
frm.div(:id=>"mainPanel").span(:text=>"Social Networking").fire_event("onmouseover")
|
314
|
+
frm.div(:id=>"mainPanel").link(:href=>/mySocialNetworking:editButton/).click
|
315
|
+
sleep 0.5
|
316
|
+
Profile2.new @browser
|
317
|
+
end
|
318
|
+
|
319
|
+
def edit_personal_info
|
320
|
+
frm.div(:id=>"mainPanel").span(:text=>"Personal Information").fire_event("onmouseover")
|
321
|
+
frm.div(:id=>"mainPanel").link(:href=>/myInterests:editButton/).click
|
322
|
+
sleep 0.5
|
323
|
+
Profile2.new @browser
|
324
|
+
end
|
325
|
+
|
326
|
+
def change_picture
|
327
|
+
frm.div(:id=>"myPhoto").fire_event("onmouseover")
|
328
|
+
frm.div(:id=>"myPhoto").link(:class=>"edit-image-button").click
|
329
|
+
sleep 0.5
|
330
|
+
Profile2.new @browser
|
331
|
+
end
|
332
|
+
|
333
|
+
# Enters the specified filename in the file field.
|
334
|
+
#
|
335
|
+
# Note that the file should be inside the data/sakai-cle-test-api folder.
|
336
|
+
# The file or folder name used for the filename variable
|
337
|
+
# should not include a preceding slash ("/") character.
|
338
|
+
def image_file=(filename)
|
339
|
+
frm.file_field(:name=>"picture").set(File.expand_path(File.dirname(__FILE__)) + "/../../data/sakai-cle-test-api/" + filename)
|
340
|
+
end
|
341
|
+
|
342
|
+
def upload
|
343
|
+
frm.button(:value=>"Upload").click
|
344
|
+
sleep 0.5
|
345
|
+
Profile2.new @browser
|
346
|
+
end
|
347
|
+
|
348
|
+
def personal_summary=(text)
|
349
|
+
frm.frame(:id=>"id1a_ifr").send_keys([:command, 'a'], :backspace)
|
350
|
+
frm.frame(:id=>"id1a_ifr").send_keys(text)
|
351
|
+
end
|
352
|
+
|
353
|
+
def birthday(day, month, year)
|
354
|
+
frm.text_field(:name=>"birthdayContainer:birthday").click
|
355
|
+
frm.select(:class=>"ui-datepicker-new-year").wait_until_present
|
356
|
+
frm.select(:class=>"ui-datepicker-new-year").select(year.to_i)
|
357
|
+
frm.select(:class=>"ui-datepicker-new-month").select(month)
|
358
|
+
frm.link(:text=>day.to_s).click
|
359
|
+
end
|
360
|
+
|
361
|
+
def save_changes
|
362
|
+
frm.button(:value=>"Save changes").click
|
363
|
+
Profile2.new @browser
|
364
|
+
end
|
365
|
+
|
366
|
+
# Returns the number (as a string) displayed next to
|
367
|
+
# the "Connections" link in the menu. If there are no
|
368
|
+
# connections then returns zero as a string object.
|
369
|
+
def connection_requests
|
370
|
+
begin
|
371
|
+
frm.link(:class=>/icon connections/).span(:class=>"new-items-count").text
|
372
|
+
rescue
|
373
|
+
return "0"
|
374
|
+
end
|
375
|
+
end
|
376
|
+
|
377
|
+
in_frame(:class=>"portletMainIframe") do |frame|
|
378
|
+
text_field(:say_something, :id=>"id1", :frame=>frame)
|
379
|
+
button(:say_it, :value=>"Say it", :frame=>frame)
|
380
|
+
# Basic Information
|
381
|
+
text_field(:nickname, :name=>"nicknameContainer:nickname", :frame=>frame)
|
382
|
+
# Contact Information
|
383
|
+
text_field(:email, :name=>"emailContainer:email", :frame=>frame)
|
384
|
+
text_field(:home_page, :name=>"homepageContainer:homepage", :frame=>frame)
|
385
|
+
text_field(:work_phone, :name=>"workphoneContainer:workphone", :frame=>frame)
|
386
|
+
text_field(:home_phone, :name=>"homephoneContainer:homephone", :frame=>frame)
|
387
|
+
text_field(:mobile_phone, :name=>"mobilephoneContainer:mobilephone", :frame=>frame)
|
388
|
+
text_field(:facsimile, :name=>"facsimileContainer:facsimile", :frame=>frame)
|
389
|
+
# Someday Staff Info fields should go here...
|
390
|
+
|
391
|
+
# Student Information
|
392
|
+
text_field(:degree_course, :name=>"courseContainer:course", :frame=>frame)
|
393
|
+
text_field(:subjects, :name=>"subjectsContainer:subjects", :frame=>frame)
|
394
|
+
# Social Networking
|
395
|
+
|
396
|
+
# Personal Information
|
397
|
+
text_area(:favorite_books, :name=>"booksContainer:favouriteBooks", :frame=>frame)
|
398
|
+
text_area(:favorite_tv_shows, :name=>"tvContainer:favouriteTvShows", :frame=>frame)
|
399
|
+
text_area(:favorite_movies, :name=>"moviesContainer:favouriteMovies", :frame=>frame)
|
400
|
+
text_area(:favorite_quotes, :name=>"quotesContainer:favouriteQuotes", :frame=>frame)
|
401
|
+
end
|
402
|
+
end
|
403
|
+
|
404
|
+
#
|
405
|
+
class Profile2Preferences
|
406
|
+
|
407
|
+
include PageObject
|
408
|
+
include ToolsMenu
|
409
|
+
include Profile2Nav
|
410
|
+
|
411
|
+
def save_settings
|
412
|
+
frm.button(:value=>"Save settings").click
|
413
|
+
Profile2Preferences.new(@browser)
|
414
|
+
end
|
415
|
+
|
416
|
+
in_frame(:class=>"portletMainIframe") do |frame|
|
417
|
+
|
418
|
+
end
|
419
|
+
end
|
420
|
+
|
421
|
+
#
|
422
|
+
class Profile2Privacy
|
423
|
+
|
424
|
+
include PageObject
|
425
|
+
include ToolsMenu
|
426
|
+
include Profile2Nav
|
427
|
+
|
428
|
+
in_frame(:class=>"portletMainIframe") do |frame|
|
429
|
+
select_list(:profile_image, :name=>"profileImageContainer:profileImage", :frame=>frame)
|
430
|
+
select_list(:basic_info, :name=>"basicInfoContainer:basicInfo", :frame=>frame)
|
431
|
+
select_list(:contact_info, :name=>"contactInfoContainer:contactInfo", :frame=>frame)
|
432
|
+
select_list(:staff_info, :name=>"staffInfoContainer:staffInfo", :frame=>frame)
|
433
|
+
select_list(:student_info, :name=>"studentInfoContainer:studentInfo", :frame=>frame)
|
434
|
+
select_list(:social_info, :name=>"socialNetworkingInfoContainer:socialNetworkingInfo", :frame=>frame)
|
435
|
+
select_list(:personal_info, :name=>"personalInfoContainer:personalInfo", :frame=>frame)
|
436
|
+
select_list(:view_connections, :name=>"myFriendsContainer:myFriends", :frame=>frame)
|
437
|
+
select_list(:see_status, :name=>"myStatusContainer:myStatus", :frame=>frame)
|
438
|
+
select_list(:view_pictures, :name=>"myPicturesContainer:myPictures", :frame=>frame)
|
439
|
+
select_list(:send_messages, :name=>"messagesContainer:messages", :frame=>frame)
|
440
|
+
select_list(:see_kudos_rating, :name=>"myKudosContainer:myKudos", :frame=>frame)
|
441
|
+
checkbox(:show_birth_year, :name=>"birthYearContainer:birthYear", :frame=>frame)
|
442
|
+
button(:save_settings, :value=>"Save settings", :frame=>frame)
|
443
|
+
end
|
444
|
+
end
|
445
|
+
|
446
|
+
#
|
447
|
+
class Profile2Search
|
448
|
+
|
449
|
+
include PageObject
|
450
|
+
include ToolsMenu
|
451
|
+
|
452
|
+
def search_by_name_or_email
|
453
|
+
frm.button(:value=>"Search by name or email").click
|
454
|
+
sleep 0.5
|
455
|
+
Profile2Search.new(@browser)
|
456
|
+
end
|
457
|
+
|
458
|
+
def search_by_common_interest
|
459
|
+
frm.button(:value=>"Search by common interest").click
|
460
|
+
sleep 0.5
|
461
|
+
Profile2Search.new(@browser)
|
462
|
+
end
|
463
|
+
|
464
|
+
def add_as_connection(name)
|
465
|
+
frm.div(:class=>"search-result", :text=>/#{Regexp.escape(name)}/).link(:class=>"icon connection-add").click
|
466
|
+
frm.div(:class=>"modalWindowButtons").wait_until_present
|
467
|
+
frm.div(:class=>"modalWindowButtons").button(:value=>"Add connection").click
|
468
|
+
frm.div(:class=>"modalWindowButtons").wait_while_present
|
469
|
+
sleep 0.5
|
470
|
+
Profile2Search.new @browser
|
471
|
+
end
|
472
|
+
|
473
|
+
def view(name)
|
474
|
+
frm.link(:text=>name).click
|
475
|
+
Profile2View.new(@browser)
|
476
|
+
end
|
477
|
+
|
478
|
+
# Returns an array containing strings of the names of the users returned
|
479
|
+
# in the search.
|
480
|
+
def results
|
481
|
+
results = []
|
482
|
+
frm.div(:class=>"portletBody").spans.each do |span|
|
483
|
+
if span.class_name == "search-result-info-name"
|
484
|
+
results << span.text
|
485
|
+
end
|
486
|
+
end
|
487
|
+
return results
|
488
|
+
end
|
489
|
+
|
490
|
+
def clear_results
|
491
|
+
frm.button(:value=>"Clear results").click
|
492
|
+
Profile2Search.new(@browser)
|
493
|
+
end
|
494
|
+
|
495
|
+
in_frame(:class=>"portletMainIframe") do |frame|
|
496
|
+
text_field(:persons_name_or_email, :name=>"searchName", :frame=>frame)
|
497
|
+
text_field(:common_interest, :name=>"searchInterest", :frame=>frame)
|
498
|
+
end
|
499
|
+
end
|
500
|
+
|
501
|
+
#
|
502
|
+
class Profile2Connections
|
503
|
+
|
504
|
+
include PageObject
|
505
|
+
include ToolsMenu
|
506
|
+
include Profile2Nav
|
507
|
+
|
508
|
+
def confirm_request(name)
|
509
|
+
frm.div(:class=>"connection", :text=>name).link(:title=>"Confirm connection request").click
|
510
|
+
frm.div(:class=>"modalWindowButtons").wait_until_present
|
511
|
+
frm.div(:class=>"modalWindowButtons").button(:value=>"Confirm connection request").click
|
512
|
+
frm.div(:class=>"modalWindowButtons").wait_while_present
|
513
|
+
sleep 0.5
|
514
|
+
Profile2Connections.new @browser
|
515
|
+
end
|
516
|
+
|
517
|
+
# Returns an array containing the names of the connected users.
|
518
|
+
def connections
|
519
|
+
results = []
|
520
|
+
frm.div(:class=>"portletBody").spans.each do |span|
|
521
|
+
if span.class_name == "connection-info-name"
|
522
|
+
results << span.text
|
523
|
+
end
|
524
|
+
end
|
525
|
+
return results
|
526
|
+
end
|
527
|
+
|
528
|
+
in_frame(:class=>"portletMainIframe") do |frame|
|
529
|
+
|
530
|
+
end
|
531
|
+
end
|
532
|
+
|
533
|
+
#
|
534
|
+
class Profile2View
|
535
|
+
|
536
|
+
include PageObject
|
537
|
+
include ToolsMenu
|
538
|
+
include Profile2Nav
|
539
|
+
|
540
|
+
#
|
541
|
+
def connection
|
542
|
+
frm.div(:class=>"leftPanel").span(:class=>/instruction icon/).text
|
543
|
+
end
|
544
|
+
|
545
|
+
#
|
546
|
+
def basic_information
|
547
|
+
hash = {}
|
548
|
+
begin
|
549
|
+
frm.div(:class=>"mainSection", :text=>/Basic Information/).table(:class=>"profileContent").rows.each do |row|
|
550
|
+
hash.store(row[0].text, row[1].text)
|
551
|
+
end
|
552
|
+
rescue Watir::Exception::UnknownObjectException
|
553
|
+
|
554
|
+
end
|
555
|
+
return hash
|
556
|
+
end
|
557
|
+
|
558
|
+
#
|
559
|
+
def contact_information
|
560
|
+
hash = {}
|
561
|
+
begin
|
562
|
+
frm.div(:class=>"mainSection", :text=>/Contact Information/).table(:class=>"profileContent").rows.each do |row|
|
563
|
+
hash.store(row[0].text, row[1].text)
|
564
|
+
end
|
565
|
+
rescue Watir::Exception::UnknownObjectException
|
566
|
+
|
567
|
+
end
|
568
|
+
return hash
|
569
|
+
end
|
570
|
+
|
571
|
+
#
|
572
|
+
def staff_information
|
573
|
+
hash = {}
|
574
|
+
begin
|
575
|
+
frm.div(:class=>"mainSection", :text=>/Staff Information/).table(:class=>"profileContent").rows.each do |row|
|
576
|
+
hash.store(row[0].text, row[1].text)
|
577
|
+
end
|
578
|
+
rescue Watir::Exception::UnknownObjectException
|
579
|
+
|
580
|
+
end
|
581
|
+
return hash
|
582
|
+
end
|
583
|
+
|
584
|
+
#
|
585
|
+
def student_information
|
586
|
+
hash = {}
|
587
|
+
begin
|
588
|
+
frm.div(:class=>"mainSection", :text=>/Student Information/).table(:class=>"profileContent").rows.each do |row|
|
589
|
+
hash.store(row[0].text, row[1].text)
|
590
|
+
end
|
591
|
+
rescue Watir::Exception::UnknownObjectException
|
592
|
+
|
593
|
+
end
|
594
|
+
return hash
|
595
|
+
end
|
596
|
+
|
597
|
+
#
|
598
|
+
def personal_information
|
599
|
+
hash = {}
|
600
|
+
begin
|
601
|
+
frm.div(:class=>"mainSection", :text=>/Personal Information/).table(:class=>"profileContent").rows.each do |row|
|
602
|
+
hash.store(row[0].text, row[1].text)
|
603
|
+
end
|
604
|
+
rescue Watir::Exception::UnknownObjectException
|
605
|
+
|
606
|
+
end
|
607
|
+
return hash
|
608
|
+
end
|
609
|
+
|
610
|
+
end
|
611
|
+
|
612
|
+
|
613
|
+
|
614
|
+
#================
|
615
|
+
# Realms Pages
|
616
|
+
#================
|
617
|
+
|
618
|
+
# Realms page
|
619
|
+
class Realms
|
620
|
+
|
621
|
+
include PageObject
|
622
|
+
include ToolsMenu
|
623
|
+
|
624
|
+
in_frame(:class=>"portletMainIframe") do |frame|
|
625
|
+
link(:new_realm, :text=>"New Realm", :frame=>frame)
|
626
|
+
link(:search, :text=>"Search", :frame=>frame)
|
627
|
+
select_list(:select_page_size, :name=>"selectPageSize", :frame=>frame)
|
628
|
+
button(:next, :name=>"eventSubmit_doList_next", :frame=>frame)
|
629
|
+
button(:last, :name=>"eventSubmit_doList_last", :frame=>frame)
|
630
|
+
button(:previous, :name=>"eventSubmit_doList_prev", :frame=>frame)
|
631
|
+
button(:first, :name=>"eventSubmit_doList_first", :frame=>frame)
|
632
|
+
|
633
|
+
end
|
634
|
+
|
635
|
+
end
|
636
|
+
|
637
|
+
#================
|
638
|
+
# Sections - Site Management
|
639
|
+
#================
|
640
|
+
|
641
|
+
# The Add Sections Page in Site Management
|
642
|
+
class AddSections
|
643
|
+
|
644
|
+
include PageObject
|
645
|
+
include ToolsMenu
|
646
|
+
|
647
|
+
in_frame(:class=>"portletMainIframe") do |frame|
|
648
|
+
link(:overview, :id=>"addSectionsForm:_idJsp3", :frame=>frame)
|
649
|
+
link(:student_memberships, :id=>"addSectionsForm:_idJsp12", :frame=>frame)
|
650
|
+
link(:options, :id=>"addSectionsForm:_idJsp17", :frame=>frame)
|
651
|
+
select_list(:num_to_add, :id=>"addSectionsForm:numToAdd", :frame=>frame)
|
652
|
+
select_list(:category, :id=>"addSectionsForm:category", :frame=>frame)
|
653
|
+
button(:add_sections, :id=>"addSectionsForm:_idJsp89", :frame=>frame)
|
654
|
+
button(:cancel, :id=>"addSectionsForm:_idJsp90", :frame=>frame)
|
655
|
+
|
656
|
+
# Note that the following field definitions are appropriate for
|
657
|
+
# ONLY THE FIRST instance of each of the fields. The Add Sections page
|
658
|
+
# allows for an arbitrary number of these fields to exist.
|
659
|
+
# If you are going to test the addition of multiple sections
|
660
|
+
# and/or meetings, then their elements will have to be
|
661
|
+
# explicitly called or defined in the test scripts themselves.
|
662
|
+
text_field(:name, :id=>"addSectionsForm:sectionTable:0:titleInput", :frame=>frame)
|
663
|
+
radio_button(:unlimited_size, :name=>"addSectionsForm:sectionTable:0:limit", :index=>0, :frame=>frame)
|
664
|
+
radio_button(:limited_size, :name=>"addSectionsForm:sectionTable:0:limit", :index=>1, :frame=>frame)
|
665
|
+
text_field(:max_enrollment, :id=>"addSectionsForm:sectionTable:0:maxEnrollmentInput", :frame=>frame)
|
666
|
+
checkbox(:monday, :id=>"addSectionsForm:sectionTable:0:meetingsTable:0:monday", :frame=>frame)
|
667
|
+
checkbox(:tuesday, :id=>"addSectionsForm:sectionTable:0:meetingsTable:0:tuesday", :frame=>frame)
|
668
|
+
checkbox(:wednesday, :id=>"addSectionsForm:sectionTable:0:meetingsTable:0:wednesday", :frame=>frame)
|
669
|
+
checkbox(:thursday, :id=>"addSectionsForm:sectionTable:0:meetingsTable:0:thursday", :frame=>frame)
|
670
|
+
checkbox(:friday, :id=>"addSectionsForm:sectionTable:0:meetingsTable:0:friday", :frame=>frame)
|
671
|
+
checkbox(:saturday, :id=>"addSectionsForm:sectionTable:0:meetingsTable:0:saturday", :frame=>frame)
|
672
|
+
checkbox(:sunday, :id=>"addSectionsForm:sectionTable:0:meetingsTable:0:sunday", :frame=>frame)
|
673
|
+
text_field(:start_time, :id=>"addSectionsForm:sectionTable:0:meetingsTable:0:startTime", :frame=>frame)
|
674
|
+
radio_button(:start_am, :name=>"addSectionsForm:sectionTable:0:meetingsTable:0:startTimeAm", :index=>0, :frame=>frame)
|
675
|
+
radio_button(:start_pm, :name=>"addSectionsForm:sectionTable:0:meetingsTable:0:startTimeAm", :index=>1, :frame=>frame)
|
676
|
+
text_field(:end_time, :id=>"addSectionsForm:sectionTable:0:meetingsTable:0:endTime", :frame=>frame)
|
677
|
+
radio_button(:end_am, :name=>"addSectionsForm:sectionTable:0:meetingsTable:0:endTimeAm", :index=>0, :frame=>frame)
|
678
|
+
radio_button(:end_pm, :name=>"addSectionsForm:sectionTable:0:meetingsTable:0:endTimeAm", :index=>1, :frame=>frame)
|
679
|
+
text_field(:location, :id=>"addSectionsForm:sectionTable:0:meetingsTable:0:location", :frame=>frame)
|
680
|
+
link(:add_days, :id=>"addSectionsForm:sectionTable:0:addMeeting", :frame=>frame)
|
681
|
+
|
682
|
+
end
|
683
|
+
|
684
|
+
end
|
685
|
+
|
686
|
+
|
687
|
+
# Exactly like the Add Sections page, but used when editing an existing section
|
688
|
+
class EditSections
|
689
|
+
|
690
|
+
include PageObject
|
691
|
+
include ToolsMenu
|
692
|
+
|
693
|
+
in_frame(:class=>"portletMainIframe") do |frame|
|
694
|
+
link(:overview, :id=>"editSectionsForm:_idJsp3", :frame=>frame)
|
695
|
+
link(:student_memberships, :id=>"editSectionsForm:_idJsp12", :frame=>frame)
|
696
|
+
link(:options, :id=>"editSectionsForm:_idJsp17", :frame=>frame)
|
697
|
+
select_list(:num_to_add, :id=>"editSectionsForm:numToAdd", :frame=>frame)
|
698
|
+
select_list(:category, :id=>"editSectionsForm:category", :frame=>frame)
|
699
|
+
button(:add_sections, :id=>"editSectionsForm:_idJsp89", :frame=>frame)
|
700
|
+
button(:cancel, :id=>"editSectionsForm:_idJsp90", :frame=>frame)
|
701
|
+
|
702
|
+
# Note that the following field definitions are appropriate for
|
703
|
+
# ONLY THE FIRST instance of each of the fields. The Edit Sections page
|
704
|
+
# allows for an arbitrary number of these fields to exist.
|
705
|
+
# If you are going to test the editing of multiple sections
|
706
|
+
# and/or meetings, then their elements will have to be
|
707
|
+
# explicitly called or defined in the test scripts themselves.
|
708
|
+
text_field(:name, :id=>"editSectionsForm:sectionTable:0:titleInput", :frame=>frame)
|
709
|
+
radio_button(:unlimited_size, :name=>"editSectionsForm:sectionTable:0:limit", :index=>0, :frame=>frame)
|
710
|
+
radio_button(:limited_size, :name=>"editSectionsForm:sectionTable:0:limit", :index=>1, :frame=>frame)
|
711
|
+
text_field(:max_enrollment, :id=>"editSectionsForm:sectionTable:0:maxEnrollmentInput", :frame=>frame)
|
712
|
+
checkbox(:monday, :id=>"editSectionsForm:sectionTable:0:meetingsTable:0:monday", :frame=>frame)
|
713
|
+
checkbox(:tuesday, :id=>"editSectionsForm:sectionTable:0:meetingsTable:0:tuesday", :frame=>frame)
|
714
|
+
checkbox(:wednesday, :id=>"editSectionsForm:sectionTable:0:meetingsTable:0:wednesday", :frame=>frame)
|
715
|
+
checkbox(:thursday, :id=>"editSectionsForm:sectionTable:0:meetingsTable:0:thursday", :frame=>frame)
|
716
|
+
checkbox(:friday, :id=>"editSectionsForm:sectionTable:0:meetingsTable:0:friday", :frame=>frame)
|
717
|
+
checkbox(:saturday, :id=>"editSectionsForm:sectionTable:0:meetingsTable:0:saturday", :frame=>frame)
|
718
|
+
checkbox(:sunday, :id=>"editSectionsForm:sectionTable:0:meetingsTable:0:sunday", :frame=>frame)
|
719
|
+
text_field(:start_time, :id=>"editSectionsForm:sectionTable:0:meetingsTable:0:startTime", :frame=>frame)
|
720
|
+
radio_button(:start_am, :name=>"editSectionsForm:sectionTable:0:meetingsTable:0:startTimeAm", :index=>0, :frame=>frame)
|
721
|
+
radio_button(:start_pm, :name=>"editSectionsForm:sectionTable:0:meetingsTable:0:startTimeAm", :index=>1, :frame=>frame)
|
722
|
+
text_field(:end_time, :id=>"editSectionsForm:sectionTable:0:meetingsTable:0:endTime", :frame=>frame)
|
723
|
+
radio_button(:end_am, :name=>"editSectionsForm:sectionTable:0:meetingsTable:0:endTimeAm", :index=>0, :frame=>frame)
|
724
|
+
radio_button(:end_pm, :name=>"editSectionsForm:sectionTable:0:meetingsTable:0:endTimeAm", :index=>1, :frame=>frame)
|
725
|
+
text_field(:location, :id=>"editSectionsForm:sectionTable:0:meetingsTable:0:location", :frame=>frame)
|
726
|
+
link(:add_days, :id=>"editSectionsForm:sectionTable:0:addMeeting", :frame=>frame)
|
727
|
+
|
728
|
+
end
|
729
|
+
|
730
|
+
end
|
731
|
+
|
732
|
+
# Options page for Sections
|
733
|
+
class SectionsOptions
|
734
|
+
|
735
|
+
include PageObject
|
736
|
+
include ToolsMenu
|
737
|
+
|
738
|
+
in_frame(:class=>"portletMainIframe") do |frame|
|
739
|
+
checkbox(:students_can_sign_up, :id=>"optionsForm:selfRegister", :frame=>frame)
|
740
|
+
checkbox(:students_can_switch_sections, :id=>"optionsForm:selfSwitch", :frame=>frame)
|
741
|
+
button(:update, :id=>"optionsForm:_idJsp50", :frame=>frame)
|
742
|
+
button(:cancel, :id=>"optionsForm:_idJsp51", :frame=>frame)
|
743
|
+
link(:overview, :id=>"optionsForm:_idJsp3", :frame=>frame)
|
744
|
+
link(:add_sections, :id=>"optionsForm:_idJsp8", :frame=>frame)
|
745
|
+
link(:student_memberships, :id=>"optionsForm:_idJsp12", :frame=>frame)
|
746
|
+
|
747
|
+
end
|
748
|
+
|
749
|
+
end
|
750
|
+
|
751
|
+
# The Sections page
|
752
|
+
# found in the SITE MANAGEMENT menu for a Site
|
753
|
+
class SectionsOverview
|
754
|
+
|
755
|
+
include PageObject
|
756
|
+
include ToolsMenu
|
757
|
+
|
758
|
+
in_frame(:class=>"portletMainIframe") do |frame|
|
759
|
+
link(:add_sections, :id=>"overviewForm:_idJsp8", :frame=>frame)
|
760
|
+
link(:student_memberships, :id=>"overviewForm:_idJsp12", :frame=>frame)
|
761
|
+
link(:options, :id=>"overviewForm:_idJsp17", :frame=>frame)
|
762
|
+
link(:sort_name, :id=>"overviewForm:sectionsTable:_idJsp54", :frame=>frame)
|
763
|
+
link(:sort_ta, :id=>"overviewForm:sectionsTable:_idJsp73", :frame=>frame)
|
764
|
+
link(:sort_day, :id=>"overviewForm:sectionsTable:_idJsp78", :frame=>frame)
|
765
|
+
link(:sort_time, :id=>"overviewForm:sectionsTable:_idJsp83", :frame=>frame)
|
766
|
+
link(:sort_location, :id=>"overviewForm:sectionsTable:_idJsp88", :frame=>frame)
|
767
|
+
link(:sort_current_size, :id=>"overviewForm:sectionsTable:_idJsp93", :frame=>frame)
|
768
|
+
link(:sort_avail, :id=>"overviewForm:sectionsTable:_idJsp97", :frame=>frame)
|
769
|
+
|
770
|
+
end
|
771
|
+
|
772
|
+
end
|
773
|
+
|
774
|
+
#================
|
775
|
+
# Sites Page - from Administration Workspace
|
776
|
+
#================
|
777
|
+
|
778
|
+
# Sites page - arrived at via the link with class="icon-sakai-sites"
|
779
|
+
class Sites
|
780
|
+
|
781
|
+
include PageObject
|
782
|
+
include ToolsMenu
|
783
|
+
|
784
|
+
# Clicks the first site Id link
|
785
|
+
# listed. Useful when you've run a search and
|
786
|
+
# you're certain you've got the result you want.
|
787
|
+
# It then instantiates the EditSiteInfo page class.
|
788
|
+
def click_top_item
|
789
|
+
frm.link(:href, /#{Regexp.escape("&panel=Main&sakai_action=doEdit")}/).click
|
790
|
+
EditSiteInfo.new(@browser)
|
791
|
+
end
|
792
|
+
|
793
|
+
# Clicks the specified Site in the list, using the
|
794
|
+
# specified id value to determine which item to click.
|
795
|
+
# It then instantiates the EditSiteInfo page class.
|
796
|
+
# Use this method when you know the target site ID.
|
797
|
+
def edit_site_id(id)
|
798
|
+
frm.text_field(:id=>"search_site").value=id
|
799
|
+
frm.link(:text=>"Site ID").click
|
800
|
+
frm.link(:text, id).click
|
801
|
+
EditSiteInfo.new(@browser)
|
802
|
+
end
|
803
|
+
|
804
|
+
# Clicks the New Site button, then instantiates
|
805
|
+
# the EditSiteInfo page class.
|
806
|
+
def new_site
|
807
|
+
frm.link(:text, "New Site").click
|
808
|
+
EditSiteInfo.new(@browser)
|
809
|
+
end
|
810
|
+
|
811
|
+
in_frame(:index=>0) do |frame|
|
812
|
+
text_field(:search_field, :id=>"search", :frame=>frame)
|
813
|
+
link(:search_button, :text=>"Search", :frame=>frame)
|
814
|
+
text_field(:search_site_id, :id=>"search_site", :frame=>frame)
|
815
|
+
link(:search_site_id_button, :text=>"Site ID", :frame=>frame)
|
816
|
+
text_field(:search_user_id, :id=>"search_user", :frame=>frame)
|
817
|
+
link(:search_user_id_button, :text=>"User ID", :frame=>frame)
|
818
|
+
button(:next, :name=>"eventSubmit_doList_next", :frame=>frame)
|
819
|
+
button(:last, :name=>"eventSubmit_doList_last", :frame=>frame)
|
820
|
+
button(:previous, :name=>"eventSubmit_doList_prev", :frame=>frame)
|
821
|
+
button(:first, :name=>"eventSubmit_doList_first", :frame=>frame)
|
822
|
+
select_list(:select_page_size, :name=>"selectPageSize", :frame=>frame)
|
823
|
+
button(:next, :name=>"eventSubmit_doList_next", :frame=>frame)
|
824
|
+
button(:last, :name=>"eventSubmit_doList_last", :frame=>frame)
|
825
|
+
button(:previous, :name=>"eventSubmit_doList_prev", :frame=>frame)
|
826
|
+
button(:first, :name=>"eventSubmit_doList_first", :frame=>frame)
|
827
|
+
end
|
828
|
+
|
829
|
+
end
|
830
|
+
|
831
|
+
# Page that appears when you've clicked a Site ID in the
|
832
|
+
# Sites section of the Administration Workspace.
|
833
|
+
class EditSiteInfo
|
834
|
+
|
835
|
+
include PageObject
|
836
|
+
include ToolsMenu
|
837
|
+
|
838
|
+
# Clicks the Remove Site button, then instantiates
|
839
|
+
# the RemoveSite page class.
|
840
|
+
def remove_site
|
841
|
+
frm.link(:text, "Remove Site").click
|
842
|
+
RemoveSite.new(@browser)
|
843
|
+
end
|
844
|
+
|
845
|
+
# Clicks the Save button, then instantiates the Sites
|
846
|
+
# page class.
|
847
|
+
def save
|
848
|
+
frm.button(:value=>"Save").click
|
849
|
+
Sites.new(@browser)
|
850
|
+
end
|
851
|
+
|
852
|
+
# Clicks the Save As link, then instantiates
|
853
|
+
# the SiteSaveAs page class.
|
854
|
+
def save_as
|
855
|
+
frm.link(:text, "Save As").click
|
856
|
+
SiteSaveAs.new(@browser)
|
857
|
+
end
|
858
|
+
|
859
|
+
# Gets the Site ID from the page.
|
860
|
+
def site_id_read_only
|
861
|
+
@browser.frame(:index=>0).table(:class=>"itemSummary").td(:class=>"shorttext", :index=>0).text
|
862
|
+
end
|
863
|
+
|
864
|
+
# Enters the specified text string in the text area of
|
865
|
+
# the FCKEditor.
|
866
|
+
def description=(text)
|
867
|
+
editor.td(:id, "xEditingArea").frame(:index=>0).send_keys(text)
|
868
|
+
end
|
869
|
+
|
870
|
+
# The FCKEditor object. Use this object for
|
871
|
+
# wait commands when the site is slow
|
872
|
+
def editor
|
873
|
+
@browser.frame(:index=>0).frame(:id, "description___Frame")
|
874
|
+
end
|
875
|
+
|
876
|
+
# Clicks the Properties button on the page,
|
877
|
+
# then instantiates the AddEditSiteProperties
|
878
|
+
# page class.
|
879
|
+
def properties
|
880
|
+
frm.button(:value=>"Properties").click
|
881
|
+
AddEditSiteProperties.new(@browser)
|
882
|
+
end
|
883
|
+
|
884
|
+
# Clicks the Pages button, then instantiates
|
885
|
+
# the AddEditPages page class.
|
886
|
+
def pages
|
887
|
+
frm.button(:value=>"Pages").click
|
888
|
+
AddEditPages.new(@browser)
|
889
|
+
end
|
890
|
+
|
891
|
+
in_frame(:class=>"portletMainIframe") do |frame|
|
892
|
+
# Non-navigating, interactive page objects go here
|
893
|
+
text_field(:site_id, :id=>"id", :frame=>frame)
|
894
|
+
text_field(:title, :id=>"title", :frame=>frame)
|
895
|
+
text_field(:type, :id=>"type", :frame=>frame)
|
896
|
+
text_area(:short_description, :id=>"shortDescription", :frame=>frame)
|
897
|
+
radio_button(:unpublished, :id=>"publishedfalse", :frame=>frame)
|
898
|
+
radio_button(:published, :id=>"publishedtrue", :frame=>frame)
|
899
|
+
radio_button(:public_view_yes, :id=>"pubViewtrue", :frame=>frame)
|
900
|
+
end
|
901
|
+
|
902
|
+
end
|
903
|
+
|
904
|
+
# The page you come to when editing a Site in Sites
|
905
|
+
# and you click on the Pages button
|
906
|
+
class AddEditPages
|
907
|
+
|
908
|
+
include PageObject
|
909
|
+
include ToolsMenu
|
910
|
+
|
911
|
+
# Clicks the link for New Page, then
|
912
|
+
# instantiates the NewPage page class.
|
913
|
+
def new_page
|
914
|
+
frm.link(:text=>"New Page").click
|
915
|
+
NewPage.new(@browser)
|
916
|
+
end
|
917
|
+
|
918
|
+
end
|
919
|
+
|
920
|
+
# Page for adding a new page to a Site.
|
921
|
+
class NewPage
|
922
|
+
|
923
|
+
include PageObject
|
924
|
+
include ToolsMenu
|
925
|
+
|
926
|
+
# Clicks the Tools button, then instantiates
|
927
|
+
# the AddEditTools class.
|
928
|
+
def tools
|
929
|
+
frm.button(:value=>"Tools").click
|
930
|
+
AddEditTools.new(@browser)
|
931
|
+
end
|
932
|
+
|
933
|
+
in_frame(:class=>"portletMainIframe") do |frame|
|
934
|
+
# Interactive page objects that do no navigation
|
935
|
+
# or page refreshes go here.
|
936
|
+
text_field(:title, :id=>"title", :frame=>frame)
|
937
|
+
end
|
938
|
+
|
939
|
+
end
|
940
|
+
|
941
|
+
# Page when editing a Site and adding/editing tools for pages.
|
942
|
+
class AddEditTools
|
943
|
+
|
944
|
+
include PageObject
|
945
|
+
include ToolsMenu
|
946
|
+
|
947
|
+
# Clicks the New Tool link, then instantiates
|
948
|
+
# the NewTool class.
|
949
|
+
def new_tool
|
950
|
+
frm.link(:text=>"New Tool").click
|
951
|
+
NewTool.new(@browser)
|
952
|
+
end
|
953
|
+
|
954
|
+
# Clicks the Save button, then
|
955
|
+
# instantiates the AddEditPages class.
|
956
|
+
def save
|
957
|
+
frm.button(:value=>"Save").click
|
958
|
+
AddEditPages.new(@browser)
|
959
|
+
end
|
960
|
+
|
961
|
+
end
|
962
|
+
|
963
|
+
# Page for creating a new tool for a page in a site
|
964
|
+
class NewTool
|
965
|
+
|
966
|
+
include PageObject
|
967
|
+
include ToolsMenu
|
968
|
+
|
969
|
+
# Clicks the Done button, the instantiates
|
970
|
+
# The AddEditTools class.
|
971
|
+
def done
|
972
|
+
frm.button(:value=>"Done").click
|
973
|
+
AddEditTools.new(@browser)
|
974
|
+
end
|
975
|
+
|
976
|
+
in_frame(:class=>"portletMainIframe") do |frame|
|
977
|
+
# Interactive page objects that do no navigation
|
978
|
+
# or page refreshes go here.
|
979
|
+
text_field(:title, :id=>"title", :frame=>frame)
|
980
|
+
text_field(:layout_hints, :id=>"layoutHints", :frame=>frame)
|
981
|
+
radio_button(:resources, :id=>"feature80", :frame=>frame)
|
982
|
+
end
|
983
|
+
|
984
|
+
end
|
985
|
+
|
986
|
+
# Page that appears when you click "Remove Site" when editing a Site in Sites
|
987
|
+
class RemoveSite
|
988
|
+
|
989
|
+
include PageObject
|
990
|
+
include ToolsMenu
|
991
|
+
|
992
|
+
# Clicks the Remove button, then
|
993
|
+
# instantiates the Sites class.
|
994
|
+
def remove
|
995
|
+
frm.button(:value=>"Remove").click
|
996
|
+
Sites.new(@browser)
|
997
|
+
end
|
998
|
+
|
999
|
+
end
|
1000
|
+
|
1001
|
+
# Page that appears when you click "Save As" when editing a Site in Sites
|
1002
|
+
class SiteSaveAs
|
1003
|
+
|
1004
|
+
include PageObject
|
1005
|
+
include ToolsMenu
|
1006
|
+
|
1007
|
+
# Clicks the Save button, then
|
1008
|
+
# instantiates the Sites class.
|
1009
|
+
def save
|
1010
|
+
frm.button(:value, "Save").click
|
1011
|
+
Sites.new(@browser)
|
1012
|
+
end
|
1013
|
+
|
1014
|
+
in_frame(:class=>"portletMainIframe") do |frame|
|
1015
|
+
text_field(:site_id, :id=>"id", :frame=>frame)
|
1016
|
+
end
|
1017
|
+
|
1018
|
+
end
|
1019
|
+
|
1020
|
+
class AddEditSiteProperties
|
1021
|
+
|
1022
|
+
include PageObject
|
1023
|
+
include ToolsMenu
|
1024
|
+
|
1025
|
+
# Clicks the New Property button
|
1026
|
+
def new_property
|
1027
|
+
frm.button(:value=>"New Property").click
|
1028
|
+
#Class.new(@browser)
|
1029
|
+
end
|
1030
|
+
|
1031
|
+
# Clicks the Done button, then instantiates
|
1032
|
+
# the EditSiteInfo class.
|
1033
|
+
def done
|
1034
|
+
frm.button(:value=>"Done").click
|
1035
|
+
EditSiteInfo.new(@browser)
|
1036
|
+
end
|
1037
|
+
|
1038
|
+
# Clicks the Save button, then instantiates
|
1039
|
+
# the Sites page class.
|
1040
|
+
def save
|
1041
|
+
frm.button(:value=>"Save").click
|
1042
|
+
Sites.new(@browser)
|
1043
|
+
end
|
1044
|
+
|
1045
|
+
in_frame(:class=>"portletMainIframe") do |frame|
|
1046
|
+
text_field(:name, :id=>"new_name", :frame=>frame)
|
1047
|
+
text_field(:value, :id=>"new_value", :frame=>frame)
|
1048
|
+
end
|
1049
|
+
end
|
1050
|
+
|
1051
|
+
|
1052
|
+
|
1053
|
+
#================
|
1054
|
+
# User's Account Page - in "My Settings"
|
1055
|
+
#================
|
1056
|
+
|
1057
|
+
# The Page for editing User Account details
|
1058
|
+
class EditAccount
|
1059
|
+
|
1060
|
+
include PageObject
|
1061
|
+
include ToolsMenu
|
1062
|
+
|
1063
|
+
# Clicks the update details button then
|
1064
|
+
# makes sure there isn't any error message present.
|
1065
|
+
# If there is, it reinstantiates the Edit Account Class,
|
1066
|
+
# otherwise it instantiates the UserAccount Class.
|
1067
|
+
def update_details
|
1068
|
+
frm.button(:value=>"Update Details").click
|
1069
|
+
# Need to check if the update took...
|
1070
|
+
if frm.div(:class=>"portletBody").h3.text=="My Account Details"
|
1071
|
+
# Apparently it did...
|
1072
|
+
UserAccount.new(@browser)
|
1073
|
+
elsif frm.div(:class=>"portletBody").h3.text=="Account Details"
|
1074
|
+
# We are on the edit page (or we're using the Admin account)...
|
1075
|
+
EditAccount.new(@browser)
|
1076
|
+
elsif frm.div(:class=>"portletBody").h3.text=="Users"
|
1077
|
+
Users.new(@browser)
|
1078
|
+
end
|
1079
|
+
end
|
1080
|
+
|
1081
|
+
in_frame(:class=>"portletMainIframe") do |frame|
|
1082
|
+
text_field(:first_name, :id=>"first-name", :frame=>frame)
|
1083
|
+
text_field(:last_name, :id=>"last-name", :frame=>frame)
|
1084
|
+
text_field(:email, :id=>"email", :frame=>frame)
|
1085
|
+
text_field(:current_password, :id=>"pwcur", :frame=>frame)
|
1086
|
+
text_field(:create_new_password, :id=>"pw", :frame=>frame)
|
1087
|
+
text_field(:verify_new_password, :id=>"pw0", :frame=>frame)
|
1088
|
+
end
|
1089
|
+
|
1090
|
+
end
|
1091
|
+
|
1092
|
+
# A Non-Admin User's Account page
|
1093
|
+
# Accessible via the "Account" link in "MY SETTINGS"
|
1094
|
+
#
|
1095
|
+
# IMPORTANT: this class does not use PageObject or the ToolsMenu!!
|
1096
|
+
# So, the only available method to navigate away from this page is
|
1097
|
+
# Home. Otherwise, you'll have to call the navigation link
|
1098
|
+
# Explicitly in the test case itself.
|
1099
|
+
#
|
1100
|
+
# Objects and methods used in this class must be explicitly
|
1101
|
+
# defined using Watir and Ruby code.
|
1102
|
+
#
|
1103
|
+
# Do NOT use the PageObject syntax in this class.
|
1104
|
+
class UserAccount
|
1105
|
+
|
1106
|
+
def initialize(browser)
|
1107
|
+
@browser = browser
|
1108
|
+
end
|
1109
|
+
|
1110
|
+
# Clicks the Modify Details button. Instantiates the EditAccount class.
|
1111
|
+
def modify_details
|
1112
|
+
@browser.frame(:index=>0).button(:name=>"eventSubmit_doModify").click
|
1113
|
+
EditAccount.new(@browser)
|
1114
|
+
end
|
1115
|
+
|
1116
|
+
# Gets the text of the User ID field.
|
1117
|
+
def user_id
|
1118
|
+
@browser.frame(:index=>0).table(:class=>"itemSummary", :index=>0)[0][1].text
|
1119
|
+
end
|
1120
|
+
|
1121
|
+
# Gets the text of the First Name field.
|
1122
|
+
def first_name
|
1123
|
+
@browser.frame(:index=>0).table(:class=>"itemSummary", :index=>0)[1][1].text
|
1124
|
+
end
|
1125
|
+
|
1126
|
+
# Gets the text of the Last Name field.
|
1127
|
+
def last_name
|
1128
|
+
@browser.frame(:index=>0).table(:class=>"itemSummary", :index=>0)[2][1].text
|
1129
|
+
end
|
1130
|
+
|
1131
|
+
# Gets the text of the Email field.
|
1132
|
+
def email
|
1133
|
+
@browser.frame(:index=>0).table(:class=>"itemSummary", :index=>0)[3][1].text
|
1134
|
+
end
|
1135
|
+
|
1136
|
+
# Gets the text of the Type field.
|
1137
|
+
def type
|
1138
|
+
@browser.frame(:index=>0).table(:class=>"itemSummary", :index=>0)[4][1].text
|
1139
|
+
end
|
1140
|
+
|
1141
|
+
# Gets the text of the Created By field.
|
1142
|
+
def created_by
|
1143
|
+
@browser.frame(:index=>0).table(:class=>"itemSummary", :index=>1)[0][1].text
|
1144
|
+
end
|
1145
|
+
|
1146
|
+
# Gets the text of the Created field.
|
1147
|
+
def created
|
1148
|
+
@browser.frame(:index=>0).table(:class=>"itemSummary", :index=>1)[1][1].text
|
1149
|
+
end
|
1150
|
+
|
1151
|
+
# Gets the text of the Modified By field.
|
1152
|
+
def modified_by
|
1153
|
+
@browser.frame(:index=>0).table(:class=>"itemSummary", :index=>1)[2][1].text
|
1154
|
+
end
|
1155
|
+
|
1156
|
+
# Gets the text of the Modified (date) field.
|
1157
|
+
def modified
|
1158
|
+
@browser.frame(:index=>0).table(:class=>"itemSummary", :index=>1)[3][1].text
|
1159
|
+
end
|
1160
|
+
|
1161
|
+
# Clicks the Home buton in the left menu.
|
1162
|
+
# instantiates the Home Class.
|
1163
|
+
def home
|
1164
|
+
@browser.link(:text, "Home").click
|
1165
|
+
Home.new(@browser)
|
1166
|
+
end
|
1167
|
+
|
1168
|
+
end
|
1169
|
+
|
1170
|
+
#================
|
1171
|
+
# Users Pages - From the Workspace
|
1172
|
+
#================
|
1173
|
+
|
1174
|
+
# The Page for editing User Account details
|
1175
|
+
class EditUser
|
1176
|
+
|
1177
|
+
include PageObject
|
1178
|
+
include ToolsMenu
|
1179
|
+
|
1180
|
+
in_frame(:class=>"portletMainIframe") do |frame|
|
1181
|
+
link(:remove_user, :text=>"Remove User", :frame=>frame)
|
1182
|
+
text_field(:first_name, :id=>"first-name", :frame=>frame)
|
1183
|
+
text_field(:last_name, :id=>"last-name", :frame=>frame)
|
1184
|
+
text_field(:email, :id=>"email", :frame=>frame)
|
1185
|
+
text_field(:create_new_password, :id=>"pw", :frame=>frame)
|
1186
|
+
text_field(:verify_new_password, :id=>"pw0", :frame=>frame)
|
1187
|
+
button(:update_details, :name=>"eventSubmit_doSave", :frame=>frame)
|
1188
|
+
button(:cancel_changes, :name=>"eventSubmit_doCancel", :frame=>frame)
|
1189
|
+
end
|
1190
|
+
|
1191
|
+
end
|
1192
|
+
|
1193
|
+
# The Users page - "icon-sakai-users"
|
1194
|
+
class Users
|
1195
|
+
|
1196
|
+
include PageObject
|
1197
|
+
include ToolsMenu
|
1198
|
+
|
1199
|
+
def new_user
|
1200
|
+
frm.link(:text=>"New User").click
|
1201
|
+
CreateNewUser.new @browser
|
1202
|
+
end
|
1203
|
+
|
1204
|
+
# Returns the contents of the Name cell
|
1205
|
+
# based on the specified user ID value.
|
1206
|
+
def name(user_id)
|
1207
|
+
frm.table(:class=>"listHier lines").row(:text=>/#{Regexp.escape(user_id)}/i)[1].text
|
1208
|
+
end
|
1209
|
+
|
1210
|
+
# Returns the contents of the Email cell
|
1211
|
+
# based on the specified user ID value.
|
1212
|
+
def email(user_id)
|
1213
|
+
frm.table(:class=>"listHier lines").row(:text=>/#{Regexp.escape(user_id)}/i)[2].text
|
1214
|
+
end
|
1215
|
+
|
1216
|
+
# Returns the contents of the Type cell
|
1217
|
+
# based on the specified user ID value.
|
1218
|
+
def type(user_id)
|
1219
|
+
frm.table(:class=>"listHier lines").row(:text=>/#{Regexp.escape(user_id)}/i)[3].text
|
1220
|
+
end
|
1221
|
+
|
1222
|
+
def search_button
|
1223
|
+
frm.link(:text=>"Search").click
|
1224
|
+
frm.table(:class=>"listHier lines").wait_until_present
|
1225
|
+
Users.new @browser
|
1226
|
+
end
|
1227
|
+
|
1228
|
+
in_frame(:class=>"portletMainIframe") do |frame|
|
1229
|
+
link(:clear_search, :text=>"Clear Search", :frame=>frame)
|
1230
|
+
text_field(:search_field, :id=>"search", :frame=>frame)
|
1231
|
+
select_list(:select_page_size, :name=>"selectPageSize", :frame=>frame)
|
1232
|
+
button(:next, :name=>"eventSubmit_doList_next", :frame=>frame)
|
1233
|
+
button(:last, :name=>"eventSubmit_doList_last", :frame=>frame)
|
1234
|
+
button(:previous, :name=>"eventSubmit_doList_prev", :frame=>frame)
|
1235
|
+
button(:first, :name=>"eventSubmit_doList_first", :frame=>frame)
|
1236
|
+
end
|
1237
|
+
|
1238
|
+
end
|
1239
|
+
|
1240
|
+
# The Create New User page
|
1241
|
+
class CreateNewUser
|
1242
|
+
|
1243
|
+
include PageObject
|
1244
|
+
include ToolsMenu
|
1245
|
+
|
1246
|
+
def save_details
|
1247
|
+
frm.button(:name=>"eventSubmit_doSave").click
|
1248
|
+
Users.new(@browser)
|
1249
|
+
end
|
1250
|
+
|
1251
|
+
in_frame(:class=>"portletMainIframe") do |frame|
|
1252
|
+
text_field(:user_id, :id=>"eid", :frame=>frame)
|
1253
|
+
text_field(:first_name, :id=>"first-name", :frame=>frame)
|
1254
|
+
text_field(:last_name, :id=>"last-name", :frame=>frame)
|
1255
|
+
text_field(:email, :id=>"email", :frame=>frame)
|
1256
|
+
text_field(:create_new_password, :id=>"pw", :frame=>frame)
|
1257
|
+
text_field(:verify_new_password, :id=>"pw0", :frame=>frame)
|
1258
|
+
select_list(:type, :name=>"type", :frame=>frame)
|
1259
|
+
button(:cancel_changes, :name=>"eventSubmit_doCancel", :frame=>frame)
|
1260
|
+
end
|
1261
|
+
|
1262
|
+
end
|
1263
|
+
|
1264
|
+
|
1265
|
+
#================
|
1266
|
+
# User Membership Pages from Administration Workspace
|
1267
|
+
#================
|
1268
|
+
|
1269
|
+
# User Membership page for admin users - "icon-sakai-usermembership"
|
1270
|
+
class UserMembership
|
1271
|
+
|
1272
|
+
include PageObject
|
1273
|
+
include ToolsMenu
|
1274
|
+
|
1275
|
+
# Returns an array containing the user names displayed in the search results.
|
1276
|
+
def names
|
1277
|
+
names = []
|
1278
|
+
frm.table(:class=>/listHier/).rows.each do |row|
|
1279
|
+
names << row[2].text
|
1280
|
+
end
|
1281
|
+
names.delete_at(0)
|
1282
|
+
return names
|
1283
|
+
end
|
1284
|
+
|
1285
|
+
# Returns the user id of the specified user (assuming that person
|
1286
|
+
# appears in the search results list, otherwise this method will
|
1287
|
+
# throw an error.)
|
1288
|
+
def user_id(name)
|
1289
|
+
frm.table(:class=>/listHier/).row(:text=>/#{Regexp.escape(name)}/)[0].text
|
1290
|
+
end
|
1291
|
+
|
1292
|
+
# Returns the user type of the specified user (assuming that person
|
1293
|
+
# appears in the search results list, otherwise this method will
|
1294
|
+
# throw an error.)
|
1295
|
+
def type(name)
|
1296
|
+
frm.table(:class=>/listHier/).row(:text=>/#{Regexp.escape(name)}/)[4].text
|
1297
|
+
end
|
1298
|
+
|
1299
|
+
# Returns the text contents of the "instruction" paragraph that
|
1300
|
+
# appears when there are no search results.
|
1301
|
+
def alert_text
|
1302
|
+
frm.p(:class=>"instruction").text
|
1303
|
+
end
|
1304
|
+
|
1305
|
+
in_frame(:class=>"portletMainIframe") do |frame|
|
1306
|
+
select_list(:user_type, :id=>"userlistForm:selectType", :frame=>frame)
|
1307
|
+
select_list(:user_authority, :id=>"userlistForm:selectAuthority", :frame=>frame)
|
1308
|
+
text_field(:search_field, :id=>"userlistForm:inputSearchBox", :frame=>frame)
|
1309
|
+
button(:search, :id=>"userlistForm:searchButton", :frame=>frame)
|
1310
|
+
button(:clear_search, :id=>"userlistForm:clearSearchButton", :frame=>frame)
|
1311
|
+
select_list(:page_size, :id=>"userlistForm:pager_pageSize", :frame=>frame)
|
1312
|
+
button(:export_csv, :id=>"userlistForm:exportCsv", :frame=>frame)
|
1313
|
+
button(:export_excel, :id=>"userlistForm:exportXls", :frame=>frame)
|
1314
|
+
link(:sort_user_id, :id=>"userlistForm:_idJsp13:_idJsp14", :frame=>frame)
|
1315
|
+
link(:sort_internal_user_id, :id=>"userlistForm:_idJsp13:_idJsp18", :frame=>frame)
|
1316
|
+
link(:sort_name, :id=>"userlistForm:_idJsp13:_idJsp21", :frame=>frame)
|
1317
|
+
link(:sort_email, :id=>"userlistForm:_idJsp13:_idJsp24", :frame=>frame)
|
1318
|
+
link(:sort_type, :id=>"userlistForm:_idJsp13:_idJsp28", :frame=>frame)
|
1319
|
+
link(:sort_authority, :id=>"userlistForm:_idJsp13:_idJsp31", :frame=>frame)
|
1320
|
+
link(:sort_created_on, :id=>"userlistForm:_idJsp13:_idJsp34", :frame=>frame)
|
1321
|
+
link(:sort_modified_on, :id=>"userlistForm:_idJsp13:_idJsp37", :frame=>frame)
|
1322
|
+
#(:, =>"", :frame=>frame)
|
1323
|
+
|
1324
|
+
end
|
1325
|
+
|
1326
|
+
end
|
1327
|
+
|
1328
|
+
#================
|
1329
|
+
# Job Scheduler pages in Admin Workspace
|
1330
|
+
#================
|
1331
|
+
|
1332
|
+
# The topmost page in the Job Scheduler in Admin Workspace
|
1333
|
+
class JobScheduler
|
1334
|
+
|
1335
|
+
include PageObject
|
1336
|
+
include ToolsMenu
|
1337
|
+
|
1338
|
+
# Clicks the Jobs link, then instantiates
|
1339
|
+
# the JobList Class.
|
1340
|
+
def jobs
|
1341
|
+
frm.link(:text=>"Jobs").click
|
1342
|
+
JobList.new(@browser)
|
1343
|
+
end
|
1344
|
+
|
1345
|
+
end
|
1346
|
+
|
1347
|
+
# The list of Jobs (click the Jobs button on Job Scheduler)
|
1348
|
+
class JobList
|
1349
|
+
|
1350
|
+
include PageObject
|
1351
|
+
include ToolsMenu
|
1352
|
+
|
1353
|
+
# Clicks the New Job link, then
|
1354
|
+
# instantiates the CreateNewJob Class.
|
1355
|
+
def new_job
|
1356
|
+
frm.link(:text=>"New Job").click
|
1357
|
+
CreateNewJob.new(@browser)
|
1358
|
+
end
|
1359
|
+
|
1360
|
+
# Clicks the link with the text "Triggers" associated with the
|
1361
|
+
# specified job name,
|
1362
|
+
# then instantiates the EditTriggers Class.
|
1363
|
+
def triggers(job_name)
|
1364
|
+
frm.div(:class=>"portletBody").table(:class=>"listHier lines").row(:text=>/#{Regexp.escape(job_name)}/).link(:text=>/Triggers/).click
|
1365
|
+
sleep 1
|
1366
|
+
EditTriggers.new(@browser)
|
1367
|
+
end
|
1368
|
+
|
1369
|
+
def event_log
|
1370
|
+
frm.link(:text=>"Event Log").click
|
1371
|
+
EventLog.new(@browser)
|
1372
|
+
end
|
1373
|
+
|
1374
|
+
end
|
1375
|
+
|
1376
|
+
# The Create New Job page
|
1377
|
+
class CreateNewJob
|
1378
|
+
|
1379
|
+
include PageObject
|
1380
|
+
include ToolsMenu
|
1381
|
+
|
1382
|
+
# Clicks the Post button, then
|
1383
|
+
# instantiates the JobList Class.
|
1384
|
+
def post
|
1385
|
+
frm.button(:value=>"Post").click
|
1386
|
+
JobList.new(@browser)
|
1387
|
+
end
|
1388
|
+
|
1389
|
+
in_frame(:class=>"portletMainIframe") do |frame|
|
1390
|
+
text_field(:job_name, :id=>"_id2:job_name", :frame=>frame)
|
1391
|
+
select_list(:type, :name=>"_id2:_id10", :frame=>frame)
|
1392
|
+
end
|
1393
|
+
end
|
1394
|
+
|
1395
|
+
# The page for Editing Triggers
|
1396
|
+
class EditTriggers
|
1397
|
+
|
1398
|
+
include PageObject
|
1399
|
+
include ToolsMenu
|
1400
|
+
|
1401
|
+
# Clicks the "Run Job Now" link, then
|
1402
|
+
# instantiates the RunJobConfirmation Class.
|
1403
|
+
def run_job_now
|
1404
|
+
frm.div(:class=>"portletBody").link(:text=>"Run Job Now").click
|
1405
|
+
RunJobConfirmation.new(@browser)
|
1406
|
+
end
|
1407
|
+
|
1408
|
+
def return_to_jobs
|
1409
|
+
frm.link(:text=>"Return_to_Jobs").click
|
1410
|
+
JobList.new(@browser)
|
1411
|
+
end
|
1412
|
+
|
1413
|
+
def new_trigger
|
1414
|
+
frm.link(:text=>"New Trigger").click
|
1415
|
+
CreateTrigger.new(@browser)
|
1416
|
+
end
|
1417
|
+
|
1418
|
+
end
|
1419
|
+
|
1420
|
+
# The Create Trigger page
|
1421
|
+
class CreateTrigger
|
1422
|
+
|
1423
|
+
include PageObject
|
1424
|
+
include ToolsMenu
|
1425
|
+
|
1426
|
+
def post
|
1427
|
+
frm.button(:value=>"Post").click
|
1428
|
+
EditTriggers.new(@browser)
|
1429
|
+
end
|
1430
|
+
|
1431
|
+
in_frame(:index=>0) do |frame|
|
1432
|
+
text_field(:name, :id=>"_id2:trigger_name", :frame=>frame)
|
1433
|
+
text_field(:cron_expression, :id=>"_id2:trigger_expression", :frame=>frame)
|
1434
|
+
end
|
1435
|
+
end
|
1436
|
+
|
1437
|
+
|
1438
|
+
# The page for confirming you want to run a job
|
1439
|
+
class RunJobConfirmation
|
1440
|
+
|
1441
|
+
include PageObject
|
1442
|
+
include ToolsMenu
|
1443
|
+
|
1444
|
+
# Clicks the "Run Now" button, then
|
1445
|
+
# instantiates the JobList Class.
|
1446
|
+
def run_now
|
1447
|
+
frm.button(:value=>"Run Now").click
|
1448
|
+
JobList.new(@browser)
|
1449
|
+
end
|
1450
|
+
|
1451
|
+
in_frame(:index=>0) do |frame|
|
1452
|
+
#(:, =>"", :frame=>frame)
|
1453
|
+
end
|
1454
|
+
end
|
1455
|
+
|
1456
|
+
# The page containing the Event Log
|
1457
|
+
class EventLog
|
1458
|
+
|
1459
|
+
include PageObject
|
1460
|
+
include ToolsMenu
|
1461
|
+
|
1462
|
+
end
|