Module: AssignmentStudentMethods
- Includes:
- PageObject
- Defined in:
- lib/kuali-sakai-common-lib/assignments.rb
Overview
A Student user’s page for editing/submitting/view an assignment.
Constant Summary collapse
- @@file_number =
This class variable allows adding an arbitrary number of files to the page, as long as the adding steps alternate between selecting the file and clicking the add more files button
0
Class Method Summary collapse
Instance Method Summary collapse
-
#assignment_text=(text) ⇒ Object
Enters the specified text into the Assignment Text FCKEditor.
-
#back_to_list ⇒ Object
Clicks the Back to list button, then instantiates the AssignmentList page class.
-
#cancel ⇒ Object
Clicks the Cancel button and instantiates the AssignmentsList Class.
-
#header ⇒ Object
Returns the text content of the page header.
-
#instructor_comments ⇒ Object
Grabs the instructor comments text.
-
#item_summary ⇒ Object
Returns a hash object containing the contents of the Item Summary table.
-
#preview ⇒ Object
Clicks the Preview button, then instantiates the AssignmentStudentPreview page class.
-
#remove_assignment_text ⇒ Object
Clears out any existing text from the Assignment Text FCKEditor.
-
#resubmit ⇒ Object
Clicks the Resubmit button, then instantiates the appropriate page class, based on the page that gets loaded.
-
#save_draft ⇒ Object
Clicks the Save Draft button, then instantiates the SubmissionConfirmation page class.
-
#select_file(file_name, file_path = "") ⇒ Object
Enters the specified file name into the file field.
-
#select_more_files_from_workspace ⇒ Object
Clicks the link to select more files from the Workspace.
-
#submit ⇒ Object
Clicks the Submit button, then instantiates the appropriate page class, based on the page that gets loaded.
Class Method Details
.page_elements(identifier) ⇒ Object
605 606 607 608 609 |
# File 'lib/kuali-sakai-common-lib/assignments.rb', line 605 def self.page_elements(identifier) in_frame(identifier) do |frame| link(:add_another_file, :id=>"addMoreAttachmentControls", :frame=>frame) end end |
Instance Method Details
#assignment_text=(text) ⇒ Object
Enters the specified text into the Assignment Text FCKEditor.
504 505 506 |
# File 'lib/kuali-sakai-common-lib/assignments.rb', line 504 def assignment_text=(text) frm.frame(:id, "Assignment.view_submission_text___Frame").td(:id, "xEditingArea").frame(:index=>0).send_keys(text) end |
#back_to_list ⇒ Object
Clicks the Back to list button, then instantiates the AssignmentList page class.
593 594 595 596 |
# File 'lib/kuali-sakai-common-lib/assignments.rb', line 593 def back_to_list frm.(:value=>"Back to list").click AssignmentsList.new(@browser) end |
#cancel ⇒ Object
Clicks the Cancel button and instantiates the AssignmentsList Class.
600 601 602 603 |
# File 'lib/kuali-sakai-common-lib/assignments.rb', line 600 def cancel frm.(:value=>"Cancel").click AssignmentsList.new(@browser) end |
#header ⇒ Object
Returns the text content of the page header
484 485 486 |
# File 'lib/kuali-sakai-common-lib/assignments.rb', line 484 def header frm.div(:class=>"portletBody").h3.text end |
#instructor_comments ⇒ Object
Grabs the instructor comments text.
499 500 501 |
# File 'lib/kuali-sakai-common-lib/assignments.rb', line 499 def instructor_comments frm.div(:class=>"portletBody").div(:class=>"textPanel", :index=>2).text end |
#item_summary ⇒ Object
Returns a hash object containing the contents of the Item Summary table. The hash’s Key is the header column and the value is the content column.
490 491 492 493 494 495 496 |
# File 'lib/kuali-sakai-common-lib/assignments.rb', line 490 def item_summary hash = {} frm.table(:class=>"itemSummary").rows.each do |row| hash.store(row.th.text, row.td.text) end return hash end |
#preview ⇒ Object
Clicks the Preview button, then instantiates the AssignmentStudentPreview page class.
Resets @@file_number to zero so that file uploads will work if this page is visited again in the same script.
569 570 571 572 573 |
# File 'lib/kuali-sakai-common-lib/assignments.rb', line 569 def preview frm.(:value=>"Preview").click @@file_number=0 AssignmentStudentPreview.new(@browser) end |
#remove_assignment_text ⇒ Object
Clears out any existing text from the Assignment Text FCKEditor.
509 510 511 512 |
# File 'lib/kuali-sakai-common-lib/assignments.rb', line 509 def remove_assignment_text frm.frame(:id, "Assignment.view_submission_text___Frame").div(:title=>"Select All").fire_event("onclick") frm.frame(:id, "Assignment.view_submission_text___Frame").td(:id, "xEditingArea").frame(:index=>0).send_keys :backspace end |
#resubmit ⇒ Object
Clicks the Resubmit button, then instantiates the appropriate page class, based on the page that gets loaded.
Resets @@file_number to zero so that file uploads will work if this page is visited again in the same script.
552 553 554 555 556 557 558 559 560 561 |
# File 'lib/kuali-sakai-common-lib/assignments.rb', line 552 def resubmit frm.(:value=>"Resubmit").click @@file_number=0 if frm.link(:text=>"Assignment title").exist? puts "list..." AssessmentsList.new(@browser) else SubmissionConfirmation.new(@browser) end end |
#save_draft ⇒ Object
Clicks the Save Draft button, then instantiates the SubmissionConfirmation page class.
578 579 580 581 |
# File 'lib/kuali-sakai-common-lib/assignments.rb', line 578 def save_draft frm.(:value=>"Save Draft").click SubmissionConfirmation.new(@browser) end |
#select_file(file_name, file_path = "") ⇒ Object
Enters the specified file name into the file field. Entering the path separately is optional. Once the filename is entered in the field, the @@file_number class variable is increased by one in case any more files need to be added to the upload list.
525 526 527 528 |
# File 'lib/kuali-sakai-common-lib/assignments.rb', line 525 def select_file(file_name, file_path="") frm.file_field(:id=>"clonableUpload", :name=>"upload#{@@file_number}").set(file_path + file_name) @@file_number += 1 end |
#select_more_files_from_workspace ⇒ Object
Clicks the link to select more files from the Workspace. Then instantiates the AssignmentAttachments page class.
586 587 588 589 |
# File 'lib/kuali-sakai-common-lib/assignments.rb', line 586 def select_more_files_from_workspace frm.link(:id=>"attach").click AssignmentAttachments.new(@browser) end |
#submit ⇒ Object
Clicks the Submit button, then instantiates the appropriate page class, based on the page that gets loaded.
533 534 535 536 537 538 539 540 541 542 543 |
# File 'lib/kuali-sakai-common-lib/assignments.rb', line 533 def submit frm.(:value=>"Submit").click @@file_number=0 if frm.div(:class=>"portletBody").h3.text=~/Submission Confirmation/ SubmissionConfirmation.new(@browser) elsif frm.(:value=>"Back to list").exist? SubmissionConfirmation.new(@browser) else AssessmentsList.new(@browser) end end |