sambal-cle 0.1.5 → 0.1.6

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.
Files changed (58) hide show
  1. data/Gemfile +3 -5
  2. data/Gemfile.lock +6 -9
  3. data/lib/sambal-cle/base_page.rb +21 -3
  4. data/lib/sambal-cle/data_objects/announcement.rb +1 -1
  5. data/lib/sambal-cle/data_objects/assignment.rb +3 -2
  6. data/lib/sambal-cle/data_objects/course.rb +5 -4
  7. data/lib/sambal-cle/data_objects/event.rb +7 -7
  8. data/lib/sambal-cle/data_objects/forum.rb +3 -2
  9. data/lib/sambal-cle/data_objects/lesson.rb +3 -1
  10. data/lib/sambal-cle/data_objects/resource.rb +3 -1
  11. data/lib/sambal-cle/page_objects/account.rb +15 -66
  12. data/lib/sambal-cle/page_objects/aliases.rb +3 -2
  13. data/lib/sambal-cle/page_objects/announcements.rb +16 -31
  14. data/lib/sambal-cle/page_objects/assessments.rb +22 -55
  15. data/lib/sambal-cle/page_objects/assignments.rb +1 -1
  16. data/lib/sambal-cle/page_objects/blogger.rb +21 -77
  17. data/lib/sambal-cle/page_objects/blogs.rb +3 -5
  18. data/lib/sambal-cle/page_objects/calendar.rb +22 -40
  19. data/lib/sambal-cle/page_objects/chat_room.rb +2 -2
  20. data/lib/sambal-cle/page_objects/email_archive.rb +1 -2
  21. data/lib/sambal-cle/page_objects/evaluations.rb +78 -50
  22. data/lib/sambal-cle/page_objects/feedback.rb +1 -5
  23. data/lib/sambal-cle/page_objects/forms.rb +14 -55
  24. data/lib/sambal-cle/page_objects/forums.rb +11 -24
  25. data/lib/sambal-cle/page_objects/glossary.rb +6 -12
  26. data/lib/sambal-cle/page_objects/home.rb +7 -18
  27. data/lib/sambal-cle/page_objects/jforums.rb +60 -197
  28. data/lib/sambal-cle/page_objects/job_scheduler.rb +16 -49
  29. data/lib/sambal-cle/page_objects/lessons.rb +11 -34
  30. data/lib/sambal-cle/page_objects/matrix.rb +12 -14
  31. data/lib/sambal-cle/page_objects/messages.rb +71 -466
  32. data/lib/sambal-cle/page_objects/my_workspace.rb +3 -3
  33. data/lib/sambal-cle/page_objects/podcasts.rb +1 -6
  34. data/lib/sambal-cle/page_objects/polls.rb +5 -5
  35. data/lib/sambal-cle/page_objects/portfolio_templates.rb +16 -66
  36. data/lib/sambal-cle/page_objects/portfolios.rb +17 -67
  37. data/lib/sambal-cle/page_objects/profile.rb +5 -16
  38. data/lib/sambal-cle/page_objects/profile2.rb +51 -119
  39. data/lib/sambal-cle/page_objects/public_search.rb +6 -27
  40. data/lib/sambal-cle/page_objects/realms.rb +2 -2
  41. data/lib/sambal-cle/page_objects/resources.rb +89 -116
  42. data/lib/sambal-cle/page_objects/resources_roster.rb +1 -0
  43. data/lib/sambal-cle/page_objects/rosters.rb +3 -13
  44. data/lib/sambal-cle/page_objects/rwiki.rb +2 -6
  45. data/lib/sambal-cle/page_objects/search.rb +10 -10
  46. data/lib/sambal-cle/page_objects/sections.rb +40 -81
  47. data/lib/sambal-cle/page_objects/site_setup.rb +46 -74
  48. data/lib/sambal-cle/page_objects/sites.rb +24 -110
  49. data/lib/sambal-cle/page_objects/styles.rb +6 -51
  50. data/lib/sambal-cle/page_objects/syllabus.rb +12 -26
  51. data/lib/sambal-cle/page_objects/user_membership.rb +3 -15
  52. data/lib/sambal-cle/page_objects/users.rb +9 -25
  53. data/sambal-cle.gemspec +1 -1
  54. data/test/add_assignment_to_calendar_spec.rb +55 -1
  55. data/test/config.yml +1 -1
  56. data/test/duplicate_site_spec.rb +11 -10
  57. data/test/import_site_content_spec.rb +6 -5
  58. metadata +2 -2
@@ -9,11 +9,11 @@ class AssessmentsBase <BasePage
9
9
  frame_element
10
10
  class << self
11
11
  def menu_bar_elements
12
- action(:assessments) { |b| b.frm.link(:text=>"Assessments").click }
13
- action(:assessment_types) { |b| b.frm.link(:text=>"Assessment Types").click }
12
+ link("Assessments")
13
+ link("Assessment Types")
14
14
  # Clicks the Question Pools link, goes to
15
15
  # the QuestionPoolsList class.
16
- action(:question_pools) { |b| b.frm.link(:text=>"Question Pools").click }
16
+ link("Question Pools")
17
17
  action(:questions) { |b| b.frm.link(:text=>/Questions:/).click }
18
18
  end
19
19
 
@@ -22,9 +22,9 @@ class AssessmentsBase <BasePage
22
22
  element(:assign_to_part) { |b| b.frm.select(:id=>"itemForm:assignToPart") }
23
23
  element(:assign_to_pool) { |b| b.frm.select(:id=>"itemForm:assignToPool") }
24
24
  element(:question_text) { |b| b.frm.text_field(:class=>"simple_text_area", :index=>0) }
25
- action(:save) { |b| b.frm.button(:value=>"Save").click }
25
+ button("Save")
26
26
  action(:cancel) { |b| b.frm.button(:id=>"itemForm:_id63").click }
27
- action(:add_attachments) { |b| b.frm.button(:value=>"Add Attachments").click }
27
+ button("Add Attachments")
28
28
  end
29
29
 
30
30
  def pool_page_elements
@@ -49,7 +49,7 @@ class AssessmentsList < AssessmentsBase
49
49
 
50
50
  # If the assessment is going to be made in the builder, then
51
51
  # use EditAssessment. There's no page class for markup text, yet.
52
- action(:create) { |b| b.frm.button(:value=>"Create").click }
52
+ button("Create")
53
53
 
54
54
  # Collects the titles of the Assessments listed as "Pending"
55
55
  # then returns them as an Array.
@@ -279,9 +279,8 @@ class AssessmentSettings < AssessmentsBase
279
279
  #text_field(:objectives, :=>"") }
280
280
  #text_field(:rubrics, :=>"") }
281
281
  #checkbox(:record_metadata_for_questions, :=>"") }
282
- action(:save) { |b| b.frm.button(:value=>"Save Settings").click }
283
- element(:cancel_button) { |b| b.frm.button(:value=>"Cancel") }
284
- action(:cancel) { |p| p.cancel_button.click }
282
+ button("Save Settings")
283
+ button("Cancel")
285
284
 
286
285
  end
287
286
 
@@ -319,9 +318,7 @@ class AssessmentTotalScores < BasePage
319
318
  }
320
319
 
321
320
  # Clicks the Submit Date link in the table header to sort/reverse sort the list.
322
- def sort_by_submit_date
323
- frm.link(:text=>"Submit Date").click
324
- end
321
+ action(:sort_by_submit_date) { |b| b.frm.link(:text=>"Submit Date").click }
325
322
 
326
323
  # Enters the specified string into the topmost box listed on the page.
327
324
  #
@@ -332,19 +329,9 @@ class AssessmentTotalScores < BasePage
332
329
  frm.text_field(:name=>"editTotalResults:totalScoreTable:0:_id345").value=comment
333
330
  end
334
331
 
335
- # Clicks the Update button, then instantiates
336
- # the AssessmentTotalScores class.
337
- def update
338
- frm.button(:value=>"Update").click
339
- AssessmentTotalScores.new(@browser)
340
- end
332
+ button("Update")
341
333
 
342
- # Clicks the Assessments link on the page
343
- # then instantiates the AssessmentsList class. action(:
344
- def assessments
345
- frm.link(:text=>"Assessments").click
346
- AssessmentsList.new(@browser)
347
- end
334
+ link("Assessments")
348
335
 
349
336
  end
350
337
 
@@ -393,25 +380,17 @@ class EditAssessment < AssessmentsBase
393
380
  # @param part_num [String] the part number of the assessment you want
394
381
  action(:remove_part) { |part_num, b| b.frm.link(:xpath, "//a[contains(@onclick, 'assesssmentForm:parts:#{part_num.to_i-1}:copyToPool')]").click }
395
382
 
396
- # Clicks the Add Part button, then
397
- # instantiates the AddEditAssessmentPart page class.
398
- action(:add_part) { |b| b.frm.link(:text=>"Add Part").click }
383
+ link("Add Part")
399
384
 
400
385
  # Selects the desired question type from the
401
386
  # drop down list at the top of the page.
402
387
  action(:question_type) { |qtype, b| b.frm.select(:id=>"assesssmentForm:changeQType").select(qtype) }
403
388
 
404
- # Clicks the Preview button,
405
- # then instantiates the PreviewOverview page class.
406
- action(:preview) { |b| b.frm.link(:text=>"Preview").click }
389
+ link("Preview")
407
390
 
408
- # Clicks the Settings link, then
409
- # instantiates the AssessmentSettings page class.
410
- action(:settings) { |b| b.frm.link(:text=>"Settings").click }
391
+ link("Settings")
411
392
 
412
- # Clicks the Publish button, then
413
- # instantiates the PublishAssessment page class.
414
- action(:publish) { |b| b.frm.link(:text=>"Publish").click }
393
+ link("Publish")
415
394
 
416
395
  # Allows retrieval of a specified question's
417
396
  # text, by part and question number.
@@ -437,7 +416,6 @@ class AddEditAssessmentPart < BasePage
437
416
  # Clicks the Save button
438
417
  def save
439
418
  frm.button(:name=>"modifyPartForm:_id89").click
440
-
441
419
  end
442
420
 
443
421
  element(:title) { |b| b.frm.text_field(:id=>"modifyPartForm:title") }
@@ -467,9 +445,7 @@ class PublishAssessment < BasePage
467
445
  frame_element
468
446
  basic_page_elements
469
447
 
470
- # Clicks the Publish button, then
471
- # instantiates the AssessmentsList page class.
472
- action(:publish) { |b| b.frm.button(:value=>"Publish").click }
448
+ button("Publish")
473
449
 
474
450
  action(:edit) { |b| b.frm.button(:name=>"publishAssessmentForm:_id23").click }
475
451
  element(:notification) { |b| b.frm.select(:id=>"publishAssessmentForm:number") }
@@ -482,7 +458,7 @@ class MultipleChoice < AssessmentsBase
482
458
  menu_bar_elements
483
459
  question_page_elements
484
460
 
485
- action(:whats_this) { |b| b.frm.link(:text=>"(What's This?)").click }
461
+ link("(What's This?)")
486
462
  element(:single_correct) { |b| b.frm.radio(:name=>"itemForm:chooseAnswerTypeForMC", :index=>0) }
487
463
  element(:enable_negative_marking) { |b| b.frm.radio(:name=>"itemForm:partialCreadit_NegativeMarking", :index=>0) }
488
464
 
@@ -501,7 +477,7 @@ class MultipleChoice < AssessmentsBase
501
477
  element(:correct_answer_feedback) { |b| b.frm.text_field(:id=>"itemForm:_id186_textinput") }
502
478
  element(:incorrect_answer_feedback) { |b| b.frm.text_field(:id=>"itemForm:_id190_textinput") }
503
479
 
504
- action(:reset_score_values) { |b| b.frm.link(:text=>"Reset Score Values").click }
480
+ link("Reset Score Values")
505
481
 
506
482
  action(:remove_last_answer) { |b| b.frm.link(:text=>"Remove", :index=>-1).click }
507
483
 
@@ -772,7 +748,7 @@ class BeginAssessment < BasePage
772
748
 
773
749
  frame_element
774
750
 
775
- action(:begin_assessment) { |b| b.frm.button(:value=>"Begin Assessment").click }
751
+ button("Begin Assessment")
776
752
 
777
753
  value(:assessment_introduction) { |b| b.frm.div(:class=>"assessmentIntroduction").text }
778
754
 
@@ -817,8 +793,7 @@ class TakeAssessment < AssessmentsBase
817
793
  # Clicks the Next button and instantiates the BeginAssessment Class.
818
794
  action(:next) { |b| b.frm.button(:value=>"Next").click }
819
795
 
820
- # Clicks the Submit for Grading button and instantiates the ConfirmSubmission Class.
821
- action(:submit_for_grading){ |b| b.frm.button(:value=>"Submit for Grading").click }
796
+ button("Submit for Grading")
822
797
 
823
798
  end
824
799
 
@@ -828,10 +803,7 @@ class ConfirmSubmission < AssessmentsBase
828
803
 
829
804
  # Clicks the Submit for Grading button and instantiates
830
805
  # the SubmissionSummary Class.
831
- def submit_for_grading
832
- frm.button(:value=>"Submit for Grading").click
833
- SubmissionSummary.new(@browser)
834
- end
806
+ button("Submit for Grading")
835
807
 
836
808
  value(:validation) { |b| b.frm.span(:class=>"validation").text }
837
809
 
@@ -840,12 +812,7 @@ end
840
812
  # The summary page that appears when an Assessment has been submitted.
841
813
  class SubmissionSummary < AssessmentsBase
842
814
 
843
- # Clicks the Continue button and instantiates
844
- # the TakeAssessmentList Class.
845
- def continue
846
- frm.button(:value=>"Continue").click
847
- TakeAssessmentList.new(@browser)
848
- end
815
+ button("Continue")
849
816
 
850
817
  value(:summary_info) { |b| b.frm.div(:class=>"tier1").text }
851
818
 
@@ -526,7 +526,7 @@ class AssignmentSubmission < BasePage
526
526
 
527
527
  # Clicks the Return to List button, then instantiates the
528
528
  # AssignmentSubmissionList Class.
529
- action(:return_to_list) { |b| b.frm.button(:value=>"Return to List").click }
529
+ button("Return to List")
530
530
 
531
531
  element(:grade) { |b| b.frm.select(:name=>"grade_submission_grade") }
532
532
  element(:allow_resubmission) { |b| b.frm.checkbox(:id=>"allowResToggle") }
@@ -7,35 +7,20 @@ class Blogger < BasePage
7
7
 
8
8
  frame_element
9
9
 
10
- # Clicks the View All button, then reinstantiates the Class.
11
- def view_all
12
- frm.link(:text=>"View all").click
13
- Blogger.new(@browser)
14
- end
10
+ link "View all"
15
11
 
16
- # Clicks the View Members Blog link, then instantiates the
17
- # ViewMembersBlog Class.
18
- def view_members_blog
19
- frm.link(:text=>"View member's blog").click
20
- ViewMembersBlog.new(@browser)
21
- end
12
+ link "View member's blog"
22
13
 
23
14
  # Returns true if the specified post title exists in the list. Otherwise returns false.
24
15
  def post_private?(post_title)
25
16
  frm.table(:class=>"tableHeader").row(:text=>/#{Regexp.escape(post_title)}/).image(:alt=>"p").exist?
26
17
  end
27
18
 
28
- # Clicks the Create New Post link and instantiates the CreateBloggerPost Class.
29
- def create_new_post
30
- frm.link(:text=>"Create new post").click
31
- CreateBloggerPost.new(@browser)
32
- end
19
+ link "Create new post"
20
+
33
21
  # Clicks on the specified post title, then instantiates
34
22
  # the ViewBloggerPost Class.
35
- def open_post(post_title)
36
- frm.link(:text=>post_title).click
37
- ViewBloggerPost.new(@browser)
38
- end
23
+ action(:open_post) { |post_title, b| b.frm.link(:text=>post_title).click }
39
24
 
40
25
  # Returns an array containing the displayed post titles (as string objects).
41
26
  def post_titles
@@ -65,16 +50,14 @@ class ViewMembersBlog < BasePage
65
50
  # Clicks on the member name specified.
66
51
  # The name string obviously needs to match the
67
52
  # text of the link exactly.
68
- def member(name)
69
- frm.link(:text=>name).click
70
- Blogger.new(@browser)
71
- end
53
+ action(:member) { |name, b| b.frm.link(:text=>name).click }
72
54
 
73
55
  end
74
56
 
75
57
  # The page where users create a Post for their Blogger blog.
76
58
  class CreateBloggerPost < BasePage
77
59
 
60
+ include FCKEditor
78
61
  frame_element
79
62
 
80
63
  # Enters the specified string into the FCKEditor for the Abstract.
@@ -89,31 +72,22 @@ class CreateBloggerPost < BasePage
89
72
 
90
73
  # Clicks the Add to document button in the text
91
74
  # tab.
92
- def add_text_to_document
93
- frm.div(:id=>"PostForm:tab0").button(:value=>"Add to document").click
94
- end
75
+ action(:add_text_to_document) { |b| b.frm.div(:id=>"PostForm:tab0").button(:value=>"Add to document").click }
95
76
 
96
77
  # Clicks the Add to Document button on the Image tab.
97
78
  #
98
79
  # This method will fail if the image tab is not the currently selected tab.
99
- def add_image_to_document
100
- frm.div(:id=>"PostForm:tab1").button(:value=>"Add to document").click
101
- end
80
+ action(:add_image_to_document) { |b| b.frm.div(:id=>"PostForm:tab1").button(:value=>"Add to document").click }
102
81
 
103
82
  # Clicks the Add to Document button on the Link tab.
104
83
  #
105
84
  # This method will fail if the Link tab is not the currently selected tab.
106
- def add_link_to_document
107
- frm.div(:id=>"PostForm:tab2").button(:value=>"Add to document").click
108
- end
85
+ action(:add_link_to_document) { |b| b.frm.div(:id=>"PostForm:tab2").button(:value=>"Add to document").click }
109
86
 
110
87
  # Clicks the Add to Document button on the File tab.
111
88
  #
112
89
  # This method will fail if the File tab is not the currently selected tab.
113
- def add_file_to_document
114
- frm.div(:id=>"PostForm:tab3").button(:value=>"Add to document").click
115
- end
116
-
90
+ action(:add_file_to_document) { |b| b.frm.div(:id=>"PostForm:tab3").button(:value=>"Add to document").click }
117
91
  # Enters the specified filename in the file field for images.
118
92
  #
119
93
  # The file path can be entered as an optional second parameter.
@@ -126,29 +100,20 @@ class CreateBloggerPost < BasePage
126
100
  frm().file_field(:name=>"PostForm:tab3:_id51").set(filepath + filename)
127
101
  end
128
102
 
129
- # Clicks the Preview button and instantiates the PreviewBloggerPost Class.
130
- def preview
131
- frm().button(:value=>"Preview").click
132
- PreviewBloggerPost.new(@browser)
133
- end
134
-
135
- # Clicks the Save button and instantiates the Blogger Class.
136
- def save
137
- frm.button(:value=>"Save").click
138
- Blogger.new(@browser)
139
- end
103
+ button "Preview"
104
+ button "Save"
140
105
 
141
106
  element(:title) { |b| b.frm.text_field(:id=>"PostForm:idTitle") }
142
107
  element(:keywords) { |b| b.frm.text_field(:id=>"PostForm:keyWords") }
143
108
  element(:access) { |b| b.frm.select(:id=>"PostForm:selectVisibility") }
144
109
  element(:read_only) { |b| b.frm.checkbox(:id=>"PostForm:readOnlyCheckBox") }
145
110
  element(:allow_comments) { |b| b.frm.checkbox(:id=>"PostForm:allowCommentsCheckBox") }
146
- action(:text) { |b| b.frm.button(:value=>"Text").click }
147
- action(:images) { |b| b.frm.button(:value=>"Images").click }
148
- action(:links) { |b| b.frm.button(:value=>"Links").click }
111
+ button "Text"
112
+ button "Images"
113
+ button "Links"
149
114
  element(:description) { |b| b.frm.text_field(:id=>"PostForm:tab2:idLinkDescription") }
150
115
  element(:url) { |b| b.frm.text_field(:id=>"PostForm:tab2:idLinkExpression") }
151
- action(:files) { |b| b.frm.button(:value=>"Files").click }
116
+ button "Files"
152
117
 
153
118
  end
154
119
 
@@ -156,18 +121,7 @@ end
156
121
  class PreviewBloggerPost < BasePage
157
122
 
158
123
  frame_element
159
-
160
- # Clicks the Back button and instantiates the CreateBloggerPost Class.
161
- def back
162
- frm().button(:value=>"Back").click
163
- CreateBloggerPost.new(@browser)
164
- end
165
-
166
- # Clicks the Save button and instantiates the CreateBloggerPost Class.
167
- def save
168
- frm.button(:value=>"Save").click
169
- CreateBloggerPost.new(@browser)
170
- end
124
+ basic_page_elements
171
125
 
172
126
  end
173
127
 
@@ -176,26 +130,16 @@ class ViewBloggerPost < BasePage
176
130
 
177
131
  frame_element
178
132
 
179
- # Clicks the button for adding a comment to a blog post, then
180
- # instantiates the AddBloggerComment Class.
181
- def add_comment
182
- frm.button(:value=>"Add comment").click
183
- AddBloggerComment.new(@browser)
184
- end
133
+ button "Add comment"
185
134
 
186
135
  end
187
136
 
188
137
  # The page for adding a comment to a Blog post.
189
138
  class AddBloggerComment < BasePage
190
139
 
140
+ include FCKEditor
191
141
  frame_element
192
-
193
- # Clicks the Save button and instantiates
194
- # The ViewBloggerPost Class.
195
- def save
196
- frm.button(:value=>"Save").click
197
- ViewBloggerPost.new(@browser)
198
- end
142
+ basic_page_elements
199
143
 
200
144
  # Enters the specified string into the FCKEditor box for the Comment.
201
145
  def your_comment=(text)
@@ -5,7 +5,7 @@ class BlogsBase < BasePage
5
5
  class << self
6
6
  def menu_elements
7
7
  # AddBlogEntry
8
- action(:add_blog_entry) { |b| b.frm.link(:text=>"Add blog entry").click }
8
+ link "Add blog entry"
9
9
  end
10
10
  end
11
11
  end
@@ -41,10 +41,8 @@ class AddBlogEntry < BlogsBase
41
41
  editor.td(:id, "xEditingArea").frame(:index=>0).send_keys(text)
42
42
  end
43
43
 
44
- # BlogsList
45
- action(:publish_entry) { |b| b.frm.button(:value=>"Publish entry").click }
46
- # BlogsList
47
- action(:save_draft){ |b| b.frm.button(:value=>"Save Draft").click }
44
+ button "Publish entry"
45
+ button "Save Draft"
48
46
 
49
47
  element(:title) { |b| b.frm.text_field(:name=>"title-input") }
50
48
  element(:only_site_admins) { |b| b.frm.radio(:id=>"instructors-only-radio") }
@@ -9,12 +9,14 @@ class CalendarBase < BasePage
9
9
  action(:add_event) { |b| b.frm.link(:text=>"Add").click }
10
10
 
11
11
  # AddEditFields
12
- action(:fields) { |b| b.frm.link(:text=>"Fields").click }
12
+ link "Fields"
13
13
 
14
14
  # ImportStepOne
15
- action(:import) { |b| b.frm.link(:text=>"Import").click }
15
+ link "Import"
16
16
 
17
- #TODO: Finish adding menu buttons here
17
+ link "Merge"
18
+ link "Subscriptions (import)"
19
+ link "Permissions"
18
20
  end
19
21
  end
20
22
 
@@ -74,9 +76,7 @@ class Calendar < CalendarBase
74
76
  # ObsoleteElement error.
75
77
  action(:filter_events) { |b| b.frm.button(:name=>"eventSubmit_doCustomdate").click }
76
78
 
77
- # Clicks the Go to Today button, then reinstantiates
78
- # the Calendar class.
79
- action(:go_to_today) { |b| b.frm.button(:value=>"Go to Today").click }
79
+ button "Go to Today"
80
80
 
81
81
  # Returns an array for the listed events.
82
82
  # This array contains more than simply strings of the event titles, because
@@ -117,15 +117,10 @@ class Calendar < CalendarBase
117
117
  # errors.
118
118
  action(:next) { |b| b.frm.button(:name=>"eventSubmit_doNext").click }
119
119
 
120
- # Clicks the "Today" button and reinstantiates the class.
121
- action(:today) { |b| b.frm.button(:value=>"Today").click }
122
-
123
- action(:earlier) { |b| b.frm.link(:text=>"Earlier").click }
124
-
125
- action(:later) { |b| b.frm.link(:text=>"Later").click }
126
-
127
- # Clicks the "Set as Default View" button
128
- action(:set_as_default_view) { |b| b.frm.link(:text=>"Set as Default View").click }
120
+ button "Today"
121
+ button "Earlier"
122
+ button "Later"
123
+ button "Set as Default View"
129
124
 
130
125
  end
131
126
 
@@ -133,11 +128,8 @@ end
133
128
  class EventDetail < CalendarBase
134
129
 
135
130
  menu_elements
136
- # Clicks the Go to Today button, then instantiates
137
- # the Calendar class.
138
- action(:go_to_today) { |b| b.frm.button(:value=>"Go to Today").click }
139
-
140
- action(:back_to_calendar) { |b| b.frm.button(:value=>"Back to Calendar").click }
131
+ button "Go to Today"
132
+ button "Back to Calendar"
141
133
 
142
134
  action(:last_event) { |b| b.frm().button(:value=>"< Last Event").click }
143
135
 
@@ -145,9 +137,8 @@ class EventDetail < CalendarBase
145
137
 
146
138
  value(:event_title) { |b| b.frm.div(:class=>"portletBody").h3.text }
147
139
 
148
- action(:edit) { |b| b.frm.button(:value=>"Edit").click }
149
-
150
- action(:remove_event) { |b| b.frm.button(:value=>"Remove event").click }
140
+ button "Edit"
141
+ button "Remove event"
151
142
 
152
143
  # Returns a hash object containing the contents of the event details
153
144
  # table on the page, with each of the header column items as a Key
@@ -186,9 +177,8 @@ class AddEditEvent < CalendarBase
186
177
 
187
178
  action(:frequency) { |b| b.frm.button(:name=>"eventSubmit_doEditfrequency").click }
188
179
 
189
- action(:add_attachments) { |b| b.frm.button(:value=>"Add Attachments").click }
190
-
191
- action(:add_remove_attachments) { |b| b.frm.button(:value=>"Add/remove attachments").click }
180
+ button "Add Attachments"
181
+ button "Add/remove attachments"
192
182
 
193
183
  # Returns true if the page has a link with the
194
184
  # specified file name. Use for test case asserts.
@@ -200,9 +190,7 @@ class AddEditEvent < CalendarBase
200
190
  # on the page. The "field" variable is the name of the
201
191
  # field, while the "text" is the string you want to put into
202
192
  # it.
203
- def custom_field_text(field, text)
204
- frm.text_field(:name=>field).set(text)
205
- end
193
+ action(:custom_field) { |field, b| b.frm.text_field(:name=>field) }
206
194
 
207
195
  element(:title) { |b| b.frm.text_field(:id=>"activitytitle") }
208
196
  element(:month) { |b| b.frm.select(:id=>"month") }
@@ -250,9 +238,7 @@ class AddEditFields < CalendarBase
250
238
  action(:create_field) { |b| b.frm.button(:value=>"Create Field").click }
251
239
 
252
240
  # Checks the checkbox for the specified field
253
- def check_remove(field_name)
254
- frm.table(:class=>/listHier lines/).row(:text=>/#{Regexp.escape(field_name)}/).checkbox.set
255
- end
241
+ action(:check_remove) { |field_name, b| b.frm.table(:class=>/listHier lines/).row(:text=>/#{Regexp.escape(field_name)}/).checkbox.set }
256
242
 
257
243
  element(:field_name) { |b| b.frm.text_field(:id=>"textfield") }
258
244
 
@@ -274,7 +260,7 @@ class ImportStepTwo < BasePage
274
260
  frame_element
275
261
 
276
262
  # Goes to ImportStepThree
277
- action(:continue) { |b| b.frm.button(:value=>"Continue").click }
263
+ button "Continue"
278
264
 
279
265
  # Enters the specified filename in the file field.
280
266
  #
@@ -293,7 +279,7 @@ class ImportStepThree < BasePage
293
279
  expected_element :import_events_for_site
294
280
 
295
281
  # Goes to Calendar
296
- action(:import_events) { |b| b.frm.button(:value=>"Import Events").click }
282
+ button "Import Events"
297
283
 
298
284
  # Returns an array containing the list of Activity names on the page.
299
285
  def events
@@ -313,14 +299,10 @@ class ImportStepThree < BasePage
313
299
  end
314
300
 
315
301
  # Returns the date of the specified event
316
- def event_date(event_name)
317
- frm.table(:class=>/listHier lines/).row(:text=>/#{Regexp.escape(event_name)}/)[0].text
318
- end
302
+ action(:event_date) { |event_name, b| b.frm.table(:class=>/listHier lines/).row(:text=>/#{Regexp.escape(event_name)}/)[0].text }
319
303
 
320
304
  # Unchecks the checkbox for the specified event
321
- def uncheck_event(event_name)
322
- frm.table(:class=>/listHier lines/).row(:text=>/#{Regexp.escape(event_name)}/)
323
- end
305
+ action(:uncheck_event) { |event_name, b| b.frm.table(:class=>/listHier lines/).row(:text=>/#{Regexp.escape(event_name)}/).checkbox.clear }
324
306
 
325
307
  element(:import_events_for_site) { |b| b.frm.radio(:id=>"site") }
326
308
  element(:import_events_for_selected_groups) { |b| b.frm.radio(:id=>"groups") }