diff --git a/tests/addontests.rb b/tests/addontests.rb new file mode 100644 index 0000000..72da4fe --- /dev/null +++ b/tests/addontests.rb @@ -0,0 +1,204 @@ +#--- +#This unit test checks the addon screen. +#--- +class Test_06_addon_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 add-on record + # + def test_01_addon_screen_appears + @@ie.goto(ADDON) + #we'll need to login + login(DK, DK_PWD) + assert(@@ie.contains_text('Additional Items'),'The additional items screen did not appear') + assert(@@ie.contains_text('Code'),'The additional item code column did not appear') + assert(@@ie.contains_text('Description'),'The additional item description column did not appear') + assert(@@ie.contains_text('Lead Time'),'The lead time column did not appear') + assert(@@ie.button(:id, 'create').exists?,'The create button was not available') + end + # + #Check that the Create/Edit Additional Item form can be accessed using the Create button on the report, + #all the required data entry fields appears on the screen along with create and cancel buttons + # + #~ def test_02_create_addon_screen_appears + #~ @@ie.button(:id, 'create').click + #~ @@ie.wait + #~ assert(@@ie.contains_text('Create/Edit Additional Item'),'The create/edit additional item screen did not appear') + #~ assert(@@ie.text_field(:id, 'P7_CODE').exists?,'The code field is not available') + #~ assert(@@ie.text_field(:id, 'P7_DESCRIPTION').exists?,'The description field is not available') + #~ assert(@@ie.text_field(:id, 'P7_LEAD TIME').exists?,'The lead time 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, 'P19_HOTY_CODE').getAllContents ,'The expected list of additional item types was not found') + #~ listofmanufacturers= W%[ACTARIS, + #~ DRESSER, + #~ QUINSHIELD] + #~ assert_equal(listofmanufacturers,@@ie.select_list(:id, 'P19_PRTY_ID').getAllContents,'The expected list of manufacturers was not found') + #~ end + # + #Check that the Create/Edit Additional Item form allows data to be inserted to create a new add-on + #Check that the new add-on record appears in the report + # + #~ def test_03_create_addon + #~ @@ie.text_field(:id, 'P7_CODE').set('ADDON1') + #~ @@ie.text_field(:id, 'P7_DESCRIPTION').set('Add-on for meter M1') + #~ @@ie.text_field(:id, 'P7_LEAD_TIME').set('20') + #~ @@ie.button(:id, 'create').click + #~ @@ie.wait + #~ assert(@@ie.contains_text('Additional Items'),'The additional item screen did not appear') + #~ assert(@@ie.contains_text('ADDON1'),'The new record with additional item code 1765BH1 did not appear') + #~ assert(@@ie.contains_text('Add-on for meter M1'),'The description for additional item did not appear') + #~ assert(@@ie.contains_text('20'),'The value 20 for lead time did not appear') + #~ @@ie.button(:id, 'create').click + #~ @@ie.wait + #~ @@ie.text_field(:id, 'P7_CODE').set('ADDON2') + #~ @@ie.text_field(:id, 'P7_DESCRIPTION').set('Add-on for meter M2') + #~ @@ie.text_field(:id, 'P7_LEAD_TIME').set('20') + #~ @@ie.button(:id, 'create').click + #~ @@ie.wait + #~ assert(@@ie.contains_text('Additional Items'),'The additional item screen did not appear') + #~ assert(@@ie.contains_text('ADDON1'),'The new record with additional item code 1765BH2 did not appear') + #~ assert(@@ie.contains_text('Add-on for meter M2'),'The description for additional item did not appear') + #~ assert(@@ie.contains_text('20'),'The value 20 for lead time did not appear') + #~ end + # + #Check that the code ADDON2 links to the Create/Edit Additional Item form and the form appears with the correct data + #in the fields. Check that the description can be updated and the updated record appears in the Additional Items report. + # + #~ def test_04_update_addon + #~ @@ie.link(:text, 'ADDON2').click + #~ @@ie.wait + #~ assert(@@ie.contains_text('Create/Edit Additional Item'),'The Create/Edit Additional Item screen did not appear') + #~ assert(@@ie.text_field(:id, 'P7_CODE').verify_contains('ADDON2'), 'The additional item code field did not contain value ADDON2') + #~ assert(@@ie.text_field(:id, 'P7_DESCRIPTION').verify_contains('Add-on for meter M2'), 'The description is not Add-on for meter M2') + #~ assert(@@ie.text_field(:id, 'P7_LEAD_TIME').verify_contains('20'), 'Lead time is not 20') + #~ 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, 'P7_DESCRIPTION').set('Add-on for meter M3') + #~ @@ie.button(:id, 'apply_changes').click + #~ @@ie.wait + #~ assert(@@ie.contains_text('Additional Items'),'The additional item screen did not appear') + #~ assert(@@ie.contains_text('ADDON2'),'The new record with additional item code 1765BH1 did not appear') + #~ assert(@@ie.contains_text('Add-on for meter M3'),'The updated description Base for slamshut valves did not appear') + #~ assert(@@ie.contains_text('20'),'The lead time 20 for the add-on did not appear') + #~ end + # + #Check that the LOGGER record can be deleted and that the record is no longer displayed in the report + # + def test_05_delete_addon + @@ie.link(:text, 'LOGGER').click + @@ie.wait + assert(@@ie.contains_text('Create/Edit Additional Item'),'The Create/Edit Additional Item screen did not appear') + assert(@@ie.text_field(:id, 'P7_CODE').verify_contains('LOGGER'), 'The additional item code field did not contain value LOGGER') + assert(@@ie.text_field(:id, 'P7_DESCRIPTION').verify_contains('Logger'), 'The description is not logger') + assert(@@ie.text_field(:id, 'P7_LEAD_TIME').verify_contains('9999'), 'Lead time is not 9999') + 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('LOGGER'),'The additional item record with code LOGGER appears on screen') + end + # + #~ Check that the additional item code cannot be updated + # + def test_06_update_addon_code + @@ie.link(:text, 'ADDON2').click + @@ie.wait + assert(@@ie.contains_text('Create/Edit Additional Item '),'The Create/Edit Additional Item screen did not appear') + assert(@@ie.text_field(:id, 'P7_CODE').verify_contains('ADDON2'), 'The additional item code field did not contain value ADDON2') + assert(@@ie.text_field(:id, 'P7_DESCRIPTION').verify_contains('Add-on for meter M3'), 'The description is not Add-on for meter M3') + assert(@@ie.text_field(:id, 'P7_LEAD_TIME').verify_contains('20'), 'Lead time is not 20') + 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, 'P7_CODE').set("ADDON3") + @@ie.button(:id, 'apply_changes').click + @@ie.wait + assert(@@ie.contains_text('Create/Edit Additional Item'),'The additional item screen did not appear') + assert(@@ie.contains_text('ADDON2'),'The record with additional item code ADDON2 did not appear') + end + # + #Check that an additional item record with child records cannot be deleted + # + def test_07_delete_addon_child + assert(@@ie.contains_text('Create/Edit Additional Item'),'The Create/Edit Additional Item screen did not appear') + assert(@@ie.text_field(:id, 'P7_CODE').verify_contains('1765BH2'), 'The additional item code field did not contain value 3811H') + assert(@@ie.text_field(:id, 'P7_DESCRIPTION').verify_contains('Base for regulators'), 'The description is not additional item for meters') + assert(@@ie.text_field(:id, 'P7_LEAD_TIME').verify_contains('20'), 'Lead time is not 20') + 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('1765BH2'),'The additional item code field did not contain value 1765BH2') + end + # + #Check that a duplicate additional item record cannot be recorded + # + #~ def test_08_create_duplicate_base + #~ 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 Base'),'The Create/Edit Base screen did not appear') + #~ assert(@@ie.text_field(:id, 'P19_CODE').exists?,'The additional item code field is not available') + #~ assert(@@ie.text_field(:id, 'P19_DESCRIPTION').exists?,'The additional item description field is not available') + #~ assert(@@ie.text_field(:id, 'P19_DIM_A').exists?,'The dimension A field is not available') + #~ assert(@@ie.text_field(:id, 'P19_DIM_B').exists?,'The dimension B field is not available') + #~ assert(@@ie.text_field(:id, 'P19_DIM_C').exists?,'The dimension C field is not available') + #~ assert(@@ie.text_field(:id, 'P19_DIM_D').exists?,'The dimension D field is not available') + #~ assert(@@ie.text_field(:id, 'P19_DIM_E').exists?,'The dimension E field is not available') + #~ assert(@@ie.text_field(:id, 'P19_DIM_F').exists?,'The dimension F field is not available') + #~ assert(@@ie.text_field(:id, 'P19_DIM_G').exists?,'The dimension G field is not available') + #~ assert(@@ie.text_field(:id, 'P19_DIM_H').exists?,'The dimension H field is not available') + #~ assert(@@ie.text_field(:id, 'P19_DIM_I').exists?,'The dimension I field is not available') + #~ assert(@@ie.select_list(:id, 'P19_DRWG_CODE').exists?,'The drawing code 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, 'P19_CODE').set('1765BH1') + #~ @@ie.text_field(:id, 'P19_DESCRIPTION').set('Base for meters') + #~ @@ie.text_field(:id, 'P19_DIM_A').set('3800') + #~ @@ie.text_field(:id, 'P19_DIM_B').set('1400') + #~ @@ie.text_field(:id, 'P19_DIM_C').set('2400') + #~ @@ie.text_field(:id, 'P19_DIM_D').set('3800') + #~ @@ie.text_field(:id, 'P19_DIM_E').set('1400') + #~ @@ie.text_field(:id, 'P19_DIM_F').set('2400') + #~ @@ie.text_field(:id, 'P19_DIM_G').set('3800') + #~ @@ie.text_field(:id, 'P19_DIM_H').set('1400') + #~ @@ie.text_field(:id, 'P19_DIM_I').set('2400') + #~ @@ie.select_list(:id, 'P19_DRWG_CODE').select('WI') + #~ @@ie.button(:id, 'create').click + #~ @@ie.wait + #~ assert_nil(@@ie.contains_text('Bases'),'The additional item screen did appear') + #~ assert_nil(@@ie.contains_text('1765BH1'),'The new record with additional item code 1765BH1 did appear') + #~ assert_nil(@@ie.contains_text('Base for meters'),'The description Base for meters did appear') + #~ assert_nil(@@ie.contains_text('3800'),'The value 3800 for Dimension A did appear') + #~ assert_nil(@@ie.contains_text('1400'),'The value 1400 for Dimension B did appear') + #~ assert_nil(@@ie.contains_text('2400'),'The value 2400 for Dimension C did appear') + #~ assert_nil(@@ie.contains_text('3800'),'The value 3800 for Dimension D did appear') + #~ assert_nil(@@ie.contains_text('1400'),'The value 1400 for Dimension E did appear') + #~ assert_nil(@@ie.contains_text('2400'),'The value 2400 for Dimension F did appear') + #~ assert_nil(@@ie.contains_text('3800'),'The value 3800 for Dimension G did appear') + #~ assert_nil(@@ie.contains_text('1400'),'The value 1400 for Dimension H did appear') + #~ assert_nil(@@ie.contains_text('2400'),'The value 2400 for Dimension I did appear') + #~ assert_nil(@@ie.contains_text('WI'),'The new record with drawing code WI did appear') + #~ assert(@@ie.contains_text('Error'),'An error was not generated') + + #~ end +end + + + + + + + + diff --git a/tests/drawingtests.rb b/tests/drawingtests.rb new file mode 100644 index 0000000..db4ebd5 --- /dev/null +++ b/tests/drawingtests.rb @@ -0,0 +1,150 @@ +#--- +#This unit test checks the drawings screen. +#--- +class Test_02_drawings_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 drawings record + # + def test_01_drawing_screen_appears + @@ie.goto(DRAWING) + #we'll need to login + login(DK, DK_PWD) + assert(@@ie.contains_text('Drawings'),'The drawing screen did not appear') + assert(@@ie.contains_text('Code'),'The drawing code column did not appear') + assert(@@ie.contains_text('Description'),'The drawing description column did not appear') + assert(@@ie.button(:id, 'create').exists?,'The create button was not available') + end + # + #Check that the Create/Edit Drawing form can be accessed using the Create button on the Drawings 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_drawing_screen_appears + @@ie.button(:id, 'create').click + @@ie.wait + assert(@@ie.contains_text('Create/Edit Drawings'),'The create/edit drawing screen did not appear') + assert(@@ie.text_field(:id, 'P13_CODE').exists?,'The drawings code field is not available') + assert(@@ie.text_field(:id, 'P13_DESCRIPTION').exists?,'The drawings description 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 + # + #Check that the Create/Edit Drawing form allows data to be inserted to create a new drawing + #Check that the new drawing record appears in the report + # + def test_03_create_drawing + @@ie.text_field(:id, 'P13_CODE').set("D1") + @@ie.text_field(:id, 'P13_DESCRIPTION').set("Drawing for housing") + @@ie.button(:id, 'create').click + @@ie.wait + assert(@@ie.contains_text('Drawings'),'The drawing screen did not appear') + assert(@@ie.contains_text('D1'),'The new record with drawing code D1 did not appear') + assert(@@ie.contains_text('Drawing for housing'),'The description for D1, Drawing for housing did not appear') + @@ie.button(:id, 'create').click + @@ie.wait + assert(@@ie.contains_text('Create/Edit Drawings'),'The create/edit drawing screen did not appear') + assert(@@ie.text_field(:id, 'P13_CODE').exists?,'The drawings code field is not available') + assert(@@ie.text_field(:id, 'P13_DESCRIPTION').exists?,'The drawings description 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, 'P13_CODE').set("D2") + @@ie.text_field(:id, 'P13_DESCRIPTION').set("Drawing for module") + @@ie.button(:id, 'create').click + @@ie.wait + assert(@@ie.contains_text('Drawings'),'The drawing screen did not appear') + assert(@@ie.contains_text('D2'),'The new record with drawing code D1 did not appear') + assert(@@ie.contains_text('Drawing for module'),'The description for D2, Drawing for module did not appear') + end + # + #Check that the D1 code links to the Create/Edit Drawing form and the form appears with the correct data + #in the fields. Check that the drawing description can be updated and the updated record appears in the Drawings report + # + def test_04_update_drawing + @@ie.link(:text, 'D1').click + assert(@@ie.text_field(:id, 'P13_CODE').verify_contains('D1'),'The drawing code field did not contain value D1') + assert(@@ie.text_field(:id, 'P13_DESCRIPTION').verify_contains('Drawing for housing'),'The drawing description field did not contain value Drawing for housing') + 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, 'P13_DESCRIPTION').set('Drawing for base') + @@ie.button(:id, 'apply_changes').click + @@ie.wait + assert(@@ie.contains_text('Drawings'),'The drawing screen did not appear') + assert(@@ie.contains_text('D1'),'The record with drawing code D1 did not appear') + assert(@@ie.contains_text('Drawing for base'),'The updated description Drawing for base did not appear') + end + # + #Check that the drawing D2 can be deleted and that the record is no longer displayed in the report + # + def test_05_delete_drawing + @@ie.link(:text, 'D2').click + assert(@@ie.text_field(:id, 'P13_CODE').verify_contains('D2'),'The drawing code is not D2') + assert(@@ie.text_field(:id, 'P13_DESCRIPTION').verify_contains('Drawing for module'),'The description is not drawing for module') + 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('D2'),'The drawing code D2 did appear') + end + # + #Check that the drawing code cannot be updated + # + #~ def test_06_update_drawing_code + #~ @@ie.link(:text, 'D1').click + #~ assert(@@ie.text_field(:id, 'P13_CODE').verify_contains('D1'),'The drawing code field did not contain value D1') + #~ assert(@@ie.text_field(:id, 'P13_DESCRIPTION').verify_contains('Drawing for base'),'The drawing description field did not contain value Drawing for housing') + #~ 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, 'P13_CODE').set("D2") + #~ @@ie.button(:id, 'apply_changes').click + #~ @@ie.wait + #~ assert(@@ie.contains_text('Drawings'),'The drawing screen did not appear') + #~ assert(@@ie.contains_text('D2'),'The record with drawing code D1 did not appear') + #~ end + # + #Check that a drawing record with child records cannot be deleted + #~ + #~ def test_07_delete_drawing_child + #~ @@ie.link(:text, 'lphhcompac').click + #~ assert(@@ie.text_field(:id, 'P13_CODE').verify_contains('lphhcompac'),'The drawing code is not lphhcompac') + #~ assert(@@ie.text_field(:id, 'P13_DESCRIPTION').verify_contains('MODULE'),'The description is not module') + #~ 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('lphhcompac'),'The record with drawing code lphhcompac did not appear') + #~ end + # + #Check that a duplicate drawing 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 + assert(@@ie.contains_text('Create/Edit Drawings'),'The create/edit drawing screen did not appear') + assert(@@ie.text_field(:id, 'P13_CODE').exists?,'The drawings code field is not available') + assert(@@ie.text_field(:id, 'P13_DESCRIPTION').exists?,'The drawings description 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, 'P13_CODE').set("D1") + @@ie.text_field(:id, 'P13_DESCRIPTION').set("HOUSING") + @@ie.button(:id, 'create').click + @@ie.wait + assert_nil(@@ie.contains_text('Drawings'),'The drawing screen did not appear') + assert_nil(@@ie.contains_text('D1'),'The new record with drawing code D1 did appear') + assert_nil(@@ie.contains_text('HOUSING'),'The description for D1, housing did appear') + assertl(@@ie.contains_text('Error'),'An error was not generated') + end +# +end + + + + + + + + diff --git a/tests/housingtests.rb b/tests/housingtests.rb new file mode 100644 index 0000000..17928e0 --- /dev/null +++ b/tests/housingtests.rb @@ -0,0 +1,260 @@ +#--- +#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 user’s 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(DK, DK_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 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 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 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(@@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 THROUGH'),'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 + # + 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 Through'), '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') + @@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 + +end + + + + + + + + diff --git a/tests/moduletests.rb b/tests/moduletests.rb new file mode 100644 index 0000000..eddfc90 --- /dev/null +++ b/tests/moduletests.rb @@ -0,0 +1,287 @@ +#--- +#This unit test checks the modules screen. +#--- +class Test_04_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(DK, DK_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.text_field(: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.text_field(:id, 'P57_BAS_CODE').exists?,'The base code field is not available') + assert(@@ie.text_field(: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.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.text_field(:id, 'P57_METR_CODE').set('MRD1600B4F') + @@ie.select_list(:id, 'P57_FLTR_CODE').select('Gauze - 100') + @@ie.select_list(:id, 'P57_REGU_CODE').select('J48 - 30') + @@ie.select_list(:id, 'P57_REVA_CODE').select('10L: Size 25: Setting 35') + @@ie.select_list(:id, 'P57_SLVA_CODE').select('Integral: Size 25: Setting 47.5') + @@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.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('INCH BS 746') + @@ie.select_list(:id, 'P57_OUTLET_CNOR_CODE').select('Vertical Down') + @@ie.select_list(:id, 'P57_OUTLET_CNTY_CODE').select('INCH 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') + @@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.text_field(:id, 'P57_METR_CODE').set('MRD1600B4F') + @@ie.select_list(:id, 'P57_FLTR_CODE').select('Gauze - 100') + @@ie.select_list(:id, 'P57_REGU_CODE').select('J48 - 30') + @@ie.select_list(:id, 'P57_REVA_CODE').select('10L: Size 25: Setting 35') + @@ie.select_list(:id, 'P57_SLVA_CODE').select('Integral: Size 25: Setting 47.5') + @@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.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('INCH BS 746') + @@ie.select_list(:id, 'P57_OUTLET_CNOR_CODE').select('Vertical Down') + @@ie.select_list(:id, 'P57_OUTLET_CNTY_CODE').select('INCH 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') + @@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.text_field(:id, 'P57_CODE').verify_contains('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 - 30') + @@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 - 30'),'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 + +end + + + + + + + +