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
@@ -16,12 +16,12 @@ class MyWorkspace < BasePage
16
16
  # only option because both the <id> and <name>
17
17
  # tags are unique for every site.
18
18
  # Calendar Options button
19
- action(:calendar_options) { |b| b.frm.link(:text=>"Options").click }
19
+ action(:calendar_options) { |b| b.frame(:index=>0).link(:text=>"Options").click }
20
20
 
21
21
  # My Workspace Information Options
22
- action(:my_workspace_information_options) { |b| b.frm.link(:text=>"Options").click }
22
+ action(:my_workspace_information_options) { |b| b.frame(:index=>1).link(:text=>"Options").click }
23
23
  # Message of the Day, Options button
24
- action(:message_of_the_day_options) { |b| b.frm.link(:text=>"Options").click }
24
+ action(:message_of_the_day_options) { |b| b.frame(:index=>2).link(:text=>"Options").click }
25
25
 
26
26
 
27
27
  element(:select_page_size) { |b| b.frm.select_list(:id=>"selectPageSize").click }
@@ -7,10 +7,7 @@ class Podcasts < BasePage
7
7
 
8
8
  frame_element
9
9
 
10
- def add
11
- frm.link(:text=>"Add").click
12
- AddEditPodcast.new(@browser)
13
- end
10
+ link "Add"
14
11
 
15
12
  def podcast_titles
16
13
  titles = []
@@ -22,6 +19,4 @@ class Podcasts < BasePage
22
19
  return titles
23
20
  end
24
21
 
25
-
26
-
27
22
  end
@@ -7,7 +7,7 @@ class Polls < BasePage
7
7
 
8
8
  frame_element
9
9
 
10
- action(:add) { |b| b.frm.link(:text=>"Add").click }
10
+ link "Add"
11
11
 
12
12
  def questions
13
13
  questions = []
@@ -43,8 +43,8 @@ class AddEditPoll < BasePage
43
43
  editor.td(:id, "xEditingArea").frame(:index=>0).send_keys(text)
44
44
  end
45
45
 
46
- action(:save_and_add_options) { |b| b.frm.button(:value=>"Save and add options").click }
47
- action(:save) { |b| b.frm.button(:value=>"Save").click }
46
+ button "Save and add options"
47
+ button "Save"
48
48
  element(:question) { |b| b.frm.text_field(:id=>"new-poll-text") }
49
49
 
50
50
  end
@@ -63,7 +63,7 @@ class AddAnOption < BasePage
63
63
  editor.td(:id, "xEditingArea").frame(:index=>0).send_keys(text)
64
64
  end
65
65
 
66
- action(:save) { |b| b.frm.button(:value=>"Save").click }
67
- action(:save_and_add_options) { |b| b.frm.button(:value=>"Save and add options").click }
66
+ button "Save and add options"
67
+ button "Save"
68
68
 
69
69
  end
@@ -9,35 +9,22 @@ class PortfolioTemplates < BasePage
9
9
 
10
10
  # Clicks the Add link and instantiates the
11
11
  # AddPortfolioTemplate class.
12
- def add
13
- frm.link(:text=>"Add").click
14
- AddPortfolioTemplate.new(@browser)
15
- end
12
+ link "Add"
16
13
 
17
14
  # Clicks the "Publish" link for the specified Template.
18
- def publish(templatename)
19
- frm.table(:class=>"listHier lines nolines").row(:text=>/#{Regexp.escape(templatename)}/).link(:text=>"Publish").click
20
- end
15
+ action(:publish) { |templatename, b| b.frm.table(:class=>"listHier lines nolines").row(:text=>/#{Regexp.escape(templatename)}/).link(:text=>"Publish").click }
21
16
 
22
17
  # Clicks the "Edit" link for the specified Template.
23
- def edit(templatename)
24
- frm.table(:class=>"listHier lines nolines").row(:text=>/#{Regexp.escape(templatename)}/).link(:text=>"Edit").click
25
- end
18
+ action(:edit) { |templatename, b| b.frm.table(:class=>"listHier lines nolines").row(:text=>/#{Regexp.escape(templatename)}/).link(:text=>"Edit").click }
26
19
 
27
20
  # Clicks the "Delete" link for the specified Template.
28
- def delete(templatename)
29
- frm.table(:class=>"listHier lines nolines").row(:text=>/#{Regexp.escape(templatename)}/).link(:text=>"Delete").click
30
- end
21
+ action(:delete) { |templatename, b| b.frm.table(:class=>"listHier lines nolines").row(:text=>/#{Regexp.escape(templatename)}/).link(:text=>"Delete").click }
31
22
 
32
23
  # Clicks the "Copy" link for the specified Template.
33
- def copy(templatename)
34
- frm.table(:class=>"listHier lines nolines").row(:text=>/#{Regexp.escape(templatename)}/).link(:text=>"Copy").click
35
- end
24
+ action(:copy) { |templatename, b| b.frm.table(:class=>"listHier lines nolines").row(:text=>/#{Regexp.escape(templatename)}/).link(:text=>"Copy").click }
36
25
 
37
26
  # Clicks the "Export" link for the specified Template.
38
- def export(templatename)
39
- frm.table(:class=>"listHier lines nolines").row(:text=>/#{Regexp.escape(templatename)}/).link(:text=>"Export").click
40
- end
27
+ action(:export) { |templatename, b| b.frm.table(:class=>"listHier lines nolines").row(:text=>/#{Regexp.escape(templatename)}/).link(:text=>"Export").click }
41
28
 
42
29
  end
43
30
 
@@ -47,15 +34,11 @@ class AddPortfolioTemplate < BasePage
47
34
  frame_element
48
35
 
49
36
  # Clicks the Continue button and instantiates the BuildTemplate Class.
50
- def continue
51
- frm.button(:value=>"Continue").click
52
- BuildTemplate.new(@browser)
53
- end
37
+ button "Continue"
54
38
 
55
39
  element(:name) { |b| b.frm.text_field(:id=>"name-id") }
56
40
  element(:description) { |b| b.frm.text_field(:id=>"description") }
57
41
 
58
-
59
42
  end
60
43
 
61
44
  #
@@ -63,26 +46,15 @@ class BuildTemplate < BasePage
63
46
 
64
47
  frame_element
65
48
 
66
- # Clicks the Select File link and instantiates the
67
- # PortfolioAttachFiles Class.
68
- def select_file
69
- frm.link(:text=>"Select File").click
70
- PortfolioAttachFiles.new(@browser)
71
- end
72
-
73
- # Clicks the Continue button and instantiates
74
- # PortfolioContent Class.
75
- def continue
76
- frm.button(:value=>"Continue").click
77
- PortfolioContent.new(@browser)
78
- end
49
+ link "Select File"
50
+ button "Continue"
79
51
 
80
52
  element(:outline_options_form_type) { |b| b.frm.select(:id=>"propertyFormType-id") }
81
53
 
82
54
  end
83
55
 
84
56
  #
85
- class PortfoliosUploadFiles < BasePage # TODO - This class is not DRY. Identical methods in multiple classes
57
+ class PortfoliosUploadFiles < BasePage # TODO - This class can probably be removed completely
86
58
 
87
59
  frame_element
88
60
 
@@ -107,9 +79,7 @@ class PortfoliosUploadFiles < BasePage # TODO - This class is not DRY. Identical
107
79
  end
108
80
 
109
81
  # Clicks the Add Another File link.
110
- def add_another_file
111
- frm.link(:text=>"Add Another File").click
112
- end
82
+ link "Add Another File"
113
83
 
114
84
  end
115
85
 
@@ -118,19 +88,12 @@ class PortfolioContent < BasePage
118
88
 
119
89
  frame_element
120
90
 
121
- # Clicks the Continue button and instantiates the
122
- # SupportingFilesPortfolio Class.
123
- def continue
124
- frm.button(:value=>"Continue").click
125
- SupportingFilesPortfolio.new(@browser)
126
- end
127
-
128
-
91
+ button "Continue"
129
92
  element(:type) { |b| b.frm.select(:id=>"item.type") }
130
93
  element(:name) { |b| b.frm.text_field(:id=>"item.name-id") }
131
94
  element(:title) { |b| b.frm.text_field(:id=>"item.title-id") }
132
95
  element(:description) { |b| b.frm.text_field(:id=>"item.description-id") }
133
- action(:add_to_list) { |b| b.frm.button(:value=>"Add To List").click }
96
+ button "Add To List"
134
97
  element(:image) { |b| b.frm.checkbox(:id=>"image-id") }
135
98
 
136
99
  end
@@ -140,22 +103,9 @@ class SupportingFilesPortfolio < BasePage
140
103
 
141
104
  frame_element
142
105
 
143
- # Clicks the Finish button and instantiates
144
- # the PortfolioTemplates Class.
145
- def finish
146
- frm.button(:value=>"Finish").click
147
- PortfolioTemplates.new(@browser)
148
- end
149
-
150
- # Clicks the Select File link and instantiates
151
- # the PortfolioAttachFiles Class.
152
- def select_file
153
- frm.link(:text=>"Select File").click
154
- PortfolioAttachFiles.new(@browser)
155
- end
156
-
157
-
158
- action(:add_to_list) { |b| b.frm.button(:value=>"Add To List").click }
106
+ button "Finish"
107
+ link "Select File"
108
+ button "Add To List"
159
109
  element(:name) { |b| b.frm.text_field(:id=>"fileRef.usage-id") }
160
110
 
161
111
  end
@@ -7,10 +7,7 @@ class Portfolios < BasePage
7
7
 
8
8
  frame_element
9
9
 
10
- def create_new_portfolio
11
- frm.link(:text=>"Create New Portfolio").click
12
- AddPortfolio.new(@browser)
13
- end
10
+ link "Create New Portfolio"
14
11
 
15
12
  def list
16
13
  list = []
@@ -21,9 +18,7 @@ class Portfolios < BasePage
21
18
  return list
22
19
  end
23
20
 
24
- def shared(portfolio_name)
25
- frm.table(:class=>"listHier ospTable").row(:text=>/#{Regexp.escape(portfolio_name)}/)[5].text
26
- end
21
+ action(:shared) { |portfolio_name, b| b.frm.table(:class=>"listHier ospTable").row(:text=>/#{Regexp.escape(portfolio_name)}/)[5].text }
27
22
 
28
23
  end
29
24
 
@@ -32,12 +27,7 @@ class AddPortfolio < BasePage
32
27
 
33
28
  frame_element
34
29
 
35
- def create
36
- frm.button(:value=>"Create").click
37
- EditPortfolio.new(@browser)
38
- end
39
-
40
-
30
+ button "Create"
41
31
  element(:name) { |b| b.frm.text_field(:name=>"presentationName") }
42
32
  element(:design_your_own_portfolio) { |b| b.frm.radio(:id=>"templateId-freeForm") }
43
33
 
@@ -48,14 +38,9 @@ class EditPortfolio < BasePage
48
38
 
49
39
  frame_element
50
40
 
51
- def add_edit_content
52
- frm.link(:text=>"Add/Edit Content").click
53
- AddEditPortfolioContent.new @browser
54
- end
55
-
56
-
57
- action(:edit_title) { |b| b.frm.link(:text=>"Edit Title").click }
58
- action(:save_changes) { |b| b.frm.link(:text=>"Save Changes").click }
41
+ link("Add/Edit Content")
42
+ link("Edit Title")
43
+ link("Save Changes")
59
44
  element(:active) { |b| b.frm.radio(:id=>"btnActive") }
60
45
  element(:inactive) { |b| b.frm.radio(:id=>"btnInactive") }
61
46
 
@@ -66,40 +51,21 @@ class AddEditPortfolioContent < BasePage
66
51
 
67
52
  frame_element
68
53
 
69
- def add_page
70
- frm.link(:text=>"Add Page").click
71
- AddEditPortfolioPage.new(@browser)
72
- end
73
-
74
- def share_with_others
75
- frm.link(:text=>"Share with Others").click
76
- SharePortfolio.new @browser
77
- end
78
-
79
-
80
- action(:save_changes) { |b| b.frm.button(:value=>"Save Changes").click }
54
+ link "Add Page"
55
+ link "Share with Others"
56
+ button "Save Changes"
81
57
 
82
58
  end
83
59
 
84
60
  #
85
61
  class AddEditPortfolioPage < BasePage
86
62
 
63
+ include FCKEditor
87
64
  frame_element
88
65
 
89
- def add_page
90
- frm.button(:value=>"Add Page").click
91
- AddEditPortfolioContent.new(@browser)
92
- end
93
-
94
- def select_layout
95
- frm.link(:text=>"Select Layout").click
96
- ManagePortfolioLayouts.new @browser
97
- end
98
-
99
- def select_style
100
- frm.link(:text=>"Select Style").click
101
- SelectPortfolioStyle.new @browser
102
- end
66
+ link "Add Page"
67
+ link "Select Layout"
68
+ link "Select Style"
103
69
 
104
70
  def simple_html_content=(text)
105
71
  frm.frame(:id, "_id1:arrange:_id49_inputRichText___Frame").div(:title=>"Select All").fire_event("onclick")
@@ -107,12 +73,10 @@ class AddEditPortfolioPage < BasePage
107
73
  frm.frame(:id, "_id1:arrange:_id49_inputRichText___Frame").td(:id, "xEditingArea").frame(:index=>0).send_keys(text)
108
74
  end
109
75
 
110
-
111
76
  element(:title) { |b| b.frm.text_field(:id=>"_id1:title") }
112
77
  element(:description) { |b| b.frm.text_field(:id=>"_id1:description") }
113
78
  element(:keywords) { |b| b.frm.text_field(:id=>"_id1:keywords") }
114
79
 
115
-
116
80
  end
117
81
 
118
82
  #
@@ -120,15 +84,9 @@ class ManagePortfolioLayouts < BasePage
120
84
 
121
85
  frame_element
122
86
 
123
- def select(layout_name)
124
- frm.table(:class=>"listHier lines nolines").row(:text=>/#{Regexp.escape(layout_name)}/).link(:text=>"Select").click
125
- AddEditPortfolioPage.new @browser
126
- end
87
+ action(:select) { |layout_name, b| b.frm.table(:class=>"listHier lines nolines").row(:text=>/#{Regexp.escape(layout_name)}/).link(:text=>"Select").click }
127
88
 
128
- def go_back
129
- frm.button(:value=>"Go Back").click
130
- AddEditPortfolioPage.new @browser
131
- end
89
+ button "Go Back"
132
90
 
133
91
  end
134
92
 
@@ -137,16 +95,8 @@ class SharePortfolio < BasePage
137
95
 
138
96
  frame_element
139
97
 
140
- def click_here_to_share_with_others
141
- frm.link(:text=>"Click here to share with others").click
142
- AddPeopleToShare.new(@browser)
143
- end
144
-
145
- def summary
146
- frm.link(:text=>"Summary").click
147
- EditPortfolio.new @browser
148
- end
149
-
98
+ link "Click here to share with others"
99
+ link "Summary"
150
100
 
151
101
  element(:everyone_on_the_internet) { |b| b.frm.checkbox(:id=>"public_checkbox") }
152
102
 
@@ -7,24 +7,16 @@ class Profile < BasePage
7
7
 
8
8
  frame_element
9
9
 
10
- def edit_my_profile
11
- frm.link(:text=>"Edit my Profile").click
12
- EditProfile.new(@browser)
13
- end
14
-
15
- def show_my_profile
16
- frm.link(:text=>"Show my Profile").click
17
- Profile.new @browser
18
- end
10
+ link "Edit my Profile"
11
+ link "Show my Profile"
19
12
 
20
13
  def photo
21
14
  source = frm.image(:id=>"profileForm:image1").src
22
15
  return source.split("/")[-1]
23
16
  end
24
17
 
25
- def email
26
- frm.link(:id=>"profileForm:email").text
27
- end
18
+ action(:email) { |b| b.frm.link(:id=>"profileForm:email").text }
19
+
28
20
  end
29
21
 
30
22
  #
@@ -32,10 +24,7 @@ class EditProfile < BasePage
32
24
 
33
25
  frame_element
34
26
 
35
- def save
36
- frm.button(:value=>"Save").click
37
- Profile.new(@browser)
38
- end
27
+ button "Save"
39
28
 
40
29
  def picture_file(filename, filepath="")
41
30
  frm.file_field(:name=>"editProfileForm:uploadFile.uploadId").set(filepath + filename)
@@ -1,93 +1,62 @@
1
- module Profile2Nav
1
+ class Profile2Base < BasePage
2
2
 
3
- def preferences
4
- frm.link(:class=>"icon preferences").click
5
- Profile2Preferences.new @browser
6
- end
7
-
8
- def privacy
9
- frm.link(:text=>"Privacy").click
10
- Profile2Privacy.new @browser
11
- end
12
-
13
- def my_profile
14
- frm.link(:text=>"My profile").click
15
- Profile2.new(@browser)
16
- end
3
+ frame_element
17
4
 
18
- def connections
19
- frm.link(:class=>"icon connections").click
20
- Profile2Connections.new @browser
21
- end
5
+ class << self
22
6
 
23
- def pictures
24
- frm.link(:text=>"Pictures").click
25
- Profile2Pictures.new @browser
26
- end
27
-
28
- def messages
29
- frm.link(:text=>"Messages").click
30
- Profile2Messages.new @browser
31
- end
7
+ def profile2_elements
8
+ action(:preferences) { |b| b.frm.link(:class=>"icon preferences").click }
9
+ link "Privacy"
10
+ link "My profile"
11
+ action(:connections) { |b| b.frm.link(:class=>"icon connections").click }
12
+ link "Pictures"
13
+ link "Messages"
14
+ action(:search_for_connections) { |b| b.frm.link(:class=>"icon search").click }
15
+ end
32
16
 
33
- def search_for_connections
34
- frm.link(:class=>"icon search").click
35
- Profile2Search.new @browser
36
17
  end
37
18
 
38
19
  end
39
20
  #
40
- class Profile2 < BasePage
21
+ class Profile2 < Profile2Base
41
22
 
42
- frame_element
43
- include Profile2Nav
23
+ profile2_elements
24
+
25
+ element(:main_panel) { |b| b.frm.div(:id=>"mainPanel") }
26
+
44
27
  def edit_basic_info
45
- frm.div(:id=>"mainPanel").span(:text=>"Basic Information").fire_event("onmouseover")
46
- frm.div(:id=>"mainPanel").link(:href=>/myInfo:editButton/).click
47
- sleep 0.5
48
- Profile2.new @browser
28
+ main_panel.span(:text=>"Basic Information").fire_event("onmouseover")
29
+ main_panel.link(:href=>/myInfo:editButton/).click
49
30
  end
50
31
 
51
32
  def edit_contact_info
52
- frm.div(:id=>"mainPanel").span(:text=>"Contact Information").fire_event("onmouseover")
53
- frm.div(:id=>"mainPanel").link(:href=>/myContact:editButton/).click
54
- sleep 0.5
55
- Profile2.new @browser
33
+ main_panel.span(:text=>"Contact Information").fire_event("onmouseover")
34
+ main_panel.link(:href=>/myContact:editButton/).click
56
35
  end
57
36
 
58
37
  def edit_staff_info
59
- frm.div(:id=>"mainPanel").span(:text=>"Staff Information").fire_event("onmouseover")
60
- frm.div(:id=>"mainPanel").link(:href=>/myStaff:editButton/).click
61
- sleep 0.5
62
- Profile2.new @browser
38
+ main_panel.span(:text=>"Staff Information").fire_event("onmouseover")
39
+ main_panel.link(:href=>/myStaff:editButton/).click
63
40
  end
64
41
 
65
42
  def edit_student_info
66
- frm.div(:id=>"mainPanel").span(:text=>"Student Information").fire_event("onmouseover")
67
- frm.div(:id=>"mainPanel").link(:href=>/myStudent:editButton/).click
68
- sleep 0.5
69
- Profile2.new @browser
43
+ main_panel.span(:text=>"Student Information").fire_event("onmouseover")
44
+ main_panel.link(:href=>/myStudent:editButton/).click
70
45
  end
71
46
 
72
47
  def edit_social_networking
73
- frm.div(:id=>"mainPanel").span(:text=>"Social Networking").fire_event("onmouseover")
74
- frm.div(:id=>"mainPanel").link(:href=>/mySocialNetworking:editButton/).click
75
- sleep 0.5
76
- Profile2.new @browser
48
+ main_panel.span(:text=>"Social Networking").fire_event("onmouseover")
49
+ main_panel.link(:href=>/mySocialNetworking:editButton/).click
77
50
  end
78
51
 
79
52
  def edit_personal_info
80
- frm.div(:id=>"mainPanel").span(:text=>"Personal Information").fire_event("onmouseover")
81
- frm.div(:id=>"mainPanel").link(:href=>/myInterests:editButton/).click
82
- sleep 0.5
83
- Profile2.new @browser
53
+ main_panel.span(:text=>"Personal Information").fire_event("onmouseover")
54
+ main_panel.link(:href=>/myInterests:editButton/).click
84
55
  end
85
56
 
86
57
  def change_picture
87
58
  frm.div(:id=>"myPhoto").fire_event("onmouseover")
88
59
  frm.div(:id=>"myPhoto").link(:class=>"edit-image-button").click
89
- sleep 0.5
90
- Profile2.new @browser
91
60
  end
92
61
 
93
62
  # Enters the specified filename in the file field.
@@ -95,15 +64,11 @@ class Profile2 < BasePage
95
64
  # Note that the file should be inside the data/sakai-cle-test-api folder.
96
65
  # The file or folder name used for the filename variable
97
66
  # should not include a preceding slash ("/") character.
98
- def image_file=(filename)
99
- frm.file_field(:name=>"picture").set(File.expand_path(File.dirname(__FILE__)) + "/../../data/sakai-cle-test-api/" + filename)
67
+ def image_file=(filename, filepath="")
68
+ frm.file_field(:name=>"picture").set(File.expand_path(filepath + filename))
100
69
  end
101
70
 
102
- def upload
103
- frm.button(:value=>"Upload").click
104
- sleep 0.5
105
- Profile2.new @browser
106
- end
71
+ button "Upload"
107
72
 
108
73
  def personal_summary=(text)
109
74
  frm.frame(:id=>"id1a_ifr").send_keys([:command, 'a'], :backspace)
@@ -118,10 +83,7 @@ class Profile2 < BasePage
118
83
  frm.link(:text=>day.to_s).click
119
84
  end
120
85
 
121
- def save_changes
122
- frm.button(:value=>"Save changes").click
123
- Profile2.new @browser
124
- end
86
+ button "Save changes"
125
87
 
126
88
  # Returns the number (as a string) displayed next to
127
89
  # the "Connections" link in the menu. If there are no
@@ -135,7 +97,7 @@ class Profile2 < BasePage
135
97
  end
136
98
 
137
99
  element(:say_something) { |b| b.frm.text_field(:id=>"id1") }
138
- action(:say_it) { |b| b.frm.button(:value=>"Say it").click }
100
+ button "Say it"
139
101
  # Basic Information
140
102
  element(:nickname) { |b| b.frm.text_field(:name=>"nicknameContainer:nickname") }
141
103
  # Contact Information
@@ -161,17 +123,15 @@ class Profile2 < BasePage
161
123
  end
162
124
 
163
125
  #
164
- class Profile2Preferences < BasePage
126
+ class Profile2Preferences < Profile2Base
165
127
 
166
- frame_element
167
- include Profile2Nav
128
+ profile2_elements
168
129
 
169
130
  end
170
131
 
171
- class Profile2Privacy < BasePage
132
+ class Profile2Privacy < Profile2Base
172
133
 
173
- frame_element
174
- include Profile2Nav
134
+ profile2_elements
175
135
 
176
136
  element(:profile_image) { |b| b.frm.select(:name=>"profileImageContainer:profileImage") }
177
137
  element(:basic_info) { |b| b.frm.select(:name=>"basicInfoContainer:basicInfo") }
@@ -186,39 +146,25 @@ class Profile2Privacy < BasePage
186
146
  element(:send_messages) { |b| b.frm.select(:name=>"messagesContainer:messages") }
187
147
  element(:see_kudos_rating) { |b| b.frm.select(:name=>"myKudosContainer:myKudos") }
188
148
  element(:show_birth_year) { |b| b.frm.checkbox(:name=>"birthYearContainer:birthYear") }
189
- action(:save_settings) { |b| b.frm.button(:value=>"Save settings").click }
149
+ button "Save settings"
190
150
 
191
151
  end
192
152
 
193
- class Profile2Search < BasePage
153
+ class Profile2Search < Profile2Base
194
154
 
195
- frame_element
196
- include Profile2Nav
197
- def search_by_name_or_email
198
- frm.button(:value=>"Search by name or email").click
199
- sleep 0.5
200
- Profile2Search.new(@browser)
201
- end
155
+ profile2_elements
202
156
 
203
- def search_by_common_interest
204
- frm.button(:value=>"Search by common interest").click
205
- sleep 0.5
206
- Profile2Search.new(@browser)
207
- end
157
+ button "Search by name or email"
158
+ button "Search by common interest"
208
159
 
209
160
  def add_as_connection(name)
210
161
  frm.div(:class=>"search-result", :text=>/#{Regexp.escape(name)}/).link(:class=>"icon connection-add").click
211
162
  frm.div(:class=>"modalWindowButtons").wait_until_present
212
163
  frm.div(:class=>"modalWindowButtons").button(:value=>"Add connection").click
213
164
  frm.div(:class=>"modalWindowButtons").wait_while_present
214
- sleep 0.5
215
- Profile2Search.new @browser
216
165
  end
217
166
 
218
- def view(name)
219
- frm.link(:text=>name).click
220
- Profile2View.new(@browser)
221
- end
167
+ action(:view) { |name, b| b.frm.link(:text=>name).click }
222
168
 
223
169
  # Returns an array containing strings of the names of the users returned
224
170
  # in the search.
@@ -232,27 +178,21 @@ class Profile2Search < BasePage
232
178
  return results
233
179
  end
234
180
 
235
- def clear_results
236
- frm.button(:value=>"Clear results").click
237
- Profile2Search.new(@browser)
238
- end
239
-
181
+ button "Clear results"
240
182
  element(:persons_name_or_email) { |b| b.frm.text_field(:name=>"searchName") }
241
183
  element(:common_interest) { |b| b.frm.text_field(:name=>"searchInterest") }
242
184
 
243
185
  end
244
186
 
245
- class Profile2Connections < BasePage
187
+ class Profile2Connections < Profile2Base
188
+
189
+ profile2_elements
246
190
 
247
- frame_element
248
- include Profile2Nav
249
191
  def confirm_request(name)
250
192
  frm.div(:class=>"connection", :text=>name).link(:title=>"Confirm connection request").click
251
193
  frm.div(:class=>"modalWindowButtons").wait_until_present
252
194
  frm.div(:class=>"modalWindowButtons").button(:value=>"Confirm connection request").click
253
195
  frm.div(:class=>"modalWindowButtons").wait_while_present
254
- sleep 0.5
255
- Profile2Connections.new @browser
256
196
  end
257
197
 
258
198
  # Returns an array containing the names of the connected users.
@@ -268,14 +208,11 @@ class Profile2Connections < BasePage
268
208
 
269
209
  end
270
210
 
271
- class Profile2View < BasePage
211
+ class Profile2View < Profile2Base
272
212
 
273
- frame_element
274
- include Profile2Nav
213
+ profile2_elements
275
214
  #
276
- def connection
277
- frm.div(:class=>"leftPanel").span(:class=>/instruction icon/).text
278
- end
215
+ value(:connection) { |b| b.frm.div(:class=>"leftPanel").span(:class=>/instruction icon/).text }
279
216
 
280
217
  #
281
218
  def basic_information
@@ -285,7 +222,6 @@ class Profile2View < BasePage
285
222
  hash.store(row[0].text, row[1].text)
286
223
  end
287
224
  rescue Watir::Exception::UnknownObjectException
288
-
289
225
  end
290
226
  return hash
291
227
  end
@@ -298,7 +234,6 @@ class Profile2View < BasePage
298
234
  hash.store(row[0].text, row[1].text)
299
235
  end
300
236
  rescue Watir::Exception::UnknownObjectException
301
-
302
237
  end
303
238
  return hash
304
239
  end
@@ -311,7 +246,6 @@ class Profile2View < BasePage
311
246
  hash.store(row[0].text, row[1].text)
312
247
  end
313
248
  rescue Watir::Exception::UnknownObjectException
314
-
315
249
  end
316
250
  return hash
317
251
  end
@@ -324,7 +258,6 @@ class Profile2View < BasePage
324
258
  hash.store(row[0].text, row[1].text)
325
259
  end
326
260
  rescue Watir::Exception::UnknownObjectException
327
-
328
261
  end
329
262
  return hash
330
263
  end
@@ -337,7 +270,6 @@ class Profile2View < BasePage
337
270
  hash.store(row[0].text, row[1].text)
338
271
  end
339
272
  rescue Watir::Exception::UnknownObjectException
340
-
341
273
  end
342
274
  return hash
343
275
  end