Module: LeftMenuBar

Overview

Modules for the most robust Left Menu Bar–the one that has context menus attached to each of the bar’s items, and is found in the context of a particular Course, Group, or Research.

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_new_areaObject Also known as: add_a_new_area, add_new_page

Clicks the “Add a new area” button.



406
407
408
409
410
# File 'lib/sakai-oae-test-api/toolbars_and_menus.rb', line 406

def add_new_area
  self.button(:id=>"group_create_new_area", :class=>"s3d-button s3d-header-button s3d-popout-button").click
  self.wait_for_ajax
  self.class.class_eval { include AddAreasPopUp }
end

#change_title_of(from_string, to_string) ⇒ Object Also known as: change_title

Changes the title of the specified page (“from_string”) to the string value specified by to_string.



346
347
348
349
350
351
352
353
354
# File 'lib/sakai-oae-test-api/toolbars_and_menus.rb', line 346

def change_title_of(from_string, to_string)
  self.link(:class=>/lhnavigation_page_title_value/, :text=>from_string).hover
  self.wait_for_ajax #.wait_until { self.link(:class=>/lhnavigation_page_title_value/, :text=>from_string).parent.div(:class=>"lhnavigation_selected_submenu_image").visible? }
  self.div(:class=>"lhnavigation_selected_submenu_image").hover
  self.execute_script("$('#lhnavigation_submenu').css({left:'300px', top:'300px', display: 'block'})")
  self.wait_for_ajax #.wait_until { self.link(:id=>"lhavigation_submenu_edittitle").visible? }
  self.link(:id=>"lhavigation_submenu_edittitle").click
  self.link(:class=>/lhnavigation_page_title_value/, :text=>from_string).parent.text_field(:class=>"lhnavigation_change_title").set("#{to_string}\n")
end

#delete_page(page_name) ⇒ Object

Deletes the page specified by page_name.



359
360
361
362
363
364
365
366
367
368
# File 'lib/sakai-oae-test-api/toolbars_and_menus.rb', line 359

def delete_page(page_name)
  self.link(:class=>/lhnavigation_page_title_value/, :text=>page_name).fire_event("onmouseover")
  self.wait_for_ajax #.wait_until { self.link(:class=>/lhnavigation_page_title_value/, :text=>page_name).parent.div(:class=>"lhnavigation_selected_submenu_image").visible? }
  self.div(:class=>"lhnavigation_selected_submenu_image").hover
  self.execute_script("$('#lhnavigation_submenu').css({left:'300px', top:'300px', display: 'block'})")
  self.wait_for_ajax #.wait_until { self.link(:id=>"lhavigation_submenu_edittitle").visible? }
  self.link(:id=>"lhavigation_submenu_deletepage").click
  self.wait_for_ajax
  self.class.class_eval { include DeletePagePopUp }
end

#expand(name) ⇒ Object

Use this to click left menu items that refer to multi-paged documents. It expands the menu to display the document’s sub-pages.



340
341
342
# File 'lib/sakai-oae-test-api/toolbars_and_menus.rb', line 340

def expand(name)
  self.div(:id=>"lhnavigation_container").link(:text=>name).click
end

Returns true if the specified page name appears in the list of items in the Left menu bar. Returns false if the specified menu can’t be found. TODO - should be re-written to work more like the typical Ruby question-mark method: Should be applied to the string being tested, not the browser object.

Returns:

  • (Boolean)


432
433
434
435
436
437
438
439
# File 'lib/sakai-oae-test-api/toolbars_and_menus.rb', line 432

def menu_available?(page_name)
  self.link(:class=>/lhnavigation_page_title_value/, :text=>page_name).fire_event("onmouseover")
  if self.link(:class=>/lhnavigation_page_title_value/, :text=>page_name).parent.div(:class=>"lhnavigation_selected_submenu_image").visible?
    return true
  else
    return false
  end
end

#permissions_for_page(page_name) ⇒ Object Also known as: permissions_of_page, page_permissions

Opens the Permissions Pop Up for the specified Page.



371
372
373
374
375
376
377
378
379
380
381
# File 'lib/sakai-oae-test-api/toolbars_and_menus.rb', line 371

def permissions_for_page(page_name)
  self.link(:class=>/lhnavigation_page_title_value/, :text=>page_name).fire_event("onmouseover")
  self.wait_until { self.link(:class=>/lhnavigation_page_title_value/, :text=>page_name).parent.div(:class=>"lhnavigation_selected_submenu_image").visible? }
  self.div(:class=>"lhnavigation_selected_submenu_image").hover
  self.execute_script("$('#lhnavigation_submenu').css({left:'328px', top:'349px', display: 'block'})")
  self.wait_until { self.link(:id=>"lhavigation_submenu_edittitle").visible? }
  self.link(:id=>"lhnavigation_submenu_permissions").click
  sleep 0.2
  self.wait_for_ajax
  self.class.class_eval { include PermissionsPopUp }
end

#public_pagesObject Also known as: pages, areas

Returns an array containing the Course/Group area/page titles.



416
417
418
419
420
421
422
# File 'lib/sakai-oae-test-api/toolbars_and_menus.rb', line 416

def public_pages
  list = []
  self.div(:id=>"lhnavigation_public_pages").links.each do |link|
    list << link.text
  end
  return list
end

#view_profile_of_page(page_name) ⇒ Object Also known as: view_profile_for_page, view_page_profile

Opens the Profile Details for the specified Page by opening the page’s drop-down menu in the left menu bar, clicking “View Profile”, and then switching to the new browser tab/window that gets opened.



390
391
392
393
394
395
396
397
398
399
400
# File 'lib/sakai-oae-test-api/toolbars_and_menus.rb', line 390

def view_profile_of_page(page_name)
  self.link(:class=>/lhnavigation_page_title_value/, :text=>page_name).fire_event("onmouseover")
  self.wait_for_ajax #.wait_until { self.link(:class=>/lhnavigation_page_title_value/, :text=>page_name).parent.div(:class=>"lhnavigation_selected_submenu_image").visible? }
  self.div(:class=>"lhnavigation_selected_submenu_image").hover
  self.execute_script("$('#lhnavigation_submenu').css({left:'328px', top:'349px', display: 'block'})")
  self.wait_for_ajax #.wait_until { self.link(:id=>"lhavigation_submenu_edittitle").visible? }
  self.link(:id=>"lhnavigation_submenu_profile").click
  self.wait_for_ajax #.button(:title=>"Show debug info").wait_until_present
  self.window(:title=>"rSmart | Content Profile").use
  ContentDetailsPage.new self
end