sakai-cle-test-api 0.0.75 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (101) hide show
  1. data/lib/sakai-cle-test-api.rb +4 -5
  2. data/lib/sakai-cle-test-api/base_page.rb +20 -0
  3. data/lib/sakai-cle-test-api/core-ext.rb +90 -0
  4. data/lib/sakai-cle-test-api/data_objects/announcement.rb +81 -0
  5. data/lib/sakai-cle-test-api/data_objects/assessment.rb +32 -0
  6. data/lib/sakai-cle-test-api/data_objects/assignment.rb +90 -0
  7. data/lib/sakai-cle-test-api/data_objects/event.rb +89 -0
  8. data/lib/sakai-cle-test-api/data_objects/lesson.rb +185 -0
  9. data/lib/sakai-cle-test-api/data_objects/resource.rb +209 -0
  10. data/lib/sakai-cle-test-api/data_objects/site.rb +208 -0
  11. data/lib/sakai-cle-test-api/data_objects/syllabus.rb +39 -0
  12. data/lib/sakai-cle-test-api/data_objects/web_content_tool.rb +51 -0
  13. data/lib/sakai-cle-test-api/data_objects/wiki.rb +53 -0
  14. data/lib/sakai-cle-test-api/gem_ext.rb +23 -0
  15. data/lib/sakai-cle-test-api/page_helper.rb +22 -0
  16. data/lib/sakai-cle-test-api/page_maker.rb +48 -0
  17. data/lib/sakai-cle-test-api/page_objects/account.rb +111 -0
  18. data/lib/sakai-cle-test-api/page_objects/aliases.rb +43 -0
  19. data/lib/sakai-cle-test-api/page_objects/announcements.rb +190 -0
  20. data/lib/sakai-cle-test-api/page_objects/assessments.rb +874 -0
  21. data/lib/sakai-cle-test-api/page_objects/assignments.rb +771 -0
  22. data/lib/sakai-cle-test-api/page_objects/basic_lti.rb +6 -0
  23. data/lib/sakai-cle-test-api/page_objects/blogger.rb +205 -0
  24. data/lib/sakai-cle-test-api/page_objects/blogs.rb +60 -0
  25. data/lib/sakai-cle-test-api/page_objects/calendar.rb +431 -0
  26. data/lib/sakai-cle-test-api/page_objects/calendar_summary.rb +1 -0
  27. data/lib/sakai-cle-test-api/page_objects/chat_room.rb +12 -0
  28. data/lib/sakai-cle-test-api/page_objects/drop_box.rb +9 -0
  29. data/lib/sakai-cle-test-api/page_objects/email_archive.rb +22 -0
  30. data/lib/sakai-cle-test-api/page_objects/evaluations.rb +158 -0
  31. data/lib/sakai-cle-test-api/page_objects/feedback.rb +36 -0
  32. data/lib/sakai-cle-test-api/page_objects/forms.rb +120 -0
  33. data/lib/sakai-cle-test-api/page_objects/forums.rb +289 -0
  34. data/lib/sakai-cle-test-api/page_objects/glossary.rb +117 -0
  35. data/lib/sakai-cle-test-api/page_objects/gradebook.rb +29 -0
  36. data/lib/sakai-cle-test-api/page_objects/gradebook2.rb +17 -0
  37. data/lib/sakai-cle-test-api/page_objects/home.rb +36 -0
  38. data/lib/sakai-cle-test-api/page_objects/jforums.rb +444 -0
  39. data/lib/sakai-cle-test-api/page_objects/job_scheduler.rb +121 -0
  40. data/lib/sakai-cle-test-api/page_objects/lessons.rb +360 -0
  41. data/lib/sakai-cle-test-api/page_objects/login.rb +28 -0
  42. data/lib/sakai-cle-test-api/page_objects/matrix.rb +241 -0
  43. data/lib/sakai-cle-test-api/page_objects/media_gallery.rb +13 -0
  44. data/lib/sakai-cle-test-api/page_objects/messages.rb +622 -0
  45. data/lib/sakai-cle-test-api/page_objects/my_workspace.rb +44 -0
  46. data/lib/sakai-cle-test-api/page_objects/news.rb +8 -0
  47. data/lib/sakai-cle-test-api/page_objects/podcasts.rb +27 -0
  48. data/lib/sakai-cle-test-api/page_objects/polls.rb +69 -0
  49. data/lib/sakai-cle-test-api/page_objects/portfolio_templates.rb +161 -0
  50. data/lib/sakai-cle-test-api/page_objects/portfolios.rb +162 -0
  51. data/lib/sakai-cle-test-api/page_objects/post_em.rb +1 -0
  52. data/lib/sakai-cle-test-api/page_objects/profile.rb +51 -0
  53. data/lib/sakai-cle-test-api/page_objects/profile2.rb +344 -0
  54. data/lib/sakai-cle-test-api/page_objects/public_search.rb +61 -0
  55. data/lib/sakai-cle-test-api/page_objects/realms.rb +19 -0
  56. data/lib/sakai-cle-test-api/page_objects/resources.rb +326 -0
  57. data/lib/sakai-cle-test-api/{resources_roster.rb → page_objects/resources_roster.rb} +0 -0
  58. data/lib/sakai-cle-test-api/page_objects/rosters.rb +70 -0
  59. data/lib/sakai-cle-test-api/page_objects/rwiki.rb +34 -0
  60. data/lib/sakai-cle-test-api/page_objects/search.rb +34 -0
  61. data/lib/sakai-cle-test-api/page_objects/sections.rb +295 -0
  62. data/lib/sakai-cle-test-api/page_objects/single_user.rb +1 -0
  63. data/lib/sakai-cle-test-api/page_objects/site_setup.rb +686 -0
  64. data/lib/sakai-cle-test-api/page_objects/site_statistics.rb +1 -0
  65. data/lib/sakai-cle-test-api/page_objects/sites.rb +255 -0
  66. data/lib/sakai-cle-test-api/page_objects/styles.rb +74 -0
  67. data/lib/sakai-cle-test-api/page_objects/syllabus.rb +166 -0
  68. data/lib/sakai-cle-test-api/page_objects/user_membership.rb +57 -0
  69. data/lib/sakai-cle-test-api/page_objects/users.rb +88 -0
  70. data/lib/sakai-cle-test-api/rich_text.rb +27 -0
  71. data/lib/sakai-cle-test-api/utilities.rb +260 -0
  72. data/lib/sakai-cle-test-api/workflows.rb +224 -0
  73. data/sakai-cle-test-api.gemspec +3 -5
  74. metadata +74 -64
  75. data/lib/sakai-cle-test-api/admin_page_elements.rb +0 -1030
  76. data/lib/sakai-cle-test-api/announcements.rb +0 -59
  77. data/lib/sakai-cle-test-api/assessments.rb +0 -194
  78. data/lib/sakai-cle-test-api/assignments.rb +0 -113
  79. data/lib/sakai-cle-test-api/basic_lti.rb +0 -5
  80. data/lib/sakai-cle-test-api/blogs.rb +0 -5
  81. data/lib/sakai-cle-test-api/calendar.rb +0 -65
  82. data/lib/sakai-cle-test-api/calendar_summary.rb +0 -0
  83. data/lib/sakai-cle-test-api/common_page_elements.rb +0 -1228
  84. data/lib/sakai-cle-test-api/drop_box.rb +0 -0
  85. data/lib/sakai-cle-test-api/email_archive.rb +0 -10
  86. data/lib/sakai-cle-test-api/forums.rb +0 -39
  87. data/lib/sakai-cle-test-api/gradebook.rb +0 -10
  88. data/lib/sakai-cle-test-api/gradebook2.rb +0 -6
  89. data/lib/sakai-cle-test-api/messages.rb +0 -119
  90. data/lib/sakai-cle-test-api/news.rb +0 -9
  91. data/lib/sakai-cle-test-api/polls.rb +0 -24
  92. data/lib/sakai-cle-test-api/post_em.rb +0 -0
  93. data/lib/sakai-cle-test-api/profile.rb +0 -17
  94. data/lib/sakai-cle-test-api/profile2.rb +0 -43
  95. data/lib/sakai-cle-test-api/rwiki.rb +0 -0
  96. data/lib/sakai-cle-test-api/sections.rb +0 -47
  97. data/lib/sakai-cle-test-api/single_user.rb +0 -0
  98. data/lib/sakai-cle-test-api/site_page_elements.rb +0 -2350
  99. data/lib/sakai-cle-test-api/site_statistics.rb +0 -0
  100. data/lib/sakai-cle-test-api/syllabus.rb +0 -77
  101. data/lib/sakai-cle-test-api/tools_menu.rb +0 -415
@@ -0,0 +1,6 @@
1
+ #
2
+ class BasicLTI < BasePage
3
+
4
+ frame_element
5
+
6
+ end
@@ -0,0 +1,205 @@
1
+ #================
2
+ # Blogger Pages
3
+ #================
4
+
5
+ # The top page of a Site's Blogger feature.
6
+ class Blogger < BasePage
7
+
8
+ frame_element
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
15
+
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
22
+
23
+ # Returns true if the specified post title exists in the list. Otherwise returns false.
24
+ def post_private?(post_title)
25
+ frm.table(:class=>"tableHeader").row(:text=>/#{Regexp.escape(post_title)}/).image(:alt=>"p").exist?
26
+ end
27
+
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
33
+ # Clicks on the specified post title, then instantiates
34
+ # the ViewBloggerPost Class.
35
+ def open_post(post_title)
36
+ frm.link(:text=>post_title).click
37
+ ViewBloggerPost.new(@browser)
38
+ end
39
+
40
+ # Returns an array containing the displayed post titles (as string objects).
41
+ def post_titles
42
+ titles = []
43
+ if frm.table(:class=>"tableHeader").exist?
44
+ table = frm.table(:class=>"tableHeader")
45
+ table.rows.each do |row|
46
+ if row.link(:class=>"aTitleHeader").exist?
47
+ titles << row.link(:class=>"aTitleHeader").text
48
+ end
49
+ end
50
+ end
51
+ return titles
52
+ end
53
+
54
+ element(:search_field) { |b| b.frm.text_field(:id=>"_id1:idSearch") }
55
+ element(:show_comments) { |b| b.frm.checkbox(:id=>"_id1:showComments") }
56
+ element(:show_full_content) { |b| b.frm.checkbox(:id=>"_id1:showFullContent") }
57
+
58
+ end
59
+
60
+ # The page showing contents of a user's Blog.
61
+ class ViewMembersBlog < BasePage
62
+
63
+ frame_element
64
+
65
+ # Clicks on the member name specified.
66
+ # The name string obviously needs to match the
67
+ # text of the link exactly.
68
+ def member(name)
69
+ frm.link(:text=>name).click
70
+ Blogger.new(@browser)
71
+ end
72
+
73
+ end
74
+
75
+ # The page where users create a Post for their Blogger blog.
76
+ class CreateBloggerPost < BasePage
77
+
78
+ frame_element
79
+
80
+ # Enters the specified string into the FCKEditor for the Abstract.
81
+ def abstract=(text)
82
+ frm.frame(:id, "PostForm:shortTextBox_inputRichText___Frame").td(:id, "xEditingArea").frame(:index=>0).send_keys(text)
83
+ end
84
+
85
+ # Enters the specified string into the FCKEditor for the Text of the Blog.
86
+ def text=(text)
87
+ frm().frame(:id, "PostForm:tab0:main_text_inputRichText___Frame").td(:id, "xEditingArea").frame(:index=>0).send_keys(text)
88
+ end
89
+
90
+ # Clicks the Add to document button in the text
91
+ # tab.
92
+ def add_text_to_document
93
+ frm.div(:id=>"PostForm:tab0").button(:value=>"Add to document").click
94
+ end
95
+
96
+ # Clicks the Add to Document button on the Image tab.
97
+ #
98
+ # 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
102
+
103
+ # Clicks the Add to Document button on the Link tab.
104
+ #
105
+ # 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
109
+
110
+ # Clicks the Add to Document button on the File tab.
111
+ #
112
+ # 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
+
117
+ # Enters the specified filename in the file field for images.
118
+ #
119
+ # The file path can be entered as an optional second parameter.
120
+ def image_file(filename, filepath="")
121
+ frm.file_field(:name=>"PostForm:tab1:_id29").set(filepath + filename)
122
+ end
123
+
124
+ # Enters the specified directory/filename in the file field.
125
+ def file_field(filename, filepath="")
126
+ frm().file_field(:name=>"PostForm:tab3:_id51").set(filepath + filename)
127
+ end
128
+
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
140
+
141
+ element(:title) { |b| b.frm.text_field(:id=>"PostForm:idTitle") }
142
+ element(:keywords) { |b| b.frm.text_field(:id=>"PostForm:keyWords") }
143
+ element(:access) { |b| b.frm.select(:id=>"PostForm:selectVisibility") }
144
+ element(:read_only) { |b| b.frm.checkbox(:id=>"PostForm:readOnlyCheckBox") }
145
+ 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 }
149
+ element(:description) { |b| b.frm.text_field(:id=>"PostForm:tab2:idLinkDescription") }
150
+ element(:url) { |b| b.frm.text_field(:id=>"PostForm:tab2:idLinkExpression") }
151
+ action(:files) { |b| b.frm.button(:value=>"Files").click }
152
+
153
+ end
154
+
155
+ # The Preview page for a Blog post.
156
+ class PreviewBloggerPost < BasePage
157
+
158
+ 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
171
+
172
+ end
173
+
174
+ # The page for Viewing a blog post.
175
+ class ViewBloggerPost < BasePage
176
+
177
+ frame_element
178
+
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
185
+
186
+ end
187
+
188
+ # The page for adding a comment to a Blog post.
189
+ class AddBloggerComment < BasePage
190
+
191
+ 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
199
+
200
+ # Enters the specified string into the FCKEditor box for the Comment.
201
+ def your_comment=(text)
202
+ frm.frame(:id, "_id1:_id11_inputRichText___Frame").td(:id, "xEditingArea").frame(:index=>0).send_keys(text)
203
+ end
204
+
205
+ end
@@ -0,0 +1,60 @@
1
+ class BlogsBase < BasePage
2
+
3
+ frame_element
4
+
5
+ class << self
6
+ def menu_elements
7
+ # AddBlogEntry
8
+ action(:add_blog_entry) { |b| b.frm.link(:text=>"Add blog entry").click }
9
+ end
10
+ end
11
+ end
12
+
13
+ class Blogs < BlogsBase
14
+
15
+ menu_elements
16
+
17
+ # Returns an array containing the list of Bloggers
18
+ # in the "All the blogs" table.
19
+ def blogger_list
20
+ bloggers = []
21
+ frm.table(:class=>"listHier lines").rows.each do |row|
22
+ bloggers << row[1].text
23
+ end
24
+ bloggers.delete_at(0)
25
+ return bloggers
26
+ end
27
+ end
28
+
29
+ class AddBlogEntry < BlogsBase
30
+
31
+ menu_elements
32
+
33
+ include FCKEditor
34
+
35
+ expected_element :editor
36
+
37
+ element(:editor) { |b| b.frm.frame(:id, "blog-text-input:1:input___Frame") }
38
+
39
+ def blog_text=(text)
40
+ editor.td(:id, "xEditingArea").frame(:index=>0).wait_until_present
41
+ editor.td(:id, "xEditingArea").frame(:index=>0).send_keys(text)
42
+ end
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 }
48
+
49
+ element(:title) { |b| b.frm.text_field(:name=>"title-input") }
50
+ element(:only_site_admins) { |b| b.frm.radio(:id=>"instructors-only-radio") }
51
+ element(:all_members) { |b| b.frm.radio(:id=>"all-members-radio") }
52
+ element(:publicly_viewable) { |b| b.frm.radio(:id=>"public-viewable-radio") }
53
+
54
+ end
55
+
56
+ class BlogsList < BlogsBase
57
+
58
+ menu_elements
59
+
60
+ end
@@ -0,0 +1,431 @@
1
+ class CalendarBase < BasePage
2
+
3
+ frame_element
4
+ basic_page_elements
5
+
6
+ class << self
7
+ def menu_elements
8
+ # AddEditEvent
9
+ action(:add_event) { |b| b.frm.link(:text=>"Add").click }
10
+
11
+ # AddEditFields
12
+ action(:fields) { |b| b.frm.link(:text=>"Fields").click }
13
+
14
+ # ImportStepOne
15
+ action(:import) { |b| b.frm.link(:text=>"Import").click }
16
+ end
17
+ end
18
+
19
+ end
20
+
21
+ # Top page of the Calendar
22
+ # For now it includes all views, though that probably
23
+ # means it will have to be re-instantiated every time
24
+ # a new view is selected.
25
+ class Calendar < CalendarBase
26
+
27
+ menu_elements
28
+
29
+ # Selects the specified item in the View select list,
30
+ # then reinstantiates the Class.
31
+ def select_view(item)
32
+ frm.select(:id=>"view").select(item)
33
+ end
34
+
35
+ # Selects the specified item in the View select list.
36
+ # This is the same method as the select_view method, except
37
+ # that it does not reinstantiate the class. Use this if you're
38
+ # not concerned about throwing obsolete element errors when
39
+ # the page updates.
40
+ def view=(item)
41
+ frm.select(:id=>"view").select(item)
42
+ end
43
+
44
+ # Selects the specified item in the Show select list.
45
+ def show=(item)
46
+ frm.select(:id=>"timeFilterOption").select(item)
47
+ end
48
+
49
+ # Clicks the link to the specified event, then
50
+ # instantiates the EventDetail class.
51
+ def open_event(title)
52
+ truncated = title[0..5]
53
+ frm.link(:text=>/#{Regexp.escape(truncated)}/).click
54
+ EventDetail.new(@browser)
55
+ end
56
+
57
+ # Returns the href value of the target link
58
+ # use for validation when you are testing whether the link
59
+ # will appear again on another screen, since often times
60
+ # validation by title text alone will not work.
61
+ def event_href(title)
62
+ truncated = title[0..5]
63
+ return frm.link(:text=>/#{Regexp.escape(truncated)}/).href
64
+ end
65
+
66
+ def show_events=(item)
67
+ frm.select(:id=>"timeFilterOption").select(item)
68
+ end
69
+
70
+ # Selects the specified value in the start month select list.
71
+ def start_month=(item)
72
+ frm.select(:id=>"customStartMonth").select(item)
73
+ end
74
+
75
+ # Selects the specified value in the start day select list.
76
+ def start_day=(item)
77
+ frm.select(:id=>"customStartDay").select(item)
78
+ end
79
+
80
+ # Selects the specified value in the start year select list.
81
+ def start_year=(item)
82
+ frm.select(:id=>"customStartYear").select(item)
83
+ end
84
+
85
+ # Selects the specified value in the end month select list.
86
+ def end_month=(item)
87
+ frm.select(:id=>"customEndMonth").select(item)
88
+ end
89
+
90
+ # Selects the specified value in the End Day select list.
91
+ def end_day=(item)
92
+ frm.select(:id=>"customEndDay").select(item)
93
+ end
94
+
95
+ # Selects the specified value in the End Year select list.
96
+ def end_year=(item)
97
+ frm.select(:id=>"customEndYear").select(item)
98
+ end
99
+
100
+ # Clicks the Filter Events button, then re-instantiates
101
+ # the Calendar class to avoid the possibility of an
102
+ # ObsoleteElement error.
103
+ def filter_events
104
+ frm.button(:name=>"eventSubmit_doCustomdate").click
105
+ Calendar.new(@browser)
106
+ end
107
+
108
+ # Clicks the Go to Today button, then reinstantiates
109
+ # the Calendar class.
110
+ def go_to_today
111
+ frm.button(:value=>"Go to Today").click
112
+ Calendar.new(@browser)
113
+ end
114
+
115
+ # Returns an array of the titles of the displayed events.
116
+ def event_list
117
+ events_list
118
+ end
119
+
120
+ # Returns an array for the listed events.
121
+ # This array contains more than simply strings of the event titles, because
122
+ # often the titles are truncated to fit on the screen. In addition, getting the "title"
123
+ # tag of the link is often problematic because titles can contain double-quotes, which
124
+ # will mess up the HTML of the anchor tag (there is probably an XSS vulnerability to
125
+ # exploit, there. This should be extensively tested.).
126
+ #
127
+ # Because of these issues, the array contains the title tag, the anchor text, and
128
+ # the entire href string for every event listed on the page. Having all three items
129
+ # available should ensure that verification steps don't give false results--especially
130
+ # when you are doing a negative test (checking that an event is NOT present).
131
+ def events_list
132
+ list = []
133
+ if frm.table(:class=>"calendar").exist?
134
+ events_table = frm.table(:class=>"calendar")
135
+ else
136
+ events_table = frm.table(:class=>"listHier lines nolines")
137
+ end
138
+ events_table.links.each do |link|
139
+ list << link.title
140
+ list << link.text
141
+ list << link.href
142
+ list << link.html[/(?<="location=").+doDescription/]
143
+ end
144
+ list.compact!
145
+ list.uniq!
146
+ return list
147
+ end
148
+
149
+ # Clicks the "Previous X" button, where X might be Day, Week, or Month,
150
+ # then reinstantiates the Calendar class to ensure against any obsolete element
151
+ # errors.
152
+ def previous
153
+ frm.button(:name=>"eventSubmit_doPrev").click
154
+ Calendar.new(@browser)
155
+ end
156
+
157
+ # Clicks the "Next X" button, where X might be Day, Week, or Month,
158
+ # then reinstantiates the Calendar class to ensure against any obsolete element
159
+ # errors.
160
+ def next
161
+ frm.button(:name=>"eventSubmit_doNext").click
162
+ Calendar.new(@browser)
163
+ end
164
+
165
+ # Clicks the "Today" button and reinstantiates the class.
166
+ def today
167
+ frm.button(:value=>"Today").click
168
+ Calendar.new(@browser)
169
+ end
170
+
171
+ def earlier
172
+ frm().link(:text=>"Earlier").click
173
+ Calendar.new(@browser)
174
+ end
175
+
176
+ def later
177
+ frm().link(:text=>"Later").click
178
+ Calendar.new(@browser)
179
+ end
180
+
181
+ # Clicks the "Set as Default View" button
182
+ def set_as_default_view
183
+ frm.link(:text=>"Set as Default View").click
184
+ end
185
+ end
186
+
187
+ # The page that appears when you click on an event in the Calendar
188
+ class EventDetail < CalendarBase
189
+
190
+ menu_elements
191
+ # Clicks the Go to Today button, then instantiates
192
+ # the Calendar class.
193
+ def go_to_today
194
+ frm.button(:value=>"Go to Today").click
195
+ Calendar.new(@browser)
196
+ end
197
+
198
+ def back_to_calendar
199
+ frm.button(:value=>"Back to Calendar").click
200
+ Calendar.new(@browser)
201
+ end
202
+
203
+ def last_event
204
+ frm().button(:value=>"< Last Event").click
205
+ EventDetail.new(@browser)
206
+ end
207
+
208
+ def next_event
209
+ frm().button(:value=>"Next Event >").click
210
+ EventDetail.new(@browser)
211
+ end
212
+
213
+ def event_title
214
+ frm.div(:class=>"portletBody").h3.text
215
+ end
216
+
217
+ def edit
218
+ frm.button(:value=>"Edit").click
219
+ AddEditEvent.new(@browser)
220
+ end
221
+
222
+ def remove_event
223
+ frm.button(:value=>"Remove event").click
224
+ DeleteConfirm.new(@browser)
225
+ end
226
+
227
+ # Returns a hash object containing the contents of the event details
228
+ # table on the page, with each of the header column items as a Key
229
+ # and the associated data column as the corresponding Value.
230
+ def details
231
+ details = {}
232
+ frm.table(:class=>"itemSummary").rows.each do |row|
233
+ details.store(row.th.text, row.td.text)
234
+ end
235
+ return details
236
+ end
237
+
238
+ end
239
+
240
+ #
241
+ class AddEditEvent < CalendarBase
242
+
243
+ include FCKEditor
244
+
245
+ menu_elements
246
+
247
+ expected_element :message_editor
248
+
249
+ # Calendar class
250
+ action(:save_event) { |b| b.frm.button(:value=>"Save Event").click }
251
+
252
+ #
253
+ def message=(text)
254
+ message_editor.send_keys(text)
255
+ end
256
+
257
+ # The FCKEditor object. Use this method to set up a "wait_until_present"
258
+ # step, since sometimes it takes a long time for this object to load.
259
+ element(:message_editor) { |b| b.frm.frame(:id, "description___Frame").td(:id, "xEditingArea").frame(:index=>0) }
260
+
261
+ def frequency
262
+ frm.button(:name=>"eventSubmit_doEditfrequency").click
263
+ EventFrequency.new(@browser)
264
+ end
265
+
266
+ def add_attachments
267
+ frm.button(:value=>"Add Attachments").click
268
+ EventAttach.new(@browser)
269
+ end
270
+
271
+ def add_remove_attachments
272
+ frm.button(:value=>"Add/remove attachments").click
273
+ EventAttach.new(@browser)
274
+ end
275
+
276
+ # Returns true if the page has a link with the
277
+ # specified file name. Use for test case asserts.
278
+ def attachment?(file_name)
279
+ frm.link(:text=>file_name).exist?
280
+ end
281
+
282
+ # Use this method to enter text into custom fields
283
+ # on the page. The "field" variable is the name of the
284
+ # field, while the "text" is the string you want to put into
285
+ # it.
286
+ def custom_field_text(field, text)
287
+ frm.text_field(:name=>field).set(text)
288
+ end
289
+
290
+ element(:title) { |b| b.frm.text_field(:id=>"activitytitle") }
291
+ element(:month) { |b| b.frm.select(:id=>"month") }
292
+ element(:day) { |b| b.frm.select(:id=>"day") }
293
+ element(:year) { |b| b.frm.select(:id=>"yearSelect") }
294
+ element(:start_hour) { |b| b.frm.select(:id=>"startHour") }
295
+ element(:start_minute) { |b| b.frm.select(:id=>"startMinute") }
296
+ element(:start_meridian) { |b| b.frm.select(:id=>"startAmpm") }
297
+ element(:hours) { |b| b.frm.select(:id=>"duHour") }
298
+ element(:minutes) { |b| b.frm.select(:id=>"duMinute") }
299
+ element(:end_hour) { |b| b.frm.select(:id=>"endHour") }
300
+ element(:end_minute) { |b| b.frm.select(:id=>"endMinute") }
301
+ element(:end_meridian) { |b| b.frm.select(:id=>"endAmpm") }
302
+ element(:display_to_site) { |b| b.frm.radio(:id=>"site") }
303
+ element(:event_type) { |b| b.frm.select(:id=>"eventType") }
304
+ element(:location) { |b| b.frm.text_field(:name=>"location") }
305
+
306
+ end
307
+
308
+ # The page that appears when the Frequency button is clicked on the Add/Edit
309
+ # Event page.
310
+ class EventFrequency < CalendarBase
311
+
312
+ def save_frequency
313
+ frm.button(:value=>"Save Frequency").click
314
+ AddEditEvent.new(@browser)
315
+ end
316
+
317
+ def cancel
318
+ frm.button(:value=>"Cancel").click
319
+ AddEditEvent.new(@browser)
320
+ end
321
+
322
+ element(:event_frequency) { |b| b.frm.select(:id=>"frequencySelect") }
323
+ element(:interval) { |b| b.frm.select(:id=>"interval") }
324
+ element(:ends_after) { |b| b.frm.select(:name=>"count") }
325
+ element(:ends_month) { |b| b.frm.select(:id=>"endMonth") }
326
+ element(:ends_day) { |b| b.frm.select(:id=>"endDay") }
327
+ element(:ends_year) { |b| b.frm.select(:id=>"endYear") }
328
+ element(:after) { |b| b.frm.radio(:id=>"count") }
329
+ element(:on) { |b| b.frm.radio(:id=>"till") }
330
+ element(:never) { |b| b.frm.radio(:id=>"never") }
331
+
332
+ end
333
+
334
+ class AddEditFields < CalendarBase
335
+
336
+ # Clicks the Save Field Changes buton and instantiates
337
+ # The Calendar or EventDetail class--unless the Alert Message box appears,
338
+ # in which case it re-instantiates the class.
339
+ def save_field_changes
340
+ frm.button(:value=>"Save Field Changes").click
341
+ if frm.div(:class=>"alertMessage").exist?
342
+ AddEditFields.new(@browser)
343
+ elsif frm.button(:value=>"Back to Calendar").exist?
344
+ EventDetail.new(@browser)
345
+ else
346
+ Calendar.new(@browser)
347
+ end
348
+ end
349
+
350
+ def create_field
351
+ frm.button(:value=>"Create Field").click
352
+ AddEditFields.new(@browser)
353
+ end
354
+
355
+ # Checks the checkbox for the specified field
356
+ def check_remove(field_name)
357
+ frm.table(:class=>/listHier lines/).row(:text=>/#{Regexp.escape(field_name)}/).checkbox.set
358
+ end
359
+
360
+ element(:field_name) { |b| b.frm.text_field(:id=>"textfield") }
361
+
362
+ end
363
+
364
+ class ImportStepOne < BasePage
365
+
366
+ frame_element
367
+
368
+ action(:continue) { |b| bfrm.button(:value=>"Continue").click }
369
+ element(:microsoft_outlook) { |b| b.frm.radio(:id=>"importType_Outlook") }
370
+ element(:meeting_maker) { |b| b.frm.radio(:id=>"importType_MeetingMaker") }
371
+ element(:generic_calendar_import) { |b| b.frm.radio(:id=>"importType_Generic") }
372
+
373
+ end
374
+
375
+ class ImportStepTwo < BasePage
376
+
377
+ frame_element
378
+
379
+ # Goes to ImportStepThree
380
+ action(:continue) { |b| b.frm.button(:value=>"Continue").click }
381
+
382
+ # Enters the specified filename in the file field.
383
+ #
384
+ # Note that the file path is an optional second parameter, if you do not want to
385
+ # include the full path in the filename.
386
+ def import_file(filename, filepath="")
387
+ frm.file_field(:name=>"importFile").set(filepath + filename)
388
+ end
389
+
390
+ end
391
+
392
+ class ImportStepThree < BasePage
393
+
394
+ frame_element
395
+
396
+ expected_element :import_events_for_site
397
+
398
+ # Goes to Calendar
399
+ action(:import_events) { |b| b.frm.button(:value=>"Import Events").click }
400
+
401
+ # Returns an array containing the list of Activity names on the page.
402
+ def events
403
+ list = []
404
+ frm.table(:class=>/listHier lines/).rows.each do |row|
405
+ if row.label(:for=>/eventSelected/).exist?
406
+ list << row.label.text
407
+ end
408
+ end
409
+ names = []
410
+ list.uniq!
411
+ list.each do | item |
412
+ name = item[/(?<=\s).+(?=\s\s\()/]
413
+ names << name
414
+ end
415
+ return names
416
+ end
417
+
418
+ # Returns the date of the specified event
419
+ def event_date(event_name)
420
+ frm.table(:class=>/listHier lines/).row(:text=>/#{Regexp.escape(event_name)}/)[0].text
421
+ end
422
+
423
+ # Unchecks the checkbox for the specified event
424
+ def uncheck_event(event_name)
425
+ frm.table(:class=>/listHier lines/).row(:text=>/#{Regexp.escape(event_name)}/)
426
+ end
427
+
428
+ element(:import_events_for_site) { |b| b.frm.radio(:id=>"site") }
429
+ element(:import_events_for_selected_groups) { |b| b.frm.radio(:id=>"groups") }
430
+
431
+ end