Class: EditAssessment

Inherits:
AssessmentsBase show all
Defined in:
lib/sakai-cle-test-api/page_objects/assessments.rb

Overview

The page that appears when you’re creating a new quiz or editing an existing one

Instance Method Summary collapse

Methods inherited from AssessmentsBase

menu_bar_elements, pool_page_elements, question_page_elements

Methods inherited from BasePage

basic_page_elements, frame_element

Methods inherited from PageMaker

element, expected_element, expected_title, #initialize, #method_missing, page_url

Constructor Details

This class inherits a constructor from PageMaker

Dynamic Method Handling

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

Instance Method Details

#add_partObject

Clicks the Add Part button, then instantiates the AddEditAssessmentPart page class.



349
350
351
352
# File 'lib/sakai-cle-test-api/page_objects/assessments.rb', line 349

def add_part
  frm.link(:text=>"Add Part").click
  AddEditAssessmentPart.new(@browser)
end

#copy_part_to_pool(part_num) ⇒ Object

Allows copying an Assessment part to a Pool.

Parameters:

  • part_num (String)

    the part number of the assessment you want



336
337
338
# File 'lib/sakai-cle-test-api/page_objects/assessments.rb', line 336

def copy_part_to_pool(part_num)
  frm.link(:id=>"assesssmentForm:parts:#{part_num.to_i-1}:copyToPool").click
end

#edit_question(part_num, question_num) ⇒ Object

Allows editing of a question by specifying its part number and question number.

Parameters:

  • part_num (String)

    the Part number containing the question you want

  • question_num (String)

    the number of the question you want



330
331
332
# File 'lib/sakai-cle-test-api/page_objects/assessments.rb', line 330

def edit_question(part_num, question_num)
  frm.link(:id=>"assesssmentForm:parts:#{part_num.to_i-1}:parts:#{question_num.to_i-1}:modify").click
end

#get_question_text(part_number, question_number) ⇒ Object

Allows retrieval of a specified question’s text, by part and question number.

Parameters:

  • part_num (String)

    the Part number containing the question you want

  • question_num (String)

    the number of the question you want



390
391
392
# File 'lib/sakai-cle-test-api/page_objects/assessments.rb', line 390

def get_question_text(part_number, question_number)
  frm.table(:id=>"assesssmentForm:parts:#{part_number.to_i-1}:parts").div(:class=>"tier3", :index=>question_number.to_i-1).text
end

#insert_question_after(part_num, question_num, qtype) ⇒ Object

Allows insertion of a question at a specified point in the Assessment. Must include the part number, the question number, and the type of question. Question Type must match the Type value in the drop down.



311
312
313
314
315
316
317
# File 'lib/sakai-cle-test-api/page_objects/assessments.rb', line 311

def insert_question_after(part_num, question_num, qtype)
  if question_num.to_i == 0
    frm.select(:id=>"assesssmentForm:parts:#{part_num.to_i - 1}:changeQType").select(qtype)
  else
    frm.select(:id=>"assesssmentForm:parts:#{part_num.to_i - 1}:parts:#{question_num.to_i - 1}:changeQType").select(qtype)
  end
end

#previewObject

Clicks the Preview button, then instantiates the PreviewOverview page class.



360
361
362
363
# File 'lib/sakai-cle-test-api/page_objects/assessments.rb', line 360

def preview
  frm.link(:text=>"Preview").click
  PreviewOverview.new(@browser)
end

#publishObject

Clicks the Publish button, then instantiates the PublishAssessment page class.



374
375
376
377
# File 'lib/sakai-cle-test-api/page_objects/assessments.rb', line 374

def publish
  frm.link(:text=>"Publish").click
  PublishAssessment.new(@browser)
end

#question_poolsObject

Clicks the Question Pools button, then instantiates the QuestionPoolsList page class.



381
382
383
384
# File 'lib/sakai-cle-test-api/page_objects/assessments.rb', line 381

def question_pools
  frm.link(:text=>"Question Pools").click
  QuestionPoolsList.new(@browser)
end

#remove_part(part_num) ⇒ Object

Allows removing a specified Assessment part number.

Parameters:

  • part_num (String)

    the part number of the assessment you want



343
344
345
# File 'lib/sakai-cle-test-api/page_objects/assessments.rb', line 343

def remove_part(part_num)
  frm.link(:xpath, "//a[contains(@onclick, 'assesssmentForm:parts:#{part_num.to_i-1}:copyToPool')]").click
end

#remove_question(part_num, question_num) ⇒ Object

Allows removal of question by part number and question number.

Parameters:

  • part_num (String)

    the Part number containing the question you want to remove

  • question_num (String)

    the number of the question you want to remove



322
323
324
# File 'lib/sakai-cle-test-api/page_objects/assessments.rb', line 322

def remove_question(part_num, question_num)
  frm.link(:id=>"assesssmentForm:parts:#{part_num.to_i-1}:parts:#{question_num.to_i-1}:deleteitem").click
end

#settingsObject

Clicks the Settings link, then instantiates the AssessmentSettings page class.



367
368
369
370
# File 'lib/sakai-cle-test-api/page_objects/assessments.rb', line 367

def settings
  frm.link(:text=>"Settings").click
  AssessmentSettings.new(@browser)
end