Advertisement
Guest User

Untitled

a guest
Apr 23rd, 2018
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 7.39 KB | None | 0 0
  1. features/support/step_definitions/management_steps.rb
  2.  
  3. When(/^I submit \[Create New Task\] form using the following data:$/) do |table|
  4.   step "I click ['New Task'] button"
  5.   step 'I fill [Create New Task] form using the following data:', table
  6.   step "I click ['Create Task'] button"
  7. end
  8.  
  9. When(/^I fill \[Create New Task\] form using the following data:$/) do |table|
  10.   wait_until('Create New Task form is not opened') { @vh.create_new_task_page.sel_client.visible? == true }
  11.   wait_until('Create New Task form is not opened') { @vh.create_new_task_page.sel_assign_disabled.visible? == true }
  12.   table.hashes.each do |task|
  13.     client = task[:client]
  14.     assigned_to = task[:assigned_to]
  15.     due_date = task[:due_date]
  16.     task_type = task[:task_type]
  17.     task_description = task[:task_description]
  18.     priority = task[:priority]
  19.  
  20.     @vh.create_new_task_page.select_client client
  21.     @vh.create_new_task_page.select_assigned_to assigned_to
  22.     @vh.create_new_task_page.select_task_priority priority
  23.     @vh.create_new_task_page.select_task_type task_type
  24.     @vh.create_new_task_page.txt_due_date.set convert_date(due_date, '%m/%d/%Y') if due_date
  25.     @vh.create_new_task_page.txt_task_descr.set unique_value(task_description) if task_description
  26.     @vh.create_new_task_page.btn_create_task
  27.   end
  28. end
  29.  
  30. When(/^I perform task search using the following data:$/) do |table|
  31.   step 'I fill tasks search form using the following data:', table
  32.   step "I click ['Search Task'] button"
  33. end
  34.  
  35. When(/^I fill tasks search form using the following data:$/) do |table|
  36.   @vh.tasks_page.wait_for_search_client_name_field
  37.   table.hashes.each do |task|
  38.     client = task[:client]
  39.     due_date_from = task[:due_date_from]
  40.  
  41.     @vh.tasks_page.select_client_name(client)
  42.     @vh.tasks_page.txt_due_date_from.set convert_date(due_date_from, '%m/%d/%Y')
  43.   end
  44. end
  45.  
  46. Then(/^I should see task in the task list with the following data:$/) do |table|
  47.   table.hashes.each do |task|
  48.     client = task[:client]
  49.     assigned_to = task[:assigned_to]
  50.     due_date = task[:due_date]
  51.     task_type = task[:task_type]
  52.     task_description = task[:task_description]
  53.     priority = task[:priority]
  54.     created_by = task[:created_by]
  55.  
  56.     @vh.tasks_page.task_column(assigned_to, unique_value(task_description), 2) if assigned_to
  57.     @vh.tasks_page.client(client, unique_value(task_description)) if client
  58.     @vh.tasks_page.task_column(priority, unique_value(task_description), 4) if priority
  59.     @vh.tasks_page.task_column(convert_date(due_date, '%m/%d/%Y'), unique_value(task_description), 5) if due_date
  60.     @vh.tasks_page.task_column(task_type, unique_value(task_description), 6) if task_type
  61.     @vh.tasks_page.task_column($data[created_by]['name'], unique_value(task_description), 8) if created_by
  62.   end
  63. end
  64.  
  65. When (/^I click \[Update Task\] button for '(.*)' description$/) do |description|
  66.   @vh.tasks_page.click_btn_update_task(unique_value(description))
  67. end
  68.  
  69. When(/^I submit \[Update Task\] form using the following data:$/) do |table|
  70.   wait_until('Create New Task form is not opened') { @vh.create_new_task_page.sel_client.visible? == true }
  71.   wait_until('Create New Task form is not opened') { @vh.create_new_task_page.sel_assign.visible? == true }
  72.   table.hashes.each do |task|
  73.     assigned_to = task[:assigned_to]
  74.     due_date = task[:due_date]
  75.     priority = task[:priority]
  76.  
  77.     @vh.create_new_task_page.select_assigned_to assigned_to
  78.     @vh.create_new_task_page.select_task_priority priority
  79.     @vh.create_new_task_page.txt_due_date.set convert_date(due_date, '%m/%d/%Y') if due_date
  80.     @vh.create_new_task_page.btn_create_task
  81.   end
  82.   step "I click ['Create Task'] button"
  83. end
  84.  
  85. When (/^I click \[Delete Task\] button for '(.*)' description$/) do |description|
  86.   @vh.tasks_page.click_btn_delete_task(unique_value(description))
  87.   @vh.tasks_page.click_btn_confirm_delete_task
  88. end
  89.  
  90. Then(/^I should( not)? find task in the task list with the following data:$/) do |negate, table|
  91.   sleep 1
  92.   table.hashes.each do |task|
  93.     task_description = task[:task_description]
  94.  
  95.     visible = @vh.tasks_page.is_task_row_present? unique_value(task_description)
  96.     negate ? visible.should(be_falsey) : visible.should(be_truthy)
  97.   end
  98. end
  99.  
  100. When (/^I click \[Task Memos\] button for '(.*)' description$/) do |description|
  101.   @vh.tasks_page.click_btn_task_memo(unique_value(description))
  102. end
  103.  
  104. When(/^I submit \[Task Memos\] form using the following data:$/) do |table|
  105.   step 'I fill [Task Memos] form using the following data:', table
  106.   step "I click ['Complete Task'] button"
  107. end
  108.  
  109. When(/^I fill \[Task Memos\] form using the following data:$/) do |table|
  110.   wait_until('Task Memos form is not opened') { @vh.tasks_page.txt_task_memo.visible? == true }
  111.   table.hashes.each do |task|
  112.     task_memos = task[:task_memos]
  113.  
  114.     @vh.tasks_page.txt_task_memo.set unique_value(task_memos) if task_memos
  115.   end
  116. end
  117.  
  118. When(/^I perform completed task search using the following data:$/) do |table|
  119.   step "I click ['Completed Tab'] button"
  120.   step 'I fill completed tasks search form using the following data:', table
  121.   step "I click ['Search Task'] button"
  122. end
  123.  
  124. When(/^I fill completed tasks search form using the following data:$/) do |table|
  125.   @vh.tasks_page.wait_for_search_client_name_field
  126.   table.hashes.each do |task|
  127.     client = task[:client]
  128.     due_date_from = task[:due_date_from]
  129.     assigned_to = task[:assigned_to]
  130.  
  131.     @vh.tasks_page.select_client_name(client)
  132.     @vh.tasks_page.txt_completed_due_date_from.set convert_date(due_date_from, '%m/%d/%Y')
  133.     @vh.tasks_page.select_assigned_to assigned_to
  134.   end
  135. end
  136.  
  137. When(/^I submit \[Create New Acute Authorization\] form using the following data:$/) do |table|
  138.   step "I click ['Authorizations'] button"
  139.   step "I click ['New Acute'] button"
  140.   step 'I fill [Create New Acute Authorization] form using the following data:', table
  141.   step "I click ['Submit Acute'] button"
  142. end
  143.  
  144. When(/^I fill \[Create New Acute Authorization\] form using the following data:$/) do |table|
  145.   wait_until('Create New Acute Authorization form is not opened') { @vh.create_acute_authorization_page.sel_owner_disabled.visible? == true }
  146.   table.hashes.each do |auth|
  147.     member = auth[:member]
  148.     servicing_provider = auth[:servicing_provider]
  149.     facility = auth[:facility]
  150.     authorization_begin_date = auth[:authorization_begin_date]
  151.     authorization_end_date = auth[:authorization_end_date]
  152.     discharge_date = auth[:discharge_date]
  153.     primary_icd10_code = auth[:primary_icd10_code]
  154.     units = auth[:units]
  155.     status = auth[:status]
  156.  
  157.     @vh.create_acute_authorization_page.select_client member
  158.     @vh.create_acute_authorization_page.select_provider servicing_provider
  159.     @vh.create_acute_authorization_page.txt_facility.set facility if facility
  160.     @vh.create_acute_authorization_page.txt_auth_begin_date.set convert_date(authorization_begin_date, '%m/%d/%Y') if authorization_begin_date
  161.     @vh.create_acute_authorization_page.txt_auth_end_date.set convert_date(authorization_end_date, '%m/%d/%Y') if authorization_end_date
  162.     @vh.create_acute_authorization_page.txt_auth_discharge_date.set convert_date(discharge_date, '%m/%d/%Y') if discharge_date
  163.     @vh.create_acute_authorization_page.txt_primary_icd.set primary_icd10_code if primary_icd10_code
  164.     @vh.create_acute_authorization_page.txt_units.set units if units
  165.     @vh.create_acute_authorization_page.select_status status
  166.  
  167.  
  168.  
  169.   end
  170. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement