#--- #This unit test checks the modules screen. #--- class Test_08_modules_screen < Test::Unit::TestCase # #Test we can logon to the system using the webmip administrator user�s login credentials and check that #all the columns required for the report appears with the button to create a new module record # def test_01_module_screen_appears @@ie.goto(MODULE) #we'll need to login login(DEFAULT, DEFAULT_PWD) assert(@@ie.contains_text('Modules'),'The module screen did not appear') assert(@@ie.contains_text('Module Code'),'The module code column did not appear') assert(@@ie.contains_text('Service Pressure'),'The service pressure column did not appear') assert(@@ie.contains_text('Meter'),'The module metercolumn did not appear') assert(@@ie.contains_text('Filter'),'The filter column did not appear') assert(@@ie.contains_text('Regulator'),'The regulator column did not appear') assert(@@ie.contains_text('Relief Valve'),'The relief valve column did not appear') assert(@@ie.contains_text('Slamshut Valve'),'The slamshut valve column did not appear') assert(@@ie.button(:id, 'create').exists?,'The create button was not available') end # #Check that the Create/Edit Modules form can be accessed using the Create button on the Modules report, #all the required columns appears on the screen along with create and cancel buttons # def test_02_create_module_screen_appears @@ie.button(:id, 'create').click @@ie.wait assert(@@ie.contains_text('Create/Edit Module'),'The create/edit module screen did not appear') assert(@@ie.text_field(:id, 'P57_CODE').exists?,'The module code field is not available') assert(@@ie.select_list(:id, 'P57_METR_CODE').exists?,'The meter code field is not available') assert(@@ie.select_list(:id, 'P57_FLTR_CODE').exists?,'The filter code field is not available') assert(@@ie.select_list(:id, 'P57_REGU_CODE').exists?,'The regulator code field is not available') assert(@@ie.select_list(:id, 'P57_REVA_CODE').exists?,'The relief valve field is not available') assert(@@ie.select_list(:id, 'P57_SLVA_CODE').exists?,'The slamshut valve code field is not available') assert(@@ie.select_list(:id, 'P57_SVCP_CODE').exists?,'The service pressure field is not available') assert(@@ie.select_list(:id, 'P57_PRTY_ID').exists?,'The manufacturer field is not available') assert(@@ie.select_list(:id, 'P57_DRWG_CODE').exists?,'The drawing code field is not available') assert(@@ie.select_list(:id, 'P57_BAS_CODE').exists?,'The base code field is not available') assert(@@ie.select_list(:id, 'P57_HOU_CODE').exists?,'The housing code field is not available') assert(@@ie.select_list(:id, 'P57_INLET_CNOR_CODE').exists?,'The inlet connection orientation field is not available') assert(@@ie.select_list(:id, 'P57_INLET_CNTY_CODE').exists?,'The inlet connection type is not available') assert(@@ie.select_list(:id, 'P57_OUTLET_CNOR_CODE').exists?,'The outlet connection orientation field is not available') assert(@@ie.select_list(:id, 'P57_OUTLET_CNTY_CODE').exists?,'The outlet connection type field is not available') assert(@@ie.text_field(:id, 'P57_WEIGHT').exists?,'The weight field is not available') assert(@@ie.text_field(:id, 'P57_INLET_HEIGHT').exists?,'The inlet height field is not available') assert(@@ie.text_field(:id, 'P57_OUTLET_HEIGHT').exists?,'The outlet height field is not available') assert(@@ie.text_field(:id, 'P57_OUTLET_PRESSURE').exists?,'The outlet pressure field is not available') assert(@@ie.text_field(:id, 'P57_INLET_SIZE').exists?,'The inlet size field is not available') assert(@@ie.text_field(:id, 'P57_OUTLET_SIZE').exists?,'The outlet size field is not available') assert(@@ie.text_field(:id, 'P57_DIM_A').exists?,'The dimension A field is not available') assert(@@ie.text_field(:id, 'P57_DIM_B').exists?,'The dimension B field is not available') assert(@@ie.text_field(:id, 'P57_DIM_C').exists?,'The dimension C field is not available') assert(@@ie.text_field(:id, 'P57_DIM_D').exists?,'The dimension D field is not available') assert(@@ie.text_field(:id, 'P57_DIM_E').exists?,'The dimension E field is not available') assert(@@ie.text_field(:id, 'P57_DIM_H').exists?,'The dimension H field is not available') assert(@@ie.text_field(:id, 'P57_QMAX').exists?,'The QMAX field was not found') 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 # #Check that the Create/Edit Module form allows data to be inserted to create a new module #Check that the new module record appears in the Modules report # def test_03_create_module @@ie.text_field(:id, 'P57_CODE').set('AR10266H') @@ie.select_list(:id, 'P57_METR_CODE').set('MRD1600B4F') @@ie.select_list(:id, 'P57_FLTR_CODE').select('WITCHES HAT STRAINER') @@ie.select_list(:id, 'P57_REGU_CODE').select('J48') @@ie.select_list(:id, 'P57_REVA_CODE').select('10L') @@ie.select_list(:id, 'P57_SLVA_CODE').select('INTEGRAL') @@ie.select_list(:id, 'P57_SVCP_CODE').select('LP') @@ie.select_list(:id, 'P57_PRTY_ID').select('DRESSER') @@ie.select_list(:id, 'P57_DRWG_CODE').select('C') @@ie.select_list(:id, 'P57_BAS_CODE').set('RA0025LPB') @@ie.select_list(:id, 'P57_HOU_CODE').set('1766H') @@ie.select_list(:id, 'P57_INLET_CNOR_CODE').select('Vertical Down') @@ie.select_list(:id, 'P57_INLET_CNTY_CODE').select('(Mm) Bs 746') @@ie.select_list(:id, 'P57_OUTLET_CNOR_CODE').select('Vertical Down') @@ie.select_list(:id, 'P57_OUTLET_CNTY_CODE').select('(Mm) Bs 746') @@ie.text_field(:id, 'P57_WEIGHT').set('3615') @@ie.text_field(:id, 'P57_INLET_HEIGHT').set('520') @@ie.text_field(:id, 'P57_OUTLET_HEIGHT').set('300') @@ie.text_field(:id, 'P57_OUTLET_PRESSURE').set('21') @@ie.text_field(:id, 'P57_INLET_SIZE').set('150') @@ie.text_field(:id, 'P57_OUTLET_SIZE').set('150') @@ie.text_field(:id, 'P57_DIM_A').set('999') @@ie.text_field(:id, 'P57_DIM_B').set('3407') @@ie.text_field(:id, 'P57_DIM_C').set('999') @@ie.text_field(:id, 'P57_DIM_D').set('999') @@ie.text_field(:id, 'P57_DIM_E').set('999') @@ie.text_field(:id, 'P57_DIM_H').set('1490') @@ie.text_field(:id, 'P57_VALID_FROM').set('04/12/2007') @@ie.text_field(:id, 'P57_VALID_TO').set('03/12/2008') #new @@ie.text_field(:id, 'P57_QMAX').set('800') @@ie.button(:id, 'create').click @@ie.wait assert(@@ie.contains_text('Modules'),'The module screen did not appear') assert(@@ie.contains_text('AR10266H'),'The new record with module code AR10265H did not appear') @@ie.button(:id, 'create').click @@ie.wait @@ie.text_field(:id, 'P57_CODE').set('AR12265H') @@ie.select_list(:id, 'P57_METR_CODE').set('MRD1600B4F') @@ie.select_list(:id, 'P57_FLTR_CODE').select('WITCHES HAT STRAINER') @@ie.select_list(:id, 'P57_REGU_CODE').select('J48') @@ie.select_list(:id, 'P57_REVA_CODE').select('10L') @@ie.select_list(:id, 'P57_SLVA_CODE').select('INTEGRAL') @@ie.select_list(:id, 'P57_SVCP_CODE').select('LP') @@ie.select_list(:id, 'P57_PRTY_ID').select('DRESSER') @@ie.select_list(:id, 'P57_DRWG_CODE').select('C') @@ie.select_list(:id, 'P57_BAS_CODE').set('RA0025LPB') @@ie.select_list(:id, 'P57_HOU_CODE').set('1766H') @@ie.select_list(:id, 'P57_INLET_CNOR_CODE').select('Vertical Down') @@ie.select_list(:id, 'P57_INLET_CNTY_CODE').select('(Mm) Bs 746') @@ie.select_list(:id, 'P57_OUTLET_CNOR_CODE').select('Vertical Down') @@ie.select_list(:id, 'P57_OUTLET_CNTY_CODE').select('(Mm) Bs 746') @@ie.text_field(:id, 'P57_WEIGHT').set('3615') @@ie.text_field(:id, 'P57_INLET_HEIGHT').set('520') @@ie.text_field(:id, 'P57_OUTLET_HEIGHT').set('300') @@ie.text_field(:id, 'P57_OUTLET_PRESSURE').set('21') @@ie.text_field(:id, 'P57_INLET_SIZE').set('150') @@ie.text_field(:id, 'P57_OUTLET_SIZE').set('150') @@ie.text_field(:id, 'P57_DIM_A').set('999') @@ie.text_field(:id, 'P57_DIM_B').set('3407') @@ie.text_field(:id, 'P57_DIM_C').set('999') @@ie.text_field(:id, 'P57_DIM_D').set('999') @@ie.text_field(:id, 'P57_DIM_E').set('999') @@ie.text_field(:id, 'P57_DIM_H').set('1490') @@ie.text_field(:id, 'P57_VALID_FROM').set('04/12/2007') @@ie.text_field(:id, 'P57_VALID_TO').set('03/12/2008') #new module QMAX @@ie.text_field(:id, 'P57_QMAX').set('800') @@ie.button(:id, 'create').click @@ie.wait assert(@@ie.contains_text('Modules'),'The module screen did not appear') assert(@@ie.contains_text('AR12265H'),'The new record with module code AR12265H did not appear') end # #Check that the code AR10265H links to the Create/Edit Module and the form appears with the correct data #in the fields. Check that the valid to can be updated and the updated record appears in the Module report # def test_04_update_module @@ie.link(:text, 'AR10266H').click @@ie.wait assert(@@ie.contains_text('Create/Edit Module'),'The Create/Edit Module screen did not appear') assert(@@ie.contains_text('AR10266H'), 'The module code is not AR10266H') #~ assert(@@ie.text_field(:id, 'P57_METR_CODE').verify_contains('MRD1600B4F'), 'The meter code is not MRD1600B4F') #~ assert(@@ie.select_list(:id, 'P57_FLTR_CODE').selected?('Not Assigned'), 'The filter code is not Not Assigned') #~ assert(@@ie.select_list(:id, 'P57_REGU_CODE').selected?('Not Assigned'), 'The regulator code is not Not Assigned') #~ assert(@@ie.select_list(:id, 'P57_REVA_CODE').selected?('Not Assigned'), 'The relief valve code is not Not Assigned') #~ assert(@@ie.select_list(:id, 'P57_SLVA_CODE').selected?('Not Assigned'), 'The slamshut valve code is not Not Assigned') #~ assert(@@ie.select_list(:id, 'P57_SVCP_CODE').selected?('LP'), 'The service pressure is not LP') #~ assert(@@ie.select_list(:id, 'P57_PRTY_ID').selected?('DRESSER'), 'The manufacturer is not dresser') #~ assert(@@ie.select_list(:id, 'P57_DRWG_CODE').selected?('Not Assigned'), 'The drawing code is not Not Assigned') #~ assert(@@ie.text_field(:id, 'P57_BAS_CODE').verify_contains('2016HH1'), 'The base code is not 2016HH1') #~ assert(@@ie.text_field(:id, 'P57_HOU_CODE').verify_contains('1765H'), 'The housing code is not 1765H') #~ assert(@@ie.select_list(:id, 'P57_INLET_CNOR_CODE').selected?('Vertical Down'), 'The inlet connection orientation is not Not Assigned') #~ assert(@@ie.select_list(:id, 'P57_INLET_CNTY_CODE').selected?('BAD DATA'), 'The inlet connection type is not Not Assigned') #~ assert(@@ie.select_list(:id, 'P57_OUTLET_CNOR_CODE').selected?('Vertical Down'), 'The outlet connection orientation is not None Assigned') #~ assert(@@ie.select_list(:id, 'P57_OUTLET_CNTY_CODE').selected?('BAD DATA'), 'The outlet connection type is not Not Assigned') #~ assert(@@ie.text_field(:id, 'P57_WEIGHT').verify_contains('3615'), 'The weight is not 3615') #~ assert(@@ie.text_field(:id, 'P57_INLET_HEIGHT').verify_contains('520'), 'The inlet height is not 520') #~ assert(@@ie.text_field(:id, 'P57_OUTLET_HEIGHT').verify_contains('300'), 'The outlet height is not 300') #~ assert(@@ie.text_field(:id, 'P57_OUTLET_PRESSURE').verify_contains('21'), 'The outlet pressure is not 21') #~ assert(@@ie.text_field(:id, 'P57_INLET_SIZE').verify_contains('150'), 'The inlet size is not 150') #~ assert(@@ie.text_field(:id, 'P57_OUTLET_SIZE').verify_contains('150'), 'The outlet size is not 150') #~ assert(@@ie.text_field(:id, 'P57_DIM_A').verify_contains('999'), 'The DIM A is not 999') #~ assert(@@ie.text_field(:id, 'P57_DIM_B').verify_contains('3407'), 'The DIM B is not 3407') #~ assert(@@ie.text_field(:id, 'P57_DIM_C').verify_contains('999'), 'The DIM C is not 999') #~ assert(@@ie.text_field(:id, 'P57_DIM_D').verify_contains('999'), 'The DIM D is not 999') #~ assert(@@ie.text_field(:id, 'P57_DIM_E').verify_contains('999'), 'The DIM E is not 999') #~ assert(@@ie.text_field(:id, 'P57_DIM_H').verify_contains('1490'), 'The DIM H is not 1490') #~ assert(@@ie.text_field(:id, 'P57_VALID_FROM').verify_contains('04/12/2007'), 'The valid from is not 04/12/2007') #~ assert(@@ie.text_field(:id, 'P57_VALID_TO').verify_contains('03/12/2008'), 'The valid to is not 03/12/2008') #~ 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.select_list(:id, 'P57_REGU_CODE').select('J90 ANGLED') @@ie.button(:id, 'apply_changes').click @@ie.wait assert(@@ie.contains_text('Modules'),'The modules screen did not appear') assert(@@ie.contains_text('AR10266H'),'The record with module code AR10266H did not appear') assert(@@ie.contains_text('J90 ANGLED'),'The record with regulator code J90 Angled - 30 did not appear') end # #Check that the module AR12265H can be deleted and that the record is no longer displayed in the report # # def test_05_delete_module # @@ie.link(:text, 'AR12265H').click # @@ie.wait # assert(@@ie.text_field(:id, 'P57_CODE').verify_contains('AR12265H'), 'The module code field did not contain value AR12265H') # 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_nil(@@ie.contains_text('AR12265H'),'The record with module code AR12265H did appear') # end # #Check that the module code cannot be updated # #~ def test_06_update_module_code #~ @@ie.link(:text, 'AR10265H').click #~ @@ie.wait #~ assert(@@ie.contains_text('Create/Edit Module'),'The Create/Edit Module screen did not appear') #~ assert(@@ie.text_field(:id, 'P57_CODE').verify_contains('AR10265H'), 'The module code field did not contain value AR10265H') #~ 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, 'P57_CODE').set("AR12045H") #~ @@ie.button(:id, 'apply_changes').click #~ @@ie.wait #~ assert(@@ie.contains_text('Modules'),'The modules screen did not appear') #~ assert(@@ie.contains_text('AR12045H'),'The record with module code AR12045H did not appear') #~ end # #Check that a module record with child records cannot be deleted # #~ def test_07_delete_module_child #~ @@ie.link(:text, '2016').click #~ @@ie.wait #~ assert(@@ie.text_field(:id, 'P57_CODE').verify_contains('2016'), 'The module code field did not contain value 3811H') #~ assert(@@ie.select_list(:id, 'P57_HOTY_CODE').selected?('WALK IN'), 'The module type is not LIFT OFF') #~ assert(@@ie.text_field(:id, 'P57_DIM_L').verify_contains('2000'), 'DIM L is not 3600') #~ assert(@@ie.text_field(:id, 'P57_DIM_W').verify_contains('1600'), 'DIM W is not 1700') #~ assert(@@ie.text_field(:id, 'P57_DIM_H').verify_contains('2100'), 'DIM H is not 2200') #~ assert(@@ie.text_field(:id, 'P57_WEIGHT').verify_contains('0'), 'Weight is not 300') #~ assert(@@ie.select_list(:id, 'P57_DRWG_CODE').selected?('WI'), 'Drawing code is not WI') #~ assert(@@ie.select_list(:id, 'P57_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 module code field did not contain value 3811H') #~ end # #Check that a duplicate module record cannot be recorded # #~ def test_08_create_duplicate_module #~ 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 Module'),'The create/edit modules screen did not appear') #~ @@ie.text_field(:id, 'P57_CODE').set('AR10265H') #~ @@ie.text_field(:id, 'P57_METR_CODE').set('MRD1600B4F') #~ @@ie.select_list(:id, 'P57_FLTR_CODE').select('BADDATA') #~ @@ie.select_list(:id, 'P57_REGU_CODE').select('BADDATA') #~ @@ie.select_list(:id, 'P57_REVA_CODE').select('BADDATA') #~ @@ie.select_list(:id, 'P57_SLVA_CODE').select('BADDATA') #~ @@ie.select_list(:id, 'P57_SVCP_CODE').select('LP') #~ @@ie.select_list(:id, 'P57_PRTY_ID').select('DRESSER') #~ @@ie.select_list(:id, 'P57_DRWG_CODE').select('BADDATA') #~ @@ie.text_field(:id, 'P57_BAS_CODE').set('2016HH1') #~ @@ie.text_field(:id, 'P57_HOU_CODE').set('1765H') #~ @@ie.select_list(:id, 'P57_INLET_CNOR_CODE').select('VERTICAL DOWN') #~ @@ie.select_list(:id, 'P57_INLET_CNTY_CODE').select('BADDATA') #~ @@ie.select_list(:id, 'P57_OUTLET_CNOR_CODE').select('VERTICAL DOWN') #~ @@ie.select_list(:id, 'P57_OUTLET_CNTY_CODE').select('BADDATA') #~ @@ie.text_field(:id, 'P57_WEIGHT').set('3615') #~ @@ie.text_field(:id, 'P57_INLET_HEIGHT').set('520') #~ @@ie.text_field(:id, 'P57_OUTLET_HEIGHT').set('300') #~ @@ie.text_field(:id, 'P57_INLET_PRESSURE').set('25') #~ @@ie.text_field(:id, 'P57_OUTLET_PRESSURE').set('21') #~ @@ie.text_field(:id, 'P57_INLET_SIZE').set('150') #~ @@ie.text_field(:id, 'P57_OUTLET_SIZE').set('150') #~ @@ie.text_field(:id, 'P57_DIM_A').set('999') #~ @@ie.text_field(:id, 'P57_DIM_B').set('3407') #~ @@ie.text_field(:id, 'P57_DIM_C').set('999') #~ @@ie.text_field(:id, 'P57_DIM_D').set('999') #~ @@ie.text_field(:id, 'P57_DIM_E').set('999') #~ @@ie.text_field(:id, 'P57_DIM_H').set('1490') #~ @@ie.text_field(:id, 'P57_VALID_FROM').set('04/12/2007') #~ @@ie.text_field(:id, 'P57_VALID_TO').set('03/12/2008') #~ @@ie.button(:id, 'create').click #~ @@ie.wait #~ assert_nil(@@ie.contains_text('Modules'),'The module screen did appear') #~ assert_nil(@@ie.contains_text('AR10265H'),'The new record with module code AR10265H 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 '+geterrormess(@@ie)) @@ie.button(:value, 'Login').click @@ie.wait end end