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



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

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



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

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.



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

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



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

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.



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

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