Class: ScheduleOfClasses

Inherits:
Object
  • Object
show all
Includes:
DataFactory, DateFactory, Foundry, StringFactory, Workflows
Defined in:
lib/sambal-kuali/data_objects/schedule_of_classes.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Workflows

#go_to_academic_calendar, #go_to_calendar_search, #go_to_create_course_offerings, #go_to_create_population, #go_to_display_schedule_of_classes, #go_to_holiday_calendar, #go_to_manage_course_offerings, #go_to_manage_population, #go_to_perform_rollover, #go_to_rollover_details, #log_in, #logged_in_user

Constructor Details

#initialize(browser, opts = {}) ⇒ ScheduleOfClasses

Returns a new instance of ScheduleOfClasses.



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/sambal-kuali/data_objects/schedule_of_classes.rb', line 18

def initialize(browser, opts={})
  @browser = browser

  defaults = {
      :term=>"Spring 2012",
      :course_search_parm=>"ENGL103",
      :department_short_name=>"ENGL",
      :instructor_principal_name=>"B.JOHND",
      :keyword=>"WRITING FROM SOURCES" ,
      :type_of_search=>"Course",    #Course, Department, Instructor, Title & Description
      :exp_course_list=>["ENGL103"]
  }
  options = defaults.merge(opts)
  set_options(options)
end

Instance Attribute Details

#course_search_parmObject

Returns the value of attribute course_search_parm.



9
10
11
# File 'lib/sambal-kuali/data_objects/schedule_of_classes.rb', line 9

def course_search_parm
  @course_search_parm
end

#department_short_nameObject

Returns the value of attribute department_short_name.



9
10
11
# File 'lib/sambal-kuali/data_objects/schedule_of_classes.rb', line 9

def department_short_name
  @department_short_name
end

#exp_course_listObject

Returns the value of attribute exp_course_list.



9
10
11
# File 'lib/sambal-kuali/data_objects/schedule_of_classes.rb', line 9

def exp_course_list
  @exp_course_list
end

#instructor_long_nameObject

Returns the value of attribute instructor_long_name.



9
10
11
# File 'lib/sambal-kuali/data_objects/schedule_of_classes.rb', line 9

def instructor_long_name
  @instructor_long_name
end

#instructor_principal_nameObject

Returns the value of attribute instructor_principal_name.



9
10
11
# File 'lib/sambal-kuali/data_objects/schedule_of_classes.rb', line 9

def instructor_principal_name
  @instructor_principal_name
end

#keywordObject

Returns the value of attribute keyword.



9
10
11
# File 'lib/sambal-kuali/data_objects/schedule_of_classes.rb', line 9

def keyword
  @keyword
end

#termObject

Returns the value of attribute term.



9
10
11
# File 'lib/sambal-kuali/data_objects/schedule_of_classes.rb', line 9

def term
  @term
end

#type_of_searchObject

Returns the value of attribute type_of_search.



9
10
11
# File 'lib/sambal-kuali/data_objects/schedule_of_classes.rb', line 9

def type_of_search
  @type_of_search
end

Instance Method Details

#check_expected_resultsObject



81
82
83
84
85
86
87
# File 'lib/sambal-kuali/data_objects/schedule_of_classes.rb', line 81

def check_expected_results
  on DisplayScheduleOfClasses do |page|
    @exp_course_list.each do |course_code|
      raise "correct course not found" unless page.target_course_row(course_code).exists?
    end
  end
end

#check_results_for_instructorObject



115
116
117
118
119
120
121
122
123
124
125
126
127
# File 'lib/sambal-kuali/data_objects/schedule_of_classes.rb', line 115

def check_results_for_instructor
  course_list = []
  on DisplayScheduleOfClasses do |page|
    course_list = page.get_results_course_list
    course_list.each do |course_code|
      page.course_expand(course_code)
      raise "error expanding course details for #{course_code}"  unless page.course_ao_information_table(course_code).exists?
      instructor_list = page.get_instructor_list(course_code)
      raise "data validation issues: instructor #{@instructor_long_name} not found for course: #{course_code}" unless  instructor_list.include?(@instructor_long_name)
      page.course_expand(course_code) #closes details
    end
  end
end

#check_results_for_subject_code_match(subject_code) ⇒ Object



73
74
75
76
77
78
79
# File 'lib/sambal-kuali/data_objects/schedule_of_classes.rb', line 73

def check_results_for_subject_code_match(subject_code)
  on DisplayScheduleOfClasses do |page|
    page.get_results_course_list.each do |course_code|
      raise "correct subject prefix not found for #{course_code}" unless course_code.match /^#{subject_code}/
    end
  end
end

#department_lookup(short_name) ⇒ Object



50
51
52
53
54
55
56
57
58
59
# File 'lib/sambal-kuali/data_objects/schedule_of_classes.rb', line 50

def department_lookup(short_name)
  on  DisplayScheduleOfClasses do |page|
    page.department_search_lookup
  end
  on DepartmentLookup do |page|
    page.short_name.set(short_name)
    page.search
    page.return_value(short_name)
  end
end

#displayObject



34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/sambal-kuali/data_objects/schedule_of_classes.rb', line 34

def display
  on DisplayScheduleOfClasses do |page|
    page.term.select @term
    page.select_type_of_search(@type_of_search)
    case @type_of_search
      when "Course" then page.course_search_parm.set @course_search_parm
      when "Instructor" then instructor_lookup(@instructor_principal_name)
      when "Department" then department_lookup(@department_short_name)
      when "Title & Description" then page.title_description_search_parm.set @keyword
      else raise "ScheduleOfClasses - search type not recognized"
    end

    page.show
  end
end

#expand_all_course_detailsObject



96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
# File 'lib/sambal-kuali/data_objects/schedule_of_classes.rb', line 96

def expand_all_course_details
  on DisplayScheduleOfClasses do |page|
    list_of_courses = page.get_results_course_list()
    page.get_results_course_list().each do |course|
      page.course_expand(course)
      if !page.course_ao_information_table(course).exists?
        puts "error expanding course details for #{course}"
        #need to re-login after stacktrace
         "admin", "admin"
        go_to_display_schedule_of_classes
        display
      else
        page.course_expand(course) #collapses
      end
    end
  end
end

#expand_course_detailsObject



89
90
91
92
93
94
# File 'lib/sambal-kuali/data_objects/schedule_of_classes.rb', line 89

def expand_course_details
  on DisplayScheduleOfClasses do |page|
    page.course_expand(@exp_course_list[0])
    raise "error expanding course details for #{@exp_course_list[0]}"  unless page.course_ao_information_table(@exp_course_list[0]).exists?
  end
end

#instructor_lookup(principal_name) ⇒ Object



61
62
63
64
65
66
67
68
69
70
71
# File 'lib/sambal-kuali/data_objects/schedule_of_classes.rb', line 61

def instructor_lookup(principal_name)
  on  DisplayScheduleOfClasses do |page|
    page.instructor_search_lookup
  end
  on PersonnelLookup do |page|
    page.principal_name.set(principal_name)
    page.search
    @instructor_long_name = page.get_long_name(principal_name)
    page.return_value(principal_name)
  end
end