sambal-cle 0.1.3

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 (90) hide show
  1. data/README.md +4 -0
  2. data/lib/sambal-cle/base_page.rb +20 -0
  3. data/lib/sambal-cle/core-ext.rb +90 -0
  4. data/lib/sambal-cle/data_objects/announcement.rb +82 -0
  5. data/lib/sambal-cle/data_objects/assessment.rb +32 -0
  6. data/lib/sambal-cle/data_objects/assignment.rb +205 -0
  7. data/lib/sambal-cle/data_objects/blog.rb +46 -0
  8. data/lib/sambal-cle/data_objects/blogger.rb +49 -0
  9. data/lib/sambal-cle/data_objects/chat_room.rb +54 -0
  10. data/lib/sambal-cle/data_objects/event.rb +89 -0
  11. data/lib/sambal-cle/data_objects/forum.rb +212 -0
  12. data/lib/sambal-cle/data_objects/lesson.rb +185 -0
  13. data/lib/sambal-cle/data_objects/message.rb +57 -0
  14. data/lib/sambal-cle/data_objects/poll.rb +74 -0
  15. data/lib/sambal-cle/data_objects/resource.rb +209 -0
  16. data/lib/sambal-cle/data_objects/site.rb +295 -0
  17. data/lib/sambal-cle/data_objects/syllabus.rb +73 -0
  18. data/lib/sambal-cle/data_objects/web_content_tool.rb +51 -0
  19. data/lib/sambal-cle/data_objects/wiki.rb +63 -0
  20. data/lib/sambal-cle/date_makers.rb +118 -0
  21. data/lib/sambal-cle/gem_ext.rb +23 -0
  22. data/lib/sambal-cle/page_helper.rb +22 -0
  23. data/lib/sambal-cle/page_maker.rb +48 -0
  24. data/lib/sambal-cle/page_objects/account.rb +111 -0
  25. data/lib/sambal-cle/page_objects/aliases.rb +43 -0
  26. data/lib/sambal-cle/page_objects/announcements.rb +190 -0
  27. data/lib/sambal-cle/page_objects/assessments.rb +874 -0
  28. data/lib/sambal-cle/page_objects/assignments.rb +770 -0
  29. data/lib/sambal-cle/page_objects/basic_lti.rb +6 -0
  30. data/lib/sambal-cle/page_objects/blogger.rb +205 -0
  31. data/lib/sambal-cle/page_objects/blogs.rb +60 -0
  32. data/lib/sambal-cle/page_objects/calendar.rb +330 -0
  33. data/lib/sambal-cle/page_objects/calendar_summary.rb +1 -0
  34. data/lib/sambal-cle/page_objects/chat_room.rb +22 -0
  35. data/lib/sambal-cle/page_objects/drop_box.rb +9 -0
  36. data/lib/sambal-cle/page_objects/email_archive.rb +22 -0
  37. data/lib/sambal-cle/page_objects/entity_picker.rb +62 -0
  38. data/lib/sambal-cle/page_objects/evaluations.rb +158 -0
  39. data/lib/sambal-cle/page_objects/feedback.rb +36 -0
  40. data/lib/sambal-cle/page_objects/forms.rb +120 -0
  41. data/lib/sambal-cle/page_objects/forums.rb +254 -0
  42. data/lib/sambal-cle/page_objects/glossary.rb +117 -0
  43. data/lib/sambal-cle/page_objects/gradebook.rb +29 -0
  44. data/lib/sambal-cle/page_objects/gradebook2.rb +17 -0
  45. data/lib/sambal-cle/page_objects/home.rb +36 -0
  46. data/lib/sambal-cle/page_objects/jforums.rb +444 -0
  47. data/lib/sambal-cle/page_objects/job_scheduler.rb +121 -0
  48. data/lib/sambal-cle/page_objects/lessons.rb +361 -0
  49. data/lib/sambal-cle/page_objects/login.rb +28 -0
  50. data/lib/sambal-cle/page_objects/matrix.rb +241 -0
  51. data/lib/sambal-cle/page_objects/media_gallery.rb +13 -0
  52. data/lib/sambal-cle/page_objects/messages.rb +622 -0
  53. data/lib/sambal-cle/page_objects/my_workspace.rb +44 -0
  54. data/lib/sambal-cle/page_objects/news.rb +8 -0
  55. data/lib/sambal-cle/page_objects/podcasts.rb +27 -0
  56. data/lib/sambal-cle/page_objects/polls.rb +69 -0
  57. data/lib/sambal-cle/page_objects/portfolio_templates.rb +161 -0
  58. data/lib/sambal-cle/page_objects/portfolios.rb +162 -0
  59. data/lib/sambal-cle/page_objects/post_em.rb +1 -0
  60. data/lib/sambal-cle/page_objects/profile.rb +51 -0
  61. data/lib/sambal-cle/page_objects/profile2.rb +344 -0
  62. data/lib/sambal-cle/page_objects/public_search.rb +61 -0
  63. data/lib/sambal-cle/page_objects/realms.rb +19 -0
  64. data/lib/sambal-cle/page_objects/resources.rb +326 -0
  65. data/lib/sambal-cle/page_objects/resources_roster.rb +0 -0
  66. data/lib/sambal-cle/page_objects/rosters.rb +70 -0
  67. data/lib/sambal-cle/page_objects/rwiki.rb +34 -0
  68. data/lib/sambal-cle/page_objects/search.rb +34 -0
  69. data/lib/sambal-cle/page_objects/sections.rb +295 -0
  70. data/lib/sambal-cle/page_objects/single_user.rb +1 -0
  71. data/lib/sambal-cle/page_objects/site_setup.rb +621 -0
  72. data/lib/sambal-cle/page_objects/site_statistics.rb +1 -0
  73. data/lib/sambal-cle/page_objects/sites.rb +255 -0
  74. data/lib/sambal-cle/page_objects/styles.rb +74 -0
  75. data/lib/sambal-cle/page_objects/syllabus.rb +166 -0
  76. data/lib/sambal-cle/page_objects/user_membership.rb +57 -0
  77. data/lib/sambal-cle/page_objects/users.rb +88 -0
  78. data/lib/sambal-cle/randomizers.rb +117 -0
  79. data/lib/sambal-cle/rich_text.rb +38 -0
  80. data/lib/sambal-cle/utilities.rb +31 -0
  81. data/lib/sambal-cle/workflows.rb +223 -0
  82. data/lib/sambal-cle.rb +31 -0
  83. data/sambal-cle.gemspec +14 -0
  84. data/test/add_assignment_to_calendar_spec.rb +86 -0
  85. data/test/assignment_announcements_spec.rb +71 -0
  86. data/test/assignment_gradebook_spec.rb +98 -0
  87. data/test/config.yml.template +4 -0
  88. data/test/directory.yml.template +123 -0
  89. data/test/duplicate_site_spec.rb +244 -0
  90. metadata +167 -0
@@ -0,0 +1,118 @@
1
+ # Some date and time helper functions....
2
+ module DateMakers
3
+
4
+ MONTHS = %w{JAN FEB MAR APR MAY JUN JUL AUG SEP OCT NOV DEC}
5
+ def an_hour_ago
6
+ date_factory(Time.now - 3600)
7
+ end
8
+ alias last_hour an_hour_ago
9
+
10
+ def right_now
11
+ date_factory(Time.now)
12
+ end
13
+
14
+ def in_an_hour
15
+ date_factory(Time.now + 3600)
16
+ end
17
+ alias next_hour in_an_hour
18
+
19
+ def last_year
20
+ date_factory(Time.now - (3600*24*365))
21
+ end
22
+ alias a_year_ago last_year
23
+
24
+ def last_month
25
+ index = MONTHS.index(current_month)
26
+ return MONTHS[index-1]
27
+ end
28
+
29
+ def hours_ago(num)
30
+ date_factory(Time.now - num*3600)
31
+ end
32
+
33
+ def hours_from_now(num)
34
+ date_factory(Time.now + num*3600)
35
+ end
36
+
37
+ def minutes_ago(num)
38
+ date_factory(Time.now - num*60)
39
+ end
40
+
41
+ def minutes_from_now(num)
42
+ date_factory(Time.now + num*60)
43
+ end
44
+
45
+ def current_month
46
+ Time.now.strftime("%^b")
47
+ end
48
+
49
+ def next_month
50
+ index = MONTHS.index(current_month)
51
+ if index < 11
52
+ return MONTHS[index+1]
53
+ else
54
+ return MONTHS[0]
55
+ end
56
+ end
57
+
58
+ def in_a_year
59
+ date_factory(Time.now + (3600*24*365))
60
+ end
61
+
62
+ def yesterday
63
+ date_factory(Time.now - (3600*24))
64
+ end
65
+
66
+ def tomorrow
67
+ date_factory(Time.now + (3600*24))
68
+ end
69
+
70
+ def in_a_week
71
+ date_factory(Time.now + (3600*24*7))
72
+ end
73
+ alias next_week in_a_week
74
+
75
+ def a_week_ago
76
+ date_factory(Time.now - (3600*24*7))
77
+ end
78
+
79
+ def next_monday
80
+ date_factory(Time.at(Time.now+(8-Time.now.wday)*24*3600))
81
+ end
82
+
83
+ # Formats a date string Sakai-style.
84
+ # Useful for verifying creation dates and such.
85
+ #
86
+ # Supplied variable must be of of the Time class.
87
+ def make_date(time_object)
88
+ month = time_object.strftime("%b ")
89
+ day = time_object.strftime("%-d")
90
+ year = time_object.strftime(", %Y ")
91
+ mins = time_object.strftime(":%M %P")
92
+ hour = time_object.strftime("%l").to_i
93
+ return month + day + year + hour.to_s + mins
94
+ end
95
+
96
+ # Takes a time object and returns a hash containing
97
+ # various parts of the relevant date.
98
+ def date_factory(time_object)
99
+ {
100
+ :sakai=>make_date(time_object),
101
+ :short_date=>time_object.strftime("%b %-d, %Y"), # => "Oct 18, 2013"
102
+ :MON => time_object.strftime("%^b"), # => "DEC"
103
+ :Mon => time_object.strftime("%b"), # => "Jan"
104
+ :Month => time_object.strftime("%B"), # => "February"
105
+ :month_int => time_object.month, # => 3
106
+ :day_of_month => time_object.day, # => 17 Note this is not zero-padded
107
+ :weekday => time_object.strftime("%A"), # => "Monday"
108
+ :wkdy => time_object.strftime("%a"), # => "Tue"
109
+ :year => time_object.year, # => 2013
110
+ :hour => time_object.strftime("%I").to_i, # => "07" Zero-padded, 12-hour clock
111
+ :minute => (time_object).strftime("%M"), # => "02" Zero-padded
112
+ :minute_rounded => (Time.at(time_object.to_i/(5*60)*(5*60))).strftime("%M"), # => "05" Zero-padded, rounded to 5-minute increments
113
+ :meridian => time_object.strftime("%P"), # => "pm"
114
+ :MERIDIAN => time_object.strftime("%p") # => "AM"
115
+ }
116
+ end
117
+
118
+ end
@@ -0,0 +1,23 @@
1
+ # Need this to extend Watir to be able to attach to Sakai's non-standard tags...
2
+ module Watir
3
+ class Element
4
+ # attaches to the "headers" tags inside of the assignments table.
5
+ def headers
6
+ @how = :ole_object
7
+ return @o.headers
8
+ end
9
+
10
+ # attaches to the "for" tags in "label" tags.
11
+ def for
12
+ @how = :ole_object
13
+ return @o.for
14
+ end
15
+
16
+ # attaches to the "summary" tag
17
+ def summary
18
+ @how = :ole_object
19
+ return @o.summary
20
+ end
21
+
22
+ end
23
+ end
@@ -0,0 +1,22 @@
1
+ module PageHelper
2
+
3
+ def visit page_class, &block
4
+ on page_class, true, &block
5
+ end
6
+
7
+ def on page_class, visit=false, &block
8
+ @current_page = page_class.new @browser, visit
9
+ block.call @current_page if block
10
+ @current_page
11
+ end
12
+ alias on_page on
13
+
14
+ def make data_object_class, opts={}
15
+ data_object_class.new @browser, opts
16
+ end
17
+
18
+ def wait_until(timeout=30, message=nil, &block)
19
+ Object::Watir::Wait.until(timeout, message, &block)
20
+ end
21
+
22
+ end
@@ -0,0 +1,48 @@
1
+ class PageMaker
2
+
3
+ def initialize browser, visit = false
4
+ @browser = browser
5
+ goto if visit
6
+ expected_element if respond_to? :expected_element
7
+ has_expected_title? if respond_to? :has_expected_title?
8
+ end
9
+
10
+ def method_missing sym, *args, &block
11
+ @browser.send sym, *args, &block
12
+ end
13
+
14
+ class << self
15
+
16
+ def page_url url
17
+ define_method 'goto' do
18
+ @browser.goto url
19
+ end
20
+ end
21
+
22
+ def expected_element element_name, timeout=30
23
+ define_method 'expected_element' do
24
+ self.send(element_name).wait_until_present timeout
25
+ end
26
+ end
27
+
28
+ def expected_title expected_title
29
+ define_method 'has_expected_title?' do
30
+ has_expected_title = expected_title.kind_of?(Regexp) ? expected_title =~ @browser.title : expected_title == @browser.title
31
+ raise "Expected title '#{expected_title}' instead of '#{@browser.title}'" unless has_expected_title
32
+ end
33
+ end
34
+
35
+ def element element_name
36
+ raise "#{element_name} is being defined twice in #{self}!" if self.instance_methods.include?(element_name.to_sym)
37
+ define_method element_name.to_s do
38
+ yield self
39
+ end
40
+ end
41
+
42
+ alias :value :element
43
+ alias :action :element
44
+ alias :thing :element
45
+
46
+ end
47
+
48
+ end # PageMaker
@@ -0,0 +1,111 @@
1
+ #================
2
+ # User's Account Page - in "My Settings"
3
+ #================
4
+
5
+ # The Page for editing User Account details
6
+ class EditAccount < BasePage
7
+
8
+ frame_element
9
+
10
+ # Clicks the update details button then
11
+ # makes sure there isn't any error message present.
12
+ # If there is, it reinstantiates the Edit Account Class,
13
+ # otherwise it instantiates the UserAccount Class.
14
+ def update_details
15
+ frm.button(:value=>"Update Details").click
16
+ # Need to check if the update took...
17
+ if frm.div(:class=>"portletBody").h3.text=="My Account Details"
18
+ # Apparently it did...
19
+ UserAccount.new(@browser)
20
+ elsif frm.div(:class=>"portletBody").h3.text=="Account Details"
21
+ # We are on the edit page (or we're using the Admin account)...
22
+ EditAccount.new(@browser)
23
+ elsif frm.div(:class=>"portletBody").h3.text=="Users"
24
+ Users.new(@browser)
25
+ end
26
+ end
27
+
28
+ element(:first_name) { |b| b.frm.text_field(:id=>"first-name") }
29
+ element(:last_name) { |b| b.frm.text_field(:id=>"last-name") }
30
+ element(:email) { |b| b.frm.text_field(:id=>"email") }
31
+ element(:current_password) { |b| b.frm.text_field(:id=>"pwcur") }
32
+ element(:create_new_password) { |b| b.frm.text_field(:id=>"pw") }
33
+ element(:verify_new_password) { |b| b.frm.text_field(:id=>"pw0") }
34
+ end
35
+
36
+
37
+ # A Non-Admin User's Account page
38
+ # Accessible via the "Account" link in "MY SETTINGS"
39
+ #
40
+ # IMPORTANT: this class does not use PageObject or the ToolsMenu!!
41
+ # So, the only available method to navigate away from this page is
42
+ # Home. Otherwise, you'll have to call the navigation link
43
+ # Explicitly in the test case itself.
44
+ #
45
+ # Objects and methods used in this class must be explicitly
46
+ # defined using Watir and Ruby code.
47
+ #
48
+ # Do NOT use the PageObject syntax in this class.
49
+ class UserAccount < BasePage
50
+
51
+ frame_element
52
+
53
+ # Clicks the Modify Details button. Instantiates the EditAccount class.
54
+ def modify_details
55
+ @browser.frame(:index=>0).button(:name=>"eventSubmit_doModify").click
56
+ EditAccount.new(@browser)
57
+ end
58
+
59
+ # Gets the text of the User ID field.
60
+ def user_id
61
+ @browser.frame(:index=>0).table(:class=>"itemSummary", :index=>0)[0][1].text
62
+ end
63
+
64
+ # Gets the text of the First Name field.
65
+ def first_name
66
+ @browser.frame(:index=>0).table(:class=>"itemSummary", :index=>0)[1][1].text
67
+ end
68
+
69
+ # Gets the text of the Last Name field.
70
+ def last_name
71
+ @browser.frame(:index=>0).table(:class=>"itemSummary", :index=>0)[2][1].text
72
+ end
73
+
74
+ # Gets the text of the Email field.
75
+ def email
76
+ @browser.frame(:index=>0).table(:class=>"itemSummary", :index=>0)[3][1].text
77
+ end
78
+
79
+ # Gets the text of the Type field.
80
+ def type
81
+ @browser.frame(:index=>0).table(:class=>"itemSummary", :index=>0)[4][1].text
82
+ end
83
+
84
+ # Gets the text of the Created By field.
85
+ def created_by
86
+ @browser.frame(:index=>0).table(:class=>"itemSummary", :index=>1)[0][1].text
87
+ end
88
+
89
+ # Gets the text of the Created field.
90
+ def created
91
+ @browser.frame(:index=>0).table(:class=>"itemSummary", :index=>1)[1][1].text
92
+ end
93
+
94
+ # Gets the text of the Modified By field.
95
+ def modified_by
96
+ @browser.frame(:index=>0).table(:class=>"itemSummary", :index=>1)[2][1].text
97
+ end
98
+
99
+ # Gets the text of the Modified (date) field.
100
+ def modified
101
+ @browser.frame(:index=>0).table(:class=>"itemSummary", :index=>1)[3][1].text
102
+ end
103
+
104
+ # Clicks the Home buton in the left menu.
105
+ # instantiates the Home Class.
106
+ def home
107
+ @browser.link(:text, "Home").click
108
+ Home.new(@browser)
109
+ end
110
+
111
+ end
@@ -0,0 +1,43 @@
1
+ #================
2
+ # Aliases Pages
3
+ #================
4
+
5
+ # The Aliases page - "icon-sakai-aliases", found in the Administration Workspace
6
+ class Aliases < BasePage
7
+
8
+ frame_element
9
+
10
+ element(:search_field) { |b| b.frm.text_field(:id=>"search") }
11
+ action(:next) { |b| b.frm.button(:name=>"eventSubmit_doList_next").click }
12
+ action(:last) { |b| b.frm.button(:name=>"eventSubmit_doList_last").click }
13
+ action(:previous) { |b| b.frm.button(name=>"eventSubmit_doList_prev").click }
14
+ action(:first) { |b| b.frm.button(:name=>"eventSubmit_doList_first").click }
15
+ action(:new_alias) { |b| b.frm.link(:text=>"New Alias").click }
16
+ action(:search_button) { |b| b.frm.button(:text=>"Search").click }
17
+ element(:select_page_size) { |b| b.frm.select(:id=>"selectPageSize") }
18
+
19
+ end
20
+
21
+ # The Page that appears when you create a New Alias
22
+ class AliasesCreate < BasePage
23
+
24
+ frame_element
25
+
26
+ element(:alias_name) { |b| b.frm.text_field(:id=>"id") }
27
+ element(:target) { |b| b.frm.text_field(:id=>"target") }
28
+ action(:save) { |b| b.frm.button(:name=>"eventSubmit_doSave").click }
29
+ action(:cancel) { |b| b.frm.button(:name=>"eventSubmit_doCancel").click }
30
+
31
+ end
32
+
33
+ # Page for editing an existing Alias record
34
+ class EditAlias < BasePage
35
+
36
+ frame_element
37
+
38
+ action(:remove_alias) { |b| b.frm.link(:text=>"Remove Alias").click }
39
+ element(:target) { |b| b.frm.text_field(:id=>"target") }
40
+ action(:save) { |b| b.frm.button(:name=>"eventSubmit_doSave").click }
41
+ action(:cancel) { |b| b.frm.button(:name=>"eventSubmit_doCancel").click }
42
+
43
+ end
@@ -0,0 +1,190 @@
1
+ # The Announcements list page for a Site.
2
+ class Announcements < BasePage
3
+
4
+ frame_element
5
+
6
+ # Clicks the add button, goes to the AddEditAnnouncements class.
7
+ action(:add) { |b| b.frm.div(:class=>"portletBody").link(:title=>"Add").click }
8
+
9
+ # Edits the specified announcement in the list.
10
+ # @param subject [String] the text of the announcement listing link.
11
+ def edit(subject)
12
+ frm.table(:class=>"listHier").row(:text=>/#{Regexp.escape(subject)}/).link(:text=>"Edit").click
13
+ end
14
+
15
+ def view(title)
16
+ frm.link(:text=>title).click
17
+ end
18
+
19
+ # Returns an array of the subject strings of the announcements
20
+ # listed on the page.
21
+ def subjects
22
+ links = frm.table(:class=>"listHier").links.find_all { |link| link.title=~/View announcement/ }
23
+ subjects = []
24
+ links.each { |link| subjects << link.text }
25
+ return subjects
26
+ end
27
+
28
+ def href(subject)
29
+ frm.link(:text=>subject).href
30
+ end
31
+
32
+ # Returns true or false depending on whether the specified announcement has an attachment.
33
+ # @param subject [String] the text of the announcement listing link.
34
+ def has_attachment?(subject)
35
+ if frm.table(:class=>"listHier").row(:text=>/#{Regexp.escape(subject)}/).exist?
36
+ return frm.table(:class=>"listHier").row(:text=>/#{Regexp.escape(subject)}/).image(:alt=>"attachment").exist?
37
+ else
38
+ puts "Can't find your target row. Your test is faulty."
39
+ return false
40
+ end
41
+ end
42
+
43
+ # Returns the text of the "For" column for
44
+ # the specified announcement.
45
+ # @param subject [String] the text of the announcement listing link.
46
+ def for_column(subject)
47
+ frm.table(:class=>"listHier").row(:text=>/#{Regexp.escape(subject)}/)[4].text
48
+ end
49
+
50
+ # Clicks the specified announcement link and instantiates the PreviewAnnouncements class.
51
+ # @param subject [String] the text of the announcement listing link.
52
+ def preview_announcement(subject)
53
+ frm.link(:text=>subject).click
54
+ PreviewAnnouncements.new(@browser)
55
+ end
56
+
57
+ # Selects the specified list item from the View selection list.
58
+ # @param list_item [String] the text of the option in the selection list.
59
+ def view=(list_item)
60
+ frm.select(:id=>"view").set(list_item)
61
+ end
62
+
63
+ # Clicks the Merge link and goes to the AnnouncementsMerge class.
64
+ action(:merge) { |b| b.frm.link(:text=>"Merge").click }
65
+
66
+ end
67
+
68
+ # Show Announcements from Another Site. On this page you select what announcements
69
+ # you want to merge into the current Site.
70
+ class AnnouncementsMerge < BasePage
71
+
72
+ frame_element
73
+
74
+ # Checks the checkbox for the specified site name
75
+ # @param site_name [String] the name of the relevant site displayed in the table
76
+ def check(site_name)
77
+ frm.table(:class=>"listHier lines nolines").row(:text=>/#{Regexp.escape(site_name)}/).checkbox(:id=>/site/).set
78
+ end
79
+
80
+ # Clicks the Save button and goes to the Announcements class.
81
+ action(:save) { |b| b.frm.button(:value=>"Save").click }
82
+
83
+ end
84
+
85
+ # This Class does double-duty. It's for the Preview page when editing an
86
+ # Announcement, plus for when you just click an Announcement to view it.
87
+ class ViewAnnouncement < BasePage
88
+
89
+ frame_element
90
+
91
+ # Clicks the Return to list button and goes to the Announcements class.
92
+ action(:return_to_list) { |b| b.frm.button(:value=>"Return to List").click }
93
+
94
+ # Clicks the Save changes button and goes to the Announcements class.
95
+ action(:save_changes) { |b| b.frm.button(:value=>"Save Changes").click }
96
+
97
+ # Clicks the Edit button and goes to the AddEditAnnouncements class.
98
+ action(:edit) { |b| b.frm.button(:value=>"Edit").click }
99
+
100
+ value(:subject) { |b| b.frm.table(class: "itemSummary")[0][1].text }
101
+ value(:saved_by) { |b| b.frm.table(class: "itemSummary")[1][1].text }
102
+ value(:date) { |b| b.frm.table(class: "itemSummary")[2][1].text }
103
+ value(:groups) { |b| b.frm.table(class: "itemSummary")[3][1].text }
104
+ value(:message) { |b| b.frm.div(class: "portletBody").p.text }
105
+ value(:message_html) { |b| b.frm.div(class: "portletBody").p.html }
106
+
107
+ end
108
+
109
+ # The page where an announcement is created or edited.
110
+ class AddEditAnnouncements < BasePage
111
+
112
+ include FCKEditor
113
+ frame_element
114
+
115
+ expected_element :editor
116
+
117
+ element(:editor) { |b| b.frm.frame(:id, "body___Frame") }
118
+
119
+ # Clicks the Add Announcement button. The next class is either
120
+ # AddEditAnnouncements or Announcements.
121
+ action(:add_announcement) { |b| b.frm.button(:value=>"Add Announcement").click }
122
+
123
+ # Clicks the Save changes button. Next is the Announcements class.
124
+ action(:save_changes) { |b| b.frm.button(:value=>"Save Changes").click }
125
+
126
+ # Clicks the Preview button. Next is the PreviewAnnouncements class.
127
+ action(:preview){ |b| b.frm.button(:value=>"Preview").click }
128
+
129
+
130
+ # Sends the specified text block to the rich text editor
131
+ # @param text [String] the text that you want to add to the editor.
132
+ def body=(text)
133
+ editor.td(:id, "xEditingArea").frame(:index=>0).send_keys(text)
134
+ end
135
+
136
+ # Clicks the Add attachments button. Next is the Announcments Attach class.
137
+ action(:add_attachments) { |b| b.frm.button(:value=>"Add Attachments").click }
138
+
139
+ # Clicks the checkbox for the specified group name
140
+ # when you've set the announcement access to display
141
+ # to groups.
142
+ # @param group_name [String] the name of the group in the table that you intend to select.
143
+ def check_group(group_name)
144
+ frm.table(:id=>"groupTable").row(:text=>/#{Regexp.escape(group_name)}/).checkbox(:name=>"selectedGroups").set
145
+ end
146
+
147
+ element(:title) { |b| b.frm.text_field(:id=>"subject") }
148
+ element(:site_members) { |b| b.frm.radio(:id=>"site") }
149
+ element(:publicly_viewable) { |b| b.frm.radio(:id=>"pubview") }
150
+ element(:groups) { |b| b.frm.radio(:id=>"groups") }
151
+ element(:show) { |b| b.frm.radio(:id=>"hidden_false") }
152
+ element(:hide) { |b| b.frm.radio(:id=>"hidden_true") }
153
+ element(:specify_dates) { |b| b.frm.radio(:id=>"hidden_specify") }
154
+ element(:beginning) { |b| b.frm.checkbox(:id=>"use_start_date") }
155
+ element(:ending) { |b| b.frm.checkbox(:id=>"use_end_date") }
156
+ element(:all) { |b| b.frm.checkbox(:id=>"selectall") }
157
+
158
+ element(:beginning_month) { |b| b.frm.select(:id=>"release_month") }
159
+
160
+ # Sets the Beginning Day selection to the
161
+ # specified string.
162
+ element(:beginning_day) { |b| b.frm.select(:id=>"release_day") }
163
+ element(:beginning_year) { |b| b.frm.select(:id=>"release_year") }
164
+ element(:beginning_hour) { |b| b.frm.select(:id=>"release_hour") }
165
+ element(:beginning_minute) { |b| b.frm.select(:id=>"release_minute") }
166
+ element(:beginning_meridian) { |b| b.frm.select(:id=>"release_ampm") }
167
+ element(:ending_month) { |b| b.frm.select(:id=>"retract_month") }
168
+ element(:ending_day) { |b| b.frm.select(:id=>"retract_day") }
169
+ element(:ending_year) { |b| b.frm.select(:id=>"retract_year") }
170
+ element(:ending_hour) { |b| b.frm.select(:id=>"retract_hour") }
171
+ element(:ending_minute) { |b| b.frm.select(:id=>"retract_minute") }
172
+ element(:ending_meridian) { |b| b.frm.select(:id=>"retract_ampm") }
173
+
174
+ value(:alert_message) { |b| b.frm.div(:class=>"alertMessage").text }
175
+
176
+ end
177
+
178
+ # Page for setting up options for announcements
179
+ class AnnouncementsOptions < BasePage
180
+
181
+ frame_element
182
+
183
+ end
184
+
185
+ # Page containing permissions options for announcements
186
+ class AnnouncementsPermissions < BasePage
187
+
188
+ frame_element
189
+
190
+ end