Module: AddRemoveWidgets

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

Overview

Page Objects and Methods related to the “Add widgets” pop-up on the Dashboard

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_all_widgetsObject

Adds all widgets to the dashboard



459
460
461
462
463
464
465
466
467
# File 'lib/sakai-oae-test-api/pop_up_dialogs.rb', line 459

def add_all_widgets
  array = self.div(:id=>"add_goodies_body").lis.select { |li| li.class_name == "add" }
  sub_array = array.select { |li| li.visible? }
  sub_array.each do |li|
    li.button(:text=>"Add").click
    self.wait_for_ajax
  end
  close_add_widget
end

#add_widget(name) ⇒ Object

Clicks the “Add” button for the specified widget



481
482
483
# File 'lib/sakai-oae-test-api/pop_up_dialogs.rb', line 481

def add_widget(name)
  self.div(:id=>"add_goodies_body").li(:text=>/#{Regexp.escape(name)}/).button.click
end

#close_add_widgetObject

Clicks the Close button on the dialog for adding/removing widgets to/from the Dashboard. Returns the MyDashboard class object.



452
453
454
455
456
# File 'lib/sakai-oae-test-api/pop_up_dialogs.rb', line 452

def close_add_widget
  self.div(:class=>"s3d-dialog-close jqmClose").fire_event("onclick")
  self.wait_for_ajax
  MyDashboard.new @browser
end

#remove_all_widgetsObject

Removes all widgets from the dashboard



470
471
472
473
474
475
476
477
478
# File 'lib/sakai-oae-test-api/pop_up_dialogs.rb', line 470

def remove_all_widgets
  array = self.div(:id=>"add_goodies_body").lis.select { |li| li.class_name == "remove" }
  sub_array = array.select { |li| li.visible? }
  sub_array.each do |li|
    li.button(:text=>"Remove").click
    self.wait_for_ajax
  end
  close_add_widget
end

#remove_widget(name) ⇒ Object

Unchecks the checkbox for the specified widget.



486
487
488
# File 'lib/sakai-oae-test-api/pop_up_dialogs.rb', line 486

def remove_widget(name)
  self.div(:id=>"add_goodies_body").li(:text=>/#{Regexp.escape(name)}/, :id=>/_remove_/).button.click
end