Module: PopulationsSearch

Included in:
ActivePopulationLookup, ManagePopulations
Defined in:
lib/sambal-kuali/base_page_classes.rb

Constant Summary collapse

POPULATION_NAME =

Results Table Columns…

1
POPULATION_DESCRIPTION =
2
POPULATION_TYPE =
3
POPULATION_STATE =
4

Instance Method Summary collapse

Instance Method Details

#edit(name) ⇒ Object

Clicks the ‘edit’ link for the named item in the results table



64
65
66
67
68
69
# File 'lib/sambal-kuali/base_page_classes.rb', line 64

def edit(name)
  target_row(name).wait_until_present
  target_row(name).link(text: "edit").click
  loading.wait_while_present
  sleep 0.5 # Needed because the text doesn't immediately appear in the Populations field for some reason
end

#results_descriptionsObject



97
98
99
100
101
102
103
# File 'lib/sambal-kuali/base_page_classes.rb', line 97

def results_descriptions
  descriptions = []
  results_table.wait_until_present
  results_table.rows.each { |row| descriptions << row[POPULATION_DESCRIPTION].text }
  descriptions.delete_if { |description| description == "" }
  descriptions
end

#results_listObject Also known as: results_names

Returns an array containing the names of the items returned in the search



87
88
89
90
91
92
93
94
# File 'lib/sambal-kuali/base_page_classes.rb', line 87

def results_list
  names = []
  results_table.wait_until_present
  results_table.rows.each { |row| names << row[POPULATION_NAME].text }
  names.delete_if { |name| name == "" }
  names.delete_if { |name| name == "Name" }
  names
end

#results_statesObject



105
106
107
108
109
110
111
112
# File 'lib/sambal-kuali/base_page_classes.rb', line 105

def results_states
  states = []
  results_table.wait_until_present
  results_table.rows.each { |row| states << row[POPULATION_STATE].text }
  states.delete_if { |state| state == "" }
  states.delete_if { |state| state == "State" }
  states
end

#return_value(name) ⇒ Object

Clicks the ‘return value’ link for the named row



52
53
54
55
56
57
58
59
60
61
# File 'lib/sambal-kuali/base_page_classes.rb', line 52

def return_value(name)
  target_row(name).wait_until_present
  target_row(name).link(text: "return value").wait_until_present
  begin
    target_row(name).link(text: "return value").click
  rescue Timeout::Error => e
    puts "rescued target_row(name).link(text: return value).click"
  end
  loading.wait_while_present
end

#status(name) ⇒ Object

Returns the status of the named item from the results table. Note that this method assumes that the specified item is actually listed in the results table.



81
82
83
84
# File 'lib/sambal-kuali/base_page_classes.rb', line 81

def status(name)
  target_row(name).wait_until_present
  target_row(name)[POPULATION_STATE].text
end

#view(name) ⇒ Object

Clicks the link for the named item in the results table



72
73
74
75
76
# File 'lib/sambal-kuali/base_page_classes.rb', line 72

def view(name)
  target_row(name).wait_until_present
  results_table.link(text: name).click
  loading.wait_while_present
end