Module: HeaderFooterBar

Overview

The Topmost Header menu bar, present on most pages, plus the Footer contents, too. This module also contains references to the notification pop-ups that appear in the upper right.

Instance Method Summary collapse

Methods included from PageObject

#method_missing, #name_li, #name_link

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class PageObject

Instance Method Details

#acknowledgementsObject

Clicks the Acknowledgements link in the page Footer.



96
97
98
99
100
101
# File 'lib/sakai-oae-test-api/toolbars_and_menus.rb', line 96

def acknowledgements
  self.acknowledgements_link
  sleep 1
  self.wait_for_ajax
  Acknowledgements.new @browser
end

#add_collectionObject



188
189
190
# File 'lib/sakai-oae-test-api/toolbars_and_menus.rb', line 188

def add_collection

end

#add_contentObject

Opens the Create + Add menu in the header bar, clicks on the Add Content item, waits for the Pop Up dialog to appear, then includes the AddContentContainer module in the currently instantiated Class Object.



181
182
183
184
185
186
# File 'lib/sakai-oae-test-api/toolbars_and_menus.rb', line 181

def add_content
  self.link(:id=>"navigation_create_and_add_link").fire_event("onmouseover")
  self.link(:text=>"Add content").click
  self.wait_until { self.text.include? "Collected items" }
  self.class.class_eval { include AddContentContainer }
end

Clicks the Browse button in the footer And returns the AllCategories page class.



89
90
91
92
93
# File 'lib/sakai-oae-test-api/toolbars_and_menus.rb', line 89

def browse_footer
  browse_footer_link.click
  self.wait_for_ajax
  AllCategoriesPage.new @browser
end

The page object for the Browse link the footer. Defined as a custom method because of issues using PageObject to do it.



83
84
85
# File 'lib/sakai-oae-test-api/toolbars_and_menus.rb', line 83

def browse_footer_link
  self.span(:id=>"footer_links_right").link(:text=>"Browse")
end

#change_languageObject

Clicks the language button in the page footer.



119
120
121
122
123
# File 'lib/sakai-oae-test-api/toolbars_and_menus.rb', line 119

def change_language
  self.language_button
  self.wait_for_ajax
  self.class.class_eval { include AccountPreferencesPopUp }
end

#change_locationObject

Clicks the location link in the page footer



112
113
114
115
116
# File 'lib/sakai-oae-test-api/toolbars_and_menus.rb', line 112

def change_location
  self.location_button
  self.wait_for_ajax
  self.class.class_eval { include AccountPreferencesPopUp }
end

A generic link-clicking method. It clicks on a page link with text that matches the supplied string. Since it uses Regex to find a match, the string can be a substring of the desired link’s full text.

This method should be used as AN ABSOLUTE LAST RESORT, however, since it does not instantiate a new page class. You will have to instantiate the target page class explicitly in the test script itself, if required.



132
133
134
135
# File 'lib/sakai-oae-test-api/toolbars_and_menus.rb', line 132

def click_link(string)
  name_link(string).click
  self.wait_for_ajax
end

Clicks the Explore button in the footer and returns the Page class for the main login page (since that’s the page that loads).



74
75
76
77
78
79
# File 'lib/sakai-oae-test-api/toolbars_and_menus.rb', line 74

def explore_footer
  explore_footer_link.click
  sleep 1
  self.wait_for_ajax
  LoginPage.new @browser
end

The page object for the Explore link the footer. Defined as a custom method using Watir-webdriver, because of issues using PageObject to do it.



68
69
70
# File 'lib/sakai-oae-test-api/toolbars_and_menus.rb', line 68

def explore_footer_link
  self.span(:id=>"footer_links_right").link(:text=>"Explore")
end

#login(username, password) ⇒ Object Also known as: sign_in, log_in

Logs in with the specified username and password variables. Returns the MyDashboard class object.



150
151
152
153
154
155
156
157
158
159
160
161
# File 'lib/sakai-oae-test-api/toolbars_and_menus.rb', line 150

def (username, password)
  self.div(:id=>"topnavigation_user_options_login_wrapper").fire_event("onmouseover")
  self.text_field(:id=>"topnavigation_user_options_login_fields_username").set username
  self.text_field(:name=>"topnav_login_password").set password
  self.button(:id=>"topnavigation_user_options_login_button_login").click
  sleep 3 # TODO : Make into a wait clause
  if self.button(:id=>"emailverify_continue_button").present?
    self.button(:id=>"emailverify_continue_button").click
  end
  self.linger_for_ajax(2)
  MyDashboard.new @browser
end

#messages_containerObject

Clicks the messages container button



201
202
203
204
205
# File 'lib/sakai-oae-test-api/toolbars_and_menus.rb', line 201

def messages_container
  self.messages_container_button
  self.wait_for_ajax
  self.class.class_eval { include MessagesContainerPopUp }
end

#my_accountObject

Opens the User Options menu in the header menu bar, clicks the Preferences item, waits for the Account Preferences Pop up dialog to appear, and then includes the AccountPreferencesPopUp module in the currently instantiated Class Object.



141
142
143
144
145
146
# File 'lib/sakai-oae-test-api/toolbars_and_menus.rb', line 141

def 
  self.link(:id=>"topnavigation_user_options_name").fire_event("onmouseover")
  self.link(:id=>"subnavigation_preferences_link").click
  self.wait_for_ajax
  self.class.class_eval { include AccountPreferencesPopUp }
end

#sign_outObject Also known as: logout, log_out

Clicks the Sign out command in the user menu in the header bar. returns the LoginPage class object.



167
168
169
170
171
172
173
# File 'lib/sakai-oae-test-api/toolbars_and_menus.rb', line 167

def sign_out
  self.link(:id=>"topnavigation_user_options_name").fire_event("onmouseover")
  self.link(:id=>"subnavigation_logout_link").click
  self.link(:text=>"Explore").wait_until_present
  self.linger_for_ajax(2)
  LoginPage.new @browser
end

#sign_upObject

Clicks the “Sign up” link. Returns the CreateNewAccount class object



208
209
210
211
212
213
# File 'lib/sakai-oae-test-api/toolbars_and_menus.rb', line 208

def 
  self.
  self.button(:id=>"save_account").wait_until_present
  sleep 3
  CreateNewAccount.new @browser
end

#toggle_collectorObject

Clicks the Colector icon in the header bar, to either display or hide the collector widget, depending on its current state.



194
195
196
197
198
# File 'lib/sakai-oae-test-api/toolbars_and_menus.rb', line 194

def toggle_collector
  self.collector
  self.wait_for_ajax
  self.class.class_eval { include CollectorWidget }
end

#user_agreementObject

Clicks the User Agreement link in the page footer.



104
105
106
107
108
109
# File 'lib/sakai-oae-test-api/toolbars_and_menus.rb', line 104

def user_agreement
  self.user_agreement_link
  sleep 1
  #wait_for_ajax
  # New Class goes here.new @browser
end