Files
mip/tests/housingtests.rb

267 lines
18 KiB
Ruby
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#---
#This unit test checks the housings screen.
#---
class Test_03_housings_screen < Test::Unit::TestCase
#
#Test we can logon to the system using the webmip administrator users login credentials and check that
#all the columns required for the report appears with the button to create a new housing record
#
def test_01_housing_screen_appears
@@ie.goto(HOUSING)
#we'll need to login
login(MIPADMIN, MIPADMIN_PWD)
assert(@@ie.contains_text('Housings'),'The housing screen did not appear')
assert(@@ie.contains_text('Housing Code'),'The housing code column did not appear')
assert(@@ie.contains_text('Housing Type'),'The housing type column did not appear')
assert(@@ie.contains_text('Housing Description'),'The housing description column did not appear')
assert(@@ie.contains_text('Dimension L'),'The Dimension L column did not appear')
assert(@@ie.contains_text('Dimension W'),'The Dimension W column did not appear')
assert(@@ie.contains_text('Dimension H'),'The Dimension H column did not appear')
assert(@@ie.contains_text('Weight'),'The drawing code column did not appear')
assert(@@ie.contains_text('Drawing Code'),'The drawing code column did not appear')
assert(@@ie.contains_text('Manufacturer'),'The manufacturer column did not appear')
assert(@@ie.button(:id, 'create').exists?,'The create button was not available')
end
#
#Check that the Create/Edit Housing form can be accessed using the Create button on the Housings report,
#all the required columns appears on the screen along with create and cancel buttons
# assert(@@ie.select_list(:id, 'P5_COLUMN_NAMES').exists?,'The column headings field was not available')
#
def test_02_create_housing_screen_appears
@@ie.button(:id, 'create').click
@@ie.wait
assert(@@ie.contains_text('Create/Edit Housing'),'The create/edit housing screen did not appear')
assert(@@ie.text_field(:id, 'P55_CODE').exists?,'The housing code field is not available')
assert(@@ie.select_list(:id, 'P55_HOTY_CODE').exists?,'The housing type field is not available')
assert(@@ie.text_field(:id, 'P55_DESCRIPTION').exists?,'The housing description field is not available')
assert(@@ie.text_field(:id, 'P55_DIM_L').exists?,'The dimension L field is not available')
assert(@@ie.text_field(:id, 'P55_DIM_W').exists?,'The dimension W field is not available')
assert(@@ie.text_field(:id, 'P55_DIM_H').exists?,'The dimension H field is not available')
assert(@@ie.text_field(:id, 'P55_WEIGHT').exists?,'The weight field is not available')
assert(@@ie.select_list(:id, 'P55_DRWG_CODE').exists?,'The drawing code field is not available')
assert(@@ie.select_list(:id, 'P55_PRTY_ID').exists?,'The manufacturer field is not available')
assert(@@ie.button(:id, 'create').exists?,'The create button was not available')
assert(@@ie.button(:id, 'cancel').exists?,'The cancel button was not available')
end
#~ def test_03_correct_lists_of_values_displayed
#~ listofhousingtypes= W%[LIFT OFF
#~ WALK IN
#~ WALK THOUGH]
#~ assert_equal(listofhousingtypes,@@ie.select_list(:id, 'P3_HOTY_CODE').getAllContents ,'The expected list of housing types was not found')
#~ listofmanufacturers= W%[ACTARIS,
#~ DRESSER,
#~ QUINSHIELD]
#~ assert_equal(listofmanufacturers,@@ie.select_list(:id, 'P3_PRTY_ID').getAllContents,'The expected list of manufacturers was not found')
#~ end
#
#Check that the Create/Edit Housing form allows data to be inserted to create a new housing
#Check that the new housing record appears in the Housings report
#
def test_03_create_housing
@@ie.text_field(:id, 'P55_CODE').set('1766H')
@@ie.select_list(:id, 'P55_HOTY_CODE').select('Lift Off')
@@ie.text_field(:id, 'P55_DESCRIPTION').set('Housing for meters')
@@ie.text_field(:id, 'P55_DIM_L').set('3800')
@@ie.text_field(:id, 'P55_DIM_W').set('1400')
@@ie.text_field(:id, 'P55_DIM_H').set('2400')
@@ie.text_field(:id, 'P55_WEIGHT').set('400')
@@ie.select_list(:id, 'P55_DRWG_CODE').select('WI')
@@ie.select_list(:id, 'P55_PRTY_ID').select('DRESSER')
@@ie.button(:id, 'create').click
@@ie.wait
assert(@@ie.contains_text('Housings'),'The housing screen did not appear')
assert(@@ie.contains_text('1766H'),'The new record with housing code 1766H did not appear')
assert(@@ie.contains_text('LIFT OFF'),'The new record with housing type lift off did not appear')
assert(@@ie.contains_text('Housing for meters'),'The description Housing for meters did not appear')
assert(@@ie.contains_text('3800'),'The value 3800 for Dimension L did not appear')
assert(@@ie.contains_text('1400'),'The value 1400 for Dimension W did not appear')
assert(@@ie.contains_text('2400'),'The value 2400 for Dimension H did not appear')
assert(@@ie.contains_text('400'),'The value 400 for weight did not appear')
assert(@@ie.contains_text('WI'),'The new record with drawing code WI did not appear')
assert(@@ie.contains_text('DRESSER'),'The new record with manufacturer dresser did not appear')
@@ie.button(:id, 'create').click
@@ie.wait
@@ie.text_field(:id, 'P55_CODE').set('3811H')
@@ie.select_list(:id, 'P55_HOTY_CODE').select('Walk Thru')
@@ie.text_field(:id, 'P55_DESCRIPTION').set('Housing for regulators')
@@ie.text_field(:id, 'P55_DIM_L').set('3600')
@@ie.text_field(:id, 'P55_DIM_W').set('1700')
@@ie.text_field(:id, 'P55_DIM_H').set('2200')
@@ie.text_field(:id, 'P55_WEIGHT').set('300')
@@ie.select_list(:id, 'P55_DRWG_CODE').select('WI')
@@ie.select_list(:id, 'P55_PRTY_ID').select('ACTARIS')
@@ie.button(:id, 'create').click
@@ie.wait
assert(@@ie.contains_text('Housings'),'The housing screen did not appear')
assert(@@ie.contains_text('3811H'),'The new record with drawing code 3811H did not appear')
assert(@@ie.contains_text('WALK THRU'),'The new record with housing type walk through did not appear')
assert(@@ie.contains_text('Housing for regulators'),'The description Housing for regulators did not appear')
assert(@@ie.contains_text('3600'),'The value 3600 for Dimension L did not appear')
assert(@@ie.contains_text('1700'),'The value 1700 for Dimension W did not appear')
assert(@@ie.contains_text('2200'),'The value 2200 for Dimension H did not appear')
assert(@@ie.contains_text('300'),'The value 300 for weight did not appear')
assert(@@ie.contains_text('WI'),'The new record with drawing code WI did not appear')
assert(@@ie.contains_text('ACTARIS'),'The new record with manufacturer dresser did not appear')
end
#
#Check that the code 1765H links to the Create/Edit Housing form and the form appears with the correct data
#in the fields. Check that the housing description can be updated and the updated record appears in the Housings report
#
def test_04_update_housing
@@ie.link(:text, '1766H').click
@@ie.wait
assert(@@ie.contains_text('Create/Edit Housings'),'The Create/Edit Housings screen did not appear')
assert(@@ie.text_field(:id, 'P55_CODE').verify_contains('1766H'), 'The housing code field did not contain value 1765H')
#assert_equal(@@ie.select_list(:id, 'P55_HOTY_CODE').getAllContents, ['Lift Off', 'Unknown Housing Type - inserted for bulk load', 'Walk In', 'Walk Through'], 'Not all values found in Housing type Select list')
assert(@@ie.select_list(:id, 'P55_HOTY_CODE').selected?('Lift Off'), 'The housing type is not LIFT OFF')
assert(@@ie.text_field(:id, 'P55_DESCRIPTION').verify_contains('Housing for meters'), 'The description is not housing for meters')
assert(@@ie.text_field(:id, 'P55_DIM_L').verify_contains('3800'), 'DIM L is not 3800')
assert(@@ie.text_field(:id, 'P55_DIM_W').verify_contains('1400'), 'DIM W is not 1400')
assert(@@ie.text_field(:id, 'P55_DIM_H').verify_contains('2400'), 'DIM H is not 2400')
assert(@@ie.text_field(:id, 'P55_WEIGHT').verify_contains('400'), 'Weight is not 400')
assert(@@ie.select_list(:id, 'P55_DRWG_CODE').selected?('WI'), 'Drawing code is not WI')
assert(@@ie.select_list(:id, 'P55_PRTY_ID').selected?('DRESSER'), 'Manufacturer is not DRESSER')
assert(@@ie.button(:id, 'cancel').exists?,'The cancel button was not available')
assert(@@ie.button(:id, 'delete').exists?,'The delete button was not available')
assert(@@ie.button(:id, 'apply_changes').exists?,'The Apply Changes button was not available')
@@ie.text_field(:id, 'P55_DESCRIPTION').set('Housing for slamshut valves')
@@ie.button(:id, 'apply_changes').click
@@ie.wait
assert(@@ie.contains_text('Housings'),'The housing screen did not appear')
assert(@@ie.contains_text('1766H'),'The new record with housing code 1765H did not appear')
assert(@@ie.contains_text('LIFT OFF'),'The new record with housing type lift off did not appear')
assert(@@ie.contains_text('Housing for slamshut valves'),'The updated description Housing for slamshut valves did not appear')
assert(@@ie.contains_text('3800'),'The value 3800 for Dimension L did not appear')
assert(@@ie.contains_text('1400'),'The value 1400 for Dimension W did not appear')
assert(@@ie.contains_text('2400'),'The value 2400 for Dimension H did not appear')
assert(@@ie.contains_text('400'),'The value 400 for weight did not appear')
assert(@@ie.contains_text('WI'),'The new record with drawing code WI did not appear')
assert(@@ie.contains_text('DRESSER'),'The new record with manufacturer dresser did not appear')
end
#
#Check that the housing 3811H can be deleted and that the record is no longer displayed in the report
# can't delete housing due to javascript popup
# def test_05_delete_housing
# @@ie.link(:text, '3811H').click
# @@ie.wait
# assert(@@ie.text_field(:id, 'P55_CODE').verify_contains('3811H'), 'The housing code field did not contain value 3811H')
# assert(@@ie.select_list(:id, 'P55_HOTY_CODE').selected?('Walk Thru'), 'The housing type is not Walk Through')
# assert(@@ie.text_field(:id, 'P55_DESCRIPTION').verify_contains('Housing for regulators'), 'The description is not housing for meters')
# assert(@@ie.text_field(:id, 'P55_DIM_L').verify_contains('3600'), 'DIM L is not 3600')
# assert(@@ie.text_field(:id, 'P55_DIM_W').verify_contains('1700'), 'DIM W is not 1700')
# assert(@@ie.text_field(:id, 'P55_DIM_H').verify_contains('2200'), 'DIM H is not 2200')
# assert(@@ie.text_field(:id, 'P55_WEIGHT').verify_contains('300'), 'Weight is not 300')
# assert(@@ie.select_list(:id, 'P55_DRWG_CODE').selected?('WI'), 'Drawing code is not WI')
# assert(@@ie.select_list(:id, 'P55_PRTY_ID').selected?('ACTARIS'), 'Manufacturer is not ACTARIS')
# assert(@@ie.button(:id, 'cancel').exists?,'The cancel button was not available')
# assert(@@ie.button(:id, 'delete').exists?,'The delete button was not available')
# assert(@@ie.button(:id, 'apply_changes').exists?,'The Apply Changes button was not available')
# startClicker("OK", 1)
# @@ie.button(:id, 'delete').click
# @@ie.wait
# assert_nil(@@ie.contains_text('3811H'),'The housing code field did contain value 3811H')
# end
#
#Check that the housing code cannot be updated
#
#~ def test_06_update_drawing_code
#~ @@ie.link(:text, '1765H').click
#~ @@ie.wait
#~ assert(@@ie.contains_text('Create/Edit Housings'),'The Create/Edit Housings screen did not appear')
#~ assert(@@ie.text_field(:id, 'P55_CODE').verify_contains('1765H'), 'The housing code field did not contain value 1765H')
#~ assert(@@ie.select_list(:id, 'P55_HOTY_CODE').selected?('LIFT OFF'), 'The housing type is not LIFT OFF')
#~ assert(@@ie.text_field(:id, 'P55_DESCRIPTION').verify_contains('Housing for slamshut valves'), 'The description is not housing for meters')
#~ assert(@@ie.text_field(:id, 'P55_DIM_L').verify_contains('3800'), 'DIM L is not 3800')
#~ assert(@@ie.text_field(:id, 'P55_DIM_W').verify_contains('1400'), 'DIM W is not 1400')
#~ assert(@@ie.text_field(:id, 'P55_DIM_H').verify_contains('2400'), 'DIM H is not 2400')
#~ assert(@@ie.text_field(:id, 'P55_WEIGHT').verify_contains('400'), 'Weight is not 400')
#~ assert(@@ie.select_list(:id, 'P55_DRWG_CODE').selected?('WI'), 'Drawing code is not WI')
#~ assert(@@ie.select_list(:id, 'P55_PRTY_ID').selected?('DRESSER'), 'Manufacturer is not DRESSER')
#~ assert(@@ie.button(:id, 'cancel').exists?,'The cancel button was not available')
#~ assert(@@ie.button(:id, 'delete').exists?,'The delete button was not available')
#~ assert(@@ie.button(:id, 'apply_changes').exists?,'The Apply Changes button was not available')
#~ @@ie.text_field(:id, 'P55_CODE').set("2245A")
#~ @@ie.button(:id, 'apply_changes').click
#~ @@ie.wait
#~ assert(@@ie.contains_text('Housings'),'The housings screen did not appear')
#~ assert(@@ie.contains_text('2245A'),'The record with housing code 2245A did not appear')
#~ end
#
#Check that a housing record with child records cannot be deleted
#
#~ def test_07_delete_housing_child
#~ @@ie.link(:text, '2016').click
#~ @@ie.wait
#~ assert(@@ie.text_field(:id, 'P55_CODE').verify_contains('2016'), 'The housing code field did not contain value 3811H')
#~ assert(@@ie.select_list(:id, 'P55_HOTY_CODE').selected?('WALK IN'), 'The housing type is not LIFT OFF')
#~ assert(@@ie.text_field(:id, 'P55_DIM_L').verify_contains('2000'), 'DIM L is not 3600')
#~ assert(@@ie.text_field(:id, 'P55_DIM_W').verify_contains('1600'), 'DIM W is not 1700')
#~ assert(@@ie.text_field(:id, 'P55_DIM_H').verify_contains('2100'), 'DIM H is not 2200')
#~ assert(@@ie.text_field(:id, 'P55_WEIGHT').verify_contains('0'), 'Weight is not 300')
#~ assert(@@ie.select_list(:id, 'P55_DRWG_CODE').selected?('WI'), 'Drawing code is not WI')
#~ assert(@@ie.select_list(:id, 'P55_PRTY_ID').selected?('ACTARIS'), 'Manufacturer is not ACTARIS')
#~ assert(@@ie.button(:id, 'cancel').exists?,'The cancel button was not available')
#~ assert(@@ie.button(:id, 'delete').exists?,'The delete button was not available')
#~ assert(@@ie.button(:id, 'apply_changes').exists?,'The Apply Changes button was not available')
#~ @@ie.button(:id, 'delete').click
#~ @@ie.wait
#~ assert(@@ie.contains_text('2016'),'The housing code field did not contain value 3811H')
#~ end
#
#Check that a duplicate housing record cannot be recorded
#
#~ def test_08_create_duplicate
#~ assert(@@ie.button(:id, 'create').exists?,'The create button was not available')
#~ @@ie.button(:id, 'create').click
#~ @@ie.wait
#~ assert(@@ie.contains_text('Create/Edit Housing'),'The create/edit housings screen did not appear')
#~ assert(@@ie.text_field(:id, 'P55_CODE').exists?,'The housing code field is not available')
#~ assert(@@ie.select_list(:id, 'P55_HOTY_CODE').exists?,'The housing type field is not available')
#~ assert(@@ie.text_field(:id, 'P55_DESCRIPTION').exists?,'The housing description field is not available')
#~ assert(@@ie.text_field(:id, 'P55_DIM_L').exists?,'The dimension L field is not available')
#~ assert(@@ie.text_field(:id, 'P55_DIM_W').exists?,'The dimension W field is not available')
#~ assert(@@ie.text_field(:id, 'P55_DIM_H').exists?,'The dimension H field is not available')
#~ assert(@@ie.text_field(:id, 'P55_WEIGHT').exists?,'The weight field is not available')
#~ assert(@@ie.select_list(:id, 'P55_DRWG_CODE').exists?,'The drawing code field is not available')
#~ assert(@@ie.select_list(:id, 'P55_PRTY_ID').exists?,'The manufacturer field is not available')
#~ assert(@@ie.button(:id, 'create').exists?,'The create button was not available')
#~ assert(@@ie.button(:id, 'cancel').exists?,'The cancel button was not available')
#~ @@ie.text_field(:id, 'P55_CODE').set('1765H')
#~ @@ie.select_list(:id, 'P55_HOTY_CODE').select('WALK THROUGH')
#~ @@ie.text_field(:id, 'P55_DESCRIPTION').set('Housing for regulators')
#~ @@ie.text_field(:id, 'P55_DIM_L').set('3600')
#~ @@ie.text_field(:id, 'P55_DIM_W').set('1700')
#~ @@ie.text_field(:id, 'P55_DIM_H').set('2200')
#~ @@ie.text_field(:id, 'P55_WEIGHT').set('300')
#~ @@ie.select_list(:id, 'P55_DRWG_CODE').select('WI')
#~ @@ie.select_list(:id, 'P55_PRTY_ID').select('ACTARIS')
#~ @@ie.button(:id, 'create').click
#~ @@ie.wait
#~ assert_nil(@@ie.contains_text('Housings'),'The housing screen did appear')
#~ assert_nil(@@ie.contains_text('3811H'),'The new record with drawing code 3811H did appear')
#~ assert_nil(@@ie.contains_text('WALK THROUGH'),'The new record with housing type wwalk through did appear')
#~ assert_nil(@@ie.contains_text('Housing for regulators'),'The description Housing for regulators did appear')
#~ assert_nil(@@ie.contains_text('3600'),'The value 3600 for Dimension L did appear')
#~ assert_nil(@@ie.contains_text('1700'),'The value 1700 for Dimension W did appear')
#~ assert_nil(@@ie.contains_text('2200'),'The value 2200 for Dimension H did appear')
#~ assert_nil(@@ie.contains_text('300'),'The value 300 for weight did appear')
#~ assert_nil(@@ie.contains_text('WI'),'The new record with drawing code WI did appear')
#~ assert_nil(@@ie.contains_text('ACTARIS'),'The new record with manufacturer dresser did appear')
#~ assert(@@ie.contains_text('Error'),'An error was not generated')
#~ end
def test_50_logout
menu('Logout')
assert(@@ie.button(:value, 'Login').exists?,'The Login button was not available')
@@ie.button(:value, 'Login').click
@@ie.wait
end
end