Traffic Light Controller IO Input

Tests

Input forcing is read with S0029

Verify that we can read forced input status with S0029

  1. Given the site is connected
  2. When we read input with S0029
  3. Then we should receive a valid response
View Source
Validator::Site.connected do |task,supervisor,site|
  request_status_and_confirm site, "forced input status",
    { S0029: [:status] }
end

Input forcing is set with M0019

Verify that we can force input with M0019

  1. Given the site is connected
  2. And the input is forced off
  3. When we force the input on
  4. Then S0003 should show the input on
View Source
Validator::Site.connected do |task,supervisor,site|
  prepare task, site
  inputs = Validator.get_config('items','inputs')
  skip("No inputs configured") if inputs.nil? || inputs.empty?
  inputs.each do |input|
    force_input input: input, status: 'True', value: 'False'
    force_input input: input, status: 'True', value: 'True'
  ensure
    force_input input: input, status: 'False', validate: false
  end
end

Input is activated with M0006

Verify that we can activate input with M0006

  1. Given the site is connected
  2. When we activate input with M0006
  3. Then S0003 should show the input is active
  4. When we deactivate input with M0006
  5. Then S0003 should show the input is inactive
View Source
Validator::Site.connected do |task,supervisor,site|
  prepare task, site
  inputs = Validator.get_config('items','inputs')
  skip("No inputs configured") if inputs.nil? || inputs.empty?
  prepare task, site
  inputs.each { |input| switch_input input }
end

Input is read with S0003

Verify that we can read input status with S0003

  1. Given the site is connected
  2. When we read input with S0029
  3. Then we should receive a valid response
View Source
Validator::Site.connected do |task,supervisor,site|
  request_status_and_confirm site, "input status",
    { S0003: [:inputstatus] }
end

Input sensitivity is set with M0021

Verify that input sensitivity can be set with M0021

  1. Given the site is connected
  2. When we set sensitivity with M0021
  3. Then we receive a confirmation
View Source
Validator::Site.connected do |task,supervisor,site|
  prepare task, site
  status = '1-50'
  set_trigger_level status
end

Input series is activated with M0013

Verify that we can acticate/deactivate a series of inputs with M0013

  1. Given the site is connected
  2. Send control command to set a serie of input
  3. Wait for status = true
View Source
Validator::Site.connected do |task,supervisor,site|
  prepare task, site
  inputs = Validator.get_config('items','inputs')
  skip("No inputs configured") if inputs.nil? || inputs.empty?
  status = "1,3,12;5,5,10"
  set_series_of_inputs status
end