class AdminModule::Pages::WorkflowDetailTaskMappingsPage

Public Instance Methods

back() click to toggle source
# File lib/admin_module/pages/workflow_detail_task_mappings_page.rb, line 64
def back
  self.back_button
end
get_data() click to toggle source
# File lib/admin_module/pages/workflow_detail_task_mappings_page.rb, line 52
def get_data
  get_tasks_details
end
set_data(data) click to toggle source
# File lib/admin_module/pages/workflow_detail_task_mappings_page.rb, line 56
def set_data data
  if !error_span? || !error_span.include?('No task defined')
    set_tasks_details data
  end

  self
end

Private Instance Methods

capture_details() click to toggle source

Build a list of objects containing task detail data.

We use this method even though we don’t need to (for get_xxx) because we’ll need the captured field ids for setting values.

# File lib/admin_module/pages/workflow_detail_task_mappings_page.rb, line 142
def capture_details
  details = []

  Nokogiri::HTML(@browser.html).css("#ctl00_cntPlh_gvScreenMapping>tbody>tr").each do |tr|
    # Skip the header row
    next if tr['class'] == 'GridHeader'

    detail = TaskDetail.new
    detail.sequence = tr.css("td:nth-child(1)").text
    detail.name = tr.css("td:nth-child(2)").text
    detail.mapped_screens = tr.css("td:nth-child(3)").text
    detail.edit_button_id = tr.css("td:nth-child(4)>input")[0]['id']

    details << detail
  end # css

  details
end
details_table() click to toggle source
# File lib/admin_module/pages/workflow_detail_task_mappings_page.rb, line 70
def details_table
  table_elements[0].table_elements[1]
end
get_tasks_details() click to toggle source
# File lib/admin_module/pages/workflow_detail_task_mappings_page.rb, line 74
def get_tasks_details
  details = Hash.new

  capture_details.each do |item|
    details[item.name] = item.to_hsh
  end

  details
end
set_screen_mappings(btn_id, screens) click to toggle source
# File lib/admin_module/pages/workflow_detail_task_mappings_page.rb, line 84
def set_screen_mappings btn_id, screens
  btn = button_elements(id: btn_id)[0]
  btn.click

  WorkflowDetailTaskScreensPage.new(@browser, false)
    .set_screens(screens)
    .save

  self
end
set_tasks_details(details) click to toggle source
# File lib/admin_module/pages/workflow_detail_task_mappings_page.rb, line 95
def set_tasks_details details
  capture_details.each do |item|
    details.each do |dtl|
      if dtl[:name] == item.name
        # We've found a match, see if the mapping screens value matches
        if item.screens != dtl[:mapped_screens]
          # Not a match, we need to change it so find the button
          set_screen_mappings item.edit_button_id, dtl[:mapped_screens]
        end

        break
      end
    end
  end

  self
end