Module: AddAreasPopUp

Includes:
PageObject
Defined in:
lib/sakai-oae-test-api/pop_up_dialogs.rb

Overview

Page Objects and Methods for the Add Areas Pop up dialog. Many page objects in this module are NOT defined using the Page Object gem, so they will need to be handled differently than usual. See the descriptions of the methods for more detail.

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

#add_content_list(document) ⇒ Object Also known as: add_a_content_library, add_content_library

Adds a new Content Library area to a Group/Course. The method requires a hash for the variable, with :name and :visible keys and values.



251
252
253
254
255
256
# File 'lib/sakai-oae-test-api/pop_up_dialogs.rb', line 251

def add_content_list(document)
  content_list
  content_list_name.set document[:name]
  content_list_permissions.select document[:visible]
  create
end

#add_from_existing(document) ⇒ Object Also known as: add_existing_document, add_existing_doc, add_an_existing_document

This method expects to be passed a hash object like this: { :name=>“The name of the target document”,

:title=>"The placement title string",
:visible=>"Who can see it" }

The method adds an existing document using the specified hash contents. Note that it uses the “Everywhere” page, so if you want to use one of the other pages for the search, you’ll have to code all steps in the test script itself.



222
223
224
225
226
227
228
229
230
231
# File 'lib/sakai-oae-test-api/pop_up_dialogs.rb', line 222

def add_from_existing(document)
  self.everywhere
  search_everywhere.set(document[:name] + "\n")
  self.wait_for_ajax #
  search_results.li(:text=>/#{Regexp.escape(document[:name])}/).fire_event("onclick")
  existing_doc_name.set document[:title]
  existing_doc_permissions.select document[:visible]

  self.create
end

#add_participant_list(list) ⇒ Object Also known as: add_participants_list

Adds a Participant List Area to the Group/Course. The passed object needs to be a hash with :name and :visible keys and values.



239
240
241
242
243
244
245
# File 'lib/sakai-oae-test-api/pop_up_dialogs.rb', line 239

def add_participant_list(list)
  participants_list
  participants_list_name.set list[:name]
  participants_list_permissions.select list[:visible]

  create
end

#add_widget_page(document) ⇒ Object Also known as: add_widget, add_a_widget, add_a_widget_page

Adds a new Widget Area to a Group/Course. The method requires that the passed variable be a hash, with :name, :widget, and :visible keys and values.



264
265
266
267
268
269
270
# File 'lib/sakai-oae-test-api/pop_up_dialogs.rb', line 264

def add_widget_page(document)
  widgets
  select_widget.select document[:widget]
  widget_name.set document[:name]
  widget_permissions.select document[:visible]
  create
end

#content_list_nameObject

The name field for adding a Content List page. Use of this method in a test script will require including a Watir method. For example, if you want to send the field a text string, you’ll use the .set method, like this: page_object.content_list_name.set “Name”



153
154
155
# File 'lib/sakai-oae-test-api/pop_up_dialogs.rb', line 153

def content_list_name
  self.text_field(:id=>"addarea_contentlist_name")
end

#content_list_permissionsObject

The permissions field for adding a Content List page. Use of this method in a test script will require including a Watir method. For example, if you want to send the field a text string, you’ll use the .set method, like this: page_object.content_list_permissions.select “Option”



161
162
163
# File 'lib/sakai-oae-test-api/pop_up_dialogs.rb', line 161

def content_list_permissions
  self.select(:id=>"addarea_contentlist_permissions")
end

#createObject Also known as: done_add

Clicks the “Done, add” button in the Add Area flyout dialog, then waits for the Ajax calls to drop to zero.



207
208
209
210
# File 'lib/sakai-oae-test-api/pop_up_dialogs.rb', line 207

def create
  self.done_add_button
  self.wait_for_ajax
end

#existing_doc_nameObject

Defines the Existing Document Name field based on the currently selected tab. Test script steps will need to use Watir’s .set method for entering text strings into the fields.



109
110
111
112
113
114
115
116
117
118
119
120
121
# File 'lib/sakai-oae-test-api/pop_up_dialogs.rb', line 109

def existing_doc_name
  a = "addarea_existing_mylibrary_container"
  b = "addarea_existing_everywhere_container"
  c = "addarea_existing_currentlyviewing_container"
  case
    when self.div(:id=>a).visible?
      return self.div(:id=>a).text_field(:name=>"addarea_existing_name")
    when self.div(:id=>b).visible?
      return self.div(:id=>b).text_field(:name=>"addarea_existing_name")
    when self.div(:id=>c).visible?
      return self.div(:id=>c).text_field(:name=>"addarea_existing_name")
  end
end

#existing_doc_permissionsObject

Defines the Existing Doc Permissions select list field. To select an item from this field you’ll need to include Watir’s .select method in your test script step, like this: page_object.existing_doc_permissions.select “option”



127
128
129
130
131
132
133
134
135
136
137
138
139
# File 'lib/sakai-oae-test-api/pop_up_dialogs.rb', line 127

def existing_doc_permissions
  a = "addarea_existing_mylibrary_container"
  b = "addarea_existing_everywhere_container"
  c = "addarea_existing_currentlyviewing_container"
  case
    when self.div(:id=>a).visible?
      return self.div(:id=>a).select(:name=>"addarea_existing_permissions")
    when self.div(:id=>b).visible?
      return self.div(:id=>b).select(:name=>"addarea_existing_permissions")
    when self.div(:id=>c).visible?
      return self.div(:id=>c).select(:name=>"addarea_existing_permissions")
  end
end

#list_categoriesObject

Clicks the list categories link.



91
92
93
94
95
# File 'lib/sakai-oae-test-api/pop_up_dialogs.rb', line 91

def list_categories
  self.list_categories_button
  self.wait_for_ajax
  self.class.class_eval { include AddRemoveCategories }
end

#participants_list_nameObject

The name field for adding a Participant List page. Use of this method in a test script will require including a Watir method. For example, if you want to send the field a text string, you’ll use the .set method, like this: page_object.participants_list_name.set “Name”



169
170
171
# File 'lib/sakai-oae-test-api/pop_up_dialogs.rb', line 169

def participants_list_name
  self.text_field(:id=>"addarea_participants_name")
end

#participants_list_permissionsObject

The permissions field for adding a Participants List page. Use of this method in a test script will require including a Watir method. For example, if you want to send the field a text string, you’ll use the .set method, like this: page_object.participants_list_permissions.select “Option”



177
178
179
# File 'lib/sakai-oae-test-api/pop_up_dialogs.rb', line 177

def participants_list_permissions
  @browser.select(:id=>"addarea_participants_permissions")
end

#search_everywhereObject

The “Search Everywhere” text field. Due to a strange bug with Watir-webdriver and/or PageObject, we’re using this method for the definition of the field, so if you need to enter a text string into it you’ll need to use Watir-webdriver’s “.set” method, like this: page_object.search_everywhere.set “text string”



102
103
104
# File 'lib/sakai-oae-test-api/pop_up_dialogs.rb', line 102

def search_everywhere
  self.text_field(:id=>"addarea_existing_everywhere_search")
end

#search_resultsObject

The div containing the search results list. This method is primarily for use in the procedural methods in this module rather than for steps in a test script (because it only refers to the “Everywhere” list.



145
146
147
# File 'lib/sakai-oae-test-api/pop_up_dialogs.rb', line 145

def search_results
  self.div(:id=>"addarea_existing_everywhere_bottom")
end

#select_widgetObject

The select list field for selecting the widget. When using this method directly, be sure to remember that it will require Watir-webdriver methods, as well. However, it should not be necessary to call this method directly, as it is used as a helper for other methods in this class.



193
194
195
# File 'lib/sakai-oae-test-api/pop_up_dialogs.rb', line 193

def select_widget
  self.select(:id=>"addarea_widgets_widget")
end

#widget_nameObject

The text field for entering the widget name. When using this method directly, be sure to remember that it will require Watir-webdriver methods, as well. However, it should not be necessary to call this method directly, as it is used as a helper for other methods in this class.



185
186
187
# File 'lib/sakai-oae-test-api/pop_up_dialogs.rb', line 185

def widget_name
  self.text_field(:id=>"addarea_widgets_name")
end

#widget_permissionsObject

The select list for defining the widget permissions. When using this method directly, be sure to remember that it will require Watir-webdriver methods, as well. However, it should not be necessary to call this method directly, as it is used as a helper for other methods in this class.



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

def widget_permissions
  self.select(:id=>"addarea_widgets_permissions")
end