diff --git a/tests/enquirytests.rb b/tests/enquirytests.rb index daff0b7..16e46e1 100644 --- a/tests/enquirytests.rb +++ b/tests/enquirytests.rb @@ -16,6 +16,7 @@ class Test_02_enquiry < Test::Unit::TestCase "Removal of a Standard meter", "Removal of non-Standard meter", "Request for OFGEM Meter Accuracy Test (OFMAT)"] + @@savedenquiryid = '' # #Test we can logon to the system using the webmip administrator user’s login credentials #and create a new enquiry screen @@ -46,17 +47,20 @@ class Test_02_enquiry < Test::Unit::TestCase assert(@@ie.text_field(:id,'P32_MPRN').exists?,'Could not find P32_MPRN field') assert(@@ie.text_field(:id,'P32_MPRN_ALT').exists?,'Could not find P32_MPRN_ALT field') assert(@@ie.text_field(:id,'P32_TRANSACTION_REFERENCE').exists?,'Could not find P32_TRANSACTION_REFERENCE field') + assert(@@ie.text_field(:id,'P32_FIRST_CONTACT_NAME').exists?,'Could not find P32_FIRST_CONTACT_NAME field') + assert(@@ie.text_field(:id,'P32_FIRST_CONTACT_TELEPHONE_1').exists?,'Could not find P32_FIRST_CONTACT_TELEPHONE_1 field') + assert(@@ie.text_field(:id,'P32_FIRST_CONTACT_TELEPHONE_2').exists?,'Could not find P32_FIRST_CONTACT_TELEPHONE_2 field') + assert(@@ie.text_field(:id,'P32_FIRST_CONTACT_FAX').exists?,'Could not find P32_FIRST_CONTACT_FAX field') assert(@@ie.text_field(:id,'P32_INSTALL_SUB_BUILDING').exists?,'Could not find P32_INSTALL_SUB_BUILDING field') assert(@@ie.text_field(:id,'P32_INSTALL_BUILDING').exists?,'Could not find P32_INSTALL_BUILDING field') assert(@@ie.text_field(:id,'P32_INSTALL_STREET').exists?,'Could not find P32_INSTALL_STREET field') assert(@@ie.text_field(:id,'P32_INSTALL_CITY').exists?,'Could not find P32_INSTALL_CITY field') assert(@@ie.text_field(:id,'P32_INSTALL_POSTCODE').exists?,'Could not find P32_INSTALL_POSTCODE field') - assert(@@ie.text_field(:id,'P32_FIRST_CONTACT_NAME').exists?,'Could not find P32_FIRST_CONTACT_NAME field') assert(@@ie.select_list(:id,'P32_INSTALL_ADDRESS').exists?,'Could not find P32_INSTALL_ADDRESS select list') assert(@@ie.select_list(:id,'P32_SECOND_CONTACT').exists?,'Could not find P32_SECOND_CONTACT select list') assert(@@ie.select_list(:id,'P32_ENTY_CODE').exists?,'Could not find P32_ENTY_CODE select list') assert_equal(@@enquirytypes,@@ie.select_list(:id,'P32_ENTY_CODE').getAllContents,'List of options for P32_ENTY_CODE did not match what was expected') - assert(@@ie.text_field(:id,'P32_EXISTING_METER_OWNER').exists?,'Could not find P32_EXISTING_METER_OWNER field') + assert(@@ie.select_list(:id,'P32_EXISTING_METER_OWNER').exists?,'Could not find P32_EXISTING_METER_OWNER field') assert(@@ie.text_field(:id,'P32_EXISTING_METER_ASSET_PROVIDER').exists?,'Could not find P32_EXISTING_METER_ASSET_PROVIDER field') assert(@@ie.select_list(:id,'P32_INDICATIVE_TIME').exists?,'Could not find P32_INDICATIVE_TIME select list') assert(@@ie.select_list(:id,'P32_REQUIRED_SVCP_CODE').exists?,'Could not find P32_REQUIRED_SVCP_CODE select list') @@ -148,16 +152,19 @@ class Test_02_enquiry < Test::Unit::TestCase # is a second contact address) # def test_07_check_second_contact_address_fields_appear_when_no_is_selected - listofoptions=["Yes","No"] - @@ie.select_list(:id,'P32_SECOND_CONTACT').set "Yes" - @@ie.wait - assert_equal(listofoptions,@@ie.select_list(:id, 'P32_SECOND_CONTACT').getAllContents ,'The expected yes/no list for 2nd contact was not found') - assert(@@ie.text_field(:id,'P32_SECOND_CONTACT_NAME').exists?,'Could not find P32_SECOND_CONTACT_NAME field') - assert(@@ie.text_field(:id,'P32_SECOND_ALT_SUB_BUILDING').exists?,'Could not find P32_SECOND_ALT_SUB_BUILDING field') - assert(@@ie.text_field(:id,'P32_SECOND_ALT_BUILDING').exists?,'Could not find P32_SECOND_ALT_BUILDING field') - assert(@@ie.text_field(:id,'P32_SECOND_ALT_STREET').exists?,'Could not find P32_SECOND_ALT_STREET field') - assert(@@ie.text_field(:id,'P32_SECOND_ALT_CITY').exists?,'Could not find P32_SECOND_ALT_CITY field') - assert(@@ie.text_field(:id,'P32_SECOND_ALT_POSTCODE').exists?,'Could not find P32_SECOND_ALT_POSTCODE field') + listofoptions=["Yes","No"] + @@ie.select_list(:id,'P32_SECOND_CONTACT').set "Yes" + @@ie.wait + assert_equal(listofoptions,@@ie.select_list(:id, 'P32_SECOND_CONTACT').getAllContents ,'The expected yes/no list for 2nd contact was not found') + assert(@@ie.text_field(:id,'P32_SECOND_CONTACT_NAME').exists?,'Could not find P32_SECOND_CONTACT_NAME field') + assert(@@ie.text_field(:id,'P32_SECOND_CONTACT_TELEPHONE_1').exists?,'Could not find P32_SECOND_CONTACT_TELEPHONE_1 field') + assert(@@ie.text_field(:id,'P32_SECOND_CONTACT_TELEPHONE_2').exists?,'Could not find P32_SECOND_CONTACT_TELEPHONE_2 field') + assert(@@ie.text_field(:id,'P32_SECOND_CONTACT_FAX').exists?,'Could not find P32_SECOND_CONTACT_FAX field') + assert(@@ie.text_field(:id,'P32_SECOND_ALT_SUB_BUILDING').exists?,'Could not find P32_SECOND_ALT_SUB_BUILDING field') + assert(@@ie.text_field(:id,'P32_SECOND_ALT_BUILDING').exists?,'Could not find P32_SECOND_ALT_BUILDING field') + assert(@@ie.text_field(:id,'P32_SECOND_ALT_STREET').exists?,'Could not find P32_SECOND_ALT_STREET field') + assert(@@ie.text_field(:id,'P32_SECOND_ALT_CITY').exists?,'Could not find P32_SECOND_ALT_CITY field') + assert(@@ie.text_field(:id,'P32_SECOND_ALT_POSTCODE').exists?,'Could not find P32_SECOND_ALT_POSTCODE field') end # #Check all the correct fields are displayed when a non standard install job is selected @@ -168,7 +175,7 @@ class Test_02_enquiry < Test::Unit::TestCase @@ie.select_list(:id,'P32_ENTY_CODE').set @@enquirytypes[7] @@ie.wait assert_equal(@@enquirytypes,@@ie.select_list(:id, 'P32_ENTY_CODE').getAllContents ,'The expected list for job type was not found') - assert(@@ie.text_field(:id,'P32_EXISTING_METER_OWNER').exists?,'Could not find P32_EXISTING_METER_OWNER field') + assert(@@ie.select_list(:id,'P32_EXISTING_METER_OWNER').exists?,'Could not find P32_EXISTING_METER_OWNER field') assert(@@ie.text_field(:id,'P32_EXISTING_METER_ASSET_PROVIDER').exists?,'Could not find P32_EXISTING_METER_ASSET_PROVIDER field') assert(@@ie.select_list(:id,'P32_INDICATIVE_TIME').exists?,'Could not find P32_INDICATIVE_TIME select list') assert(@@ie.select_list(:id,'P32_REQUIRED_SVCP_CODE').exists?,'Could not find P32_REQUIRED_SVCP_CODE select list') @@ -207,7 +214,7 @@ class Test_02_enquiry < Test::Unit::TestCase @@ie.select_list(:id,'P32_ENTY_CODE').set @@enquirytypes[6] @@ie.wait assert_equal(@@enquirytypes,@@ie.select_list(:id, 'P32_ENTY_CODE').getAllContents ,'The expected list for job type was not found') - assert(@@ie.text_field(:id,'P32_EXISTING_METER_OWNER').exists?,'Could not find P32_EXISTING_METER_OWNER field') + assert(@@ie.select_list(:id,'P32_EXISTING_METER_OWNER').exists?,'Could not find P32_EXISTING_METER_OWNER field') assert(@@ie.text_field(:id,'P32_EXISTING_METER_ASSET_PROVIDER').exists?,'Could not find P32_EXISTING_METER_ASSET_PROVIDER field') assert(@@ie.select_list(:id,'P32_INDICATIVE_TIME').exists?,'Could not find P32_INDICATIVE_TIME select list') assert(@@ie.select_list(:id,'P32_REQUIRED_SVCP_CODE').exists?,'Could not find P32_REQUIRED_SVCP_CODE select list') @@ -227,22 +234,22 @@ class Test_02_enquiry < Test::Unit::TestCase assert(@@ie.text_field(:id,'P32_JOB_DESCRIPTION').exists?,'Could not find P32_JOB_DESCRIPTION field') assert(@@ie.text_field(:id,'P32_QMAX').exists?,'Could not find P32_QMAX field') assert(@@ie.text_field(:id,'P32_QMIN').exists?,'Could not find P32_QMIN field') - assert_equal(false,@@ie.select_list(:id,'P32_METER_SIZE').exists?,'Found P32_METER_SIZE select list') - assert(@@ie.select_list(:id,'P32_EXISTING_METY_CODE').exists?,'Could not find P32_METY_CODE select list') - assert(@@ie.select_list(:id,'P32_EXISTING_MESC_CODE').exists?,'Could not find P32_EXISTING_MESC_CODE select list') - assert(@@ie.select_list(:id,'P32_EXISTING_SVCP_CODE').exists?,'Could not find P32_EXISTING_SVCP_CODE select list') - assert(@@ie.text_field(:id,'P32_EXISTING_METER_SERIAL_NO').exists?,'Could not find P32_EXISTING_METER_SERIAL_NO field') - assert(@@ie.text_field(:id,'P32_EXISTING_METER_MODEL').exists?,'Could not find P32_EXISTING_METER_MODEL field') + assert(@@ie.select_list(:id,'P32_METER_SIZE').exists?,'Could not find P32_METER_SIZE select list') + assert_equal(false,@@ie.select_list(:id,'P32_EXISTING_METY_CODE').exists?,'Found P32_METY_CODE select list') + assert_equal(false,@@ie.select_list(:id,'P32_EXISTING_MESC_CODE').exists?,'Found P32_EXISTING_MESC_CODE select list') + assert_equal(false,@@ie.select_list(:id,'P32_EXISTING_SVCP_CODE').exists?,'Found P32_EXISTING_SVCP_CODE select list') + assert_equal(false,@@ie.text_field(:id,'P32_EXISTING_METER_SERIAL_NO').exists?,'Found P32_EXISTING_METER_SERIAL_NO field') + assert_equal(false,@@ie.text_field(:id,'P32_EXISTING_METER_MODEL').exists?,'Found P32_EXISTING_METER_MODEL field') assert(@@ie.select_list(:id,'P32_MARKET_SECTOR_CODE').exists?,'Could not find P32_MARKET_SECTOR_CODE select list') assert(@@ie.text_field(:id,'P32_OTHER_INFORMATION').exists?,'Could not find P32_OTHER_INFORMATION field') assert_equal(false,@@ie.text_field(:id,'P32_EXISTING_LOGGER').exists?,'Found P32_EXISTING_LOGGER select list') - assert(@@ie.text_field(:id,'P32_EXISTING_CONVERTOR').exists?,'Could not find P32_EXISTING_CONVERTOR select list') + assert_equal(false,@@ie.text_field(:id,'P32_EXISTING_CONVERTOR').exists?,'Found P32_EXISTING_CONVERTOR select list') end def test_10_ofmat_selected_check_fields_appear_available @@ie.select_list(:id,'P32_ENTY_CODE').set @@enquirytypes[12] @@ie.wait assert_equal(@@enquirytypes,@@ie.select_list(:id, 'P32_ENTY_CODE').getAllContents ,'The expected list for job type was not found') - assert(@@ie.text_field(:id,'P32_EXISTING_METER_OWNER').exists?,'Could not find P32_EXISTING_METER_OWNER field') + assert(@@ie.select_list(:id,'P32_EXISTING_METER_OWNER').exists?,'Could not find P32_EXISTING_METER_OWNER field') assert(@@ie.text_field(:id,'P32_EXISTING_METER_ASSET_PROVIDER').exists?,'Could not find P32_EXISTING_METER_ASSET_PROVIDER field') assert(@@ie.select_list(:id,'P32_INDICATIVE_TIME').exists?,'Could not find P32_INDICATIVE_TIME select list') assert(@@ie.select_list(:id,'P32_REQUIRED_SVCP_CODE').exists?,'Could not find P32_REQUIRED_SVCP_CODE select list') @@ -277,7 +284,7 @@ class Test_02_enquiry < Test::Unit::TestCase @@ie.select_list(:id,'P32_ENTY_CODE').set @@enquirytypes[5] @@ie.wait assert_equal(@@enquirytypes,@@ie.select_list(:id, 'P32_ENTY_CODE').getAllContents ,'The expected list for job type was not found') - assert(@@ie.text_field(:id,'P32_EXISTING_METER_OWNER').exists?,'Could not find P32_EXISTING_METER_OWNER field') + assert(@@ie.select_list(:id,'P32_EXISTING_METER_OWNER').exists?,'Could not find P32_EXISTING_METER_OWNER field') assert(@@ie.text_field(:id,'P32_EXISTING_METER_ASSET_PROVIDER').exists?,'Could not find P32_EXISTING_METER_ASSET_PROVIDER field') assert(@@ie.select_list(:id,'P32_INDICATIVE_TIME').exists?,'Could not find P32_INDICATIVE_TIME select list') assert(@@ie.select_list(:id,'P32_REQUIRED_SVCP_CODE').exists?,'Could not find P32_REQUIRED_SVCP_CODE select list') @@ -312,7 +319,7 @@ class Test_02_enquiry < Test::Unit::TestCase @@ie.select_list(:id,'P32_ENTY_CODE').set @@enquirytypes[4] @@ie.wait assert_equal(@@enquirytypes,@@ie.select_list(:id, 'P32_ENTY_CODE').getAllContents ,'The expected list for job type was not found') - assert(@@ie.text_field(:id,'P32_EXISTING_METER_OWNER').exists?,'Could not find P32_EXISTING_METER_OWNER field') + assert(@@ie.select_list(:id,'P32_EXISTING_METER_OWNER').exists?,'Could not find P32_EXISTING_METER_OWNER field') assert(@@ie.text_field(:id,'P32_EXISTING_METER_ASSET_PROVIDER').exists?,'Could not find P32_EXISTING_METER_ASSET_PROVIDER field') assert(@@ie.select_list(:id,'P32_INDICATIVE_TIME').exists?,'Could not find P32_INDICATIVE_TIME select list') assert(@@ie.select_list(:id,'P32_REQUIRED_SVCP_CODE').exists?,'Could not find P32_REQUIRED_SVCP_CODE select list') @@ -347,7 +354,7 @@ class Test_02_enquiry < Test::Unit::TestCase @@ie.select_list(:id,'P32_ENTY_CODE').set @@enquirytypes[11] @@ie.wait assert_equal(@@enquirytypes,@@ie.select_list(:id, 'P32_ENTY_CODE').getAllContents ,'The expected list for job type was not found') - assert(@@ie.text_field(:id,'P32_EXISTING_METER_OWNER').exists?,'Could not find P32_EXISTING_METER_OWNER field') + assert(@@ie.select_list(:id,'P32_EXISTING_METER_OWNER').exists?,'Could not find P32_EXISTING_METER_OWNER field') assert(@@ie.text_field(:id,'P32_EXISTING_METER_ASSET_PROVIDER').exists?,'Could not find P32_EXISTING_METER_ASSET_PROVIDER field') assert(@@ie.select_list(:id,'P32_INDICATIVE_TIME').exists?,'Could not find P32_INDICATIVE_TIME select list') assert(@@ie.select_list(:id,'P32_REQUIRED_SVCP_CODE').exists?,'Could not find P32_REQUIRED_SVCP_CODE select list') @@ -382,7 +389,7 @@ class Test_02_enquiry < Test::Unit::TestCase @@ie.select_list(:id,'P32_ENTY_CODE').set @@enquirytypes[10] @@ie.wait assert_equal(@@enquirytypes,@@ie.select_list(:id, 'P32_ENTY_CODE').getAllContents ,'The expected list for job type was not found') - assert(@@ie.text_field(:id,'P32_EXISTING_METER_OWNER').exists?,'Could not find P32_EXISTING_METER_OWNER field') + assert(@@ie.select_list(:id,'P32_EXISTING_METER_OWNER').exists?,'Could not find P32_EXISTING_METER_OWNER field') assert(@@ie.text_field(:id,'P32_EXISTING_METER_ASSET_PROVIDER').exists?,'Could not find P32_EXISTING_METER_ASSET_PROVIDER field') assert(@@ie.select_list(:id,'P32_INDICATIVE_TIME').exists?,'Could not find P32_INDICATIVE_TIME select list') assert(@@ie.select_list(:id,'P32_REQUIRED_SVCP_CODE').exists?,'Could not find P32_REQUIRED_SVCP_CODE select list') @@ -417,7 +424,7 @@ class Test_02_enquiry < Test::Unit::TestCase @@ie.select_list(:id,'P32_ENTY_CODE').set @@enquirytypes[1] @@ie.wait assert_equal(@@enquirytypes,@@ie.select_list(:id, 'P32_ENTY_CODE').getAllContents ,'The expected list for job type was not found') - assert(@@ie.text_field(:id,'P32_EXISTING_METER_OWNER').exists?,'Could not find P32_EXISTING_METER_OWNER field') + assert(@@ie.select_list(:id,'P32_EXISTING_METER_OWNER').exists?,'Could not find P32_EXISTING_METER_OWNER field') assert(@@ie.text_field(:id,'P32_EXISTING_METER_ASSET_PROVIDER').exists?,'Could not find P32_EXISTING_METER_ASSET_PROVIDER field') assert(@@ie.select_list(:id,'P32_INDICATIVE_TIME').exists?,'Could not find P32_INDICATIVE_TIME select list') assert(@@ie.select_list(:id,'P32_REQUIRED_SVCP_CODE').exists?,'Could not find P32_REQUIRED_SVCP_CODE select list') @@ -452,7 +459,7 @@ class Test_02_enquiry < Test::Unit::TestCase @@ie.select_list(:id,'P32_ENTY_CODE').set @@enquirytypes[2] @@ie.wait assert_equal(@@enquirytypes,@@ie.select_list(:id, 'P32_ENTY_CODE').getAllContents ,'The expected list for job type was not found') - assert(@@ie.text_field(:id,'P32_EXISTING_METER_OWNER').exists?,'Could not find P32_EXISTING_METER_OWNER field') + assert(@@ie.select_list(:id,'P32_EXISTING_METER_OWNER').exists?,'Could not find P32_EXISTING_METER_OWNER field') assert(@@ie.text_field(:id,'P32_EXISTING_METER_ASSET_PROVIDER').exists?,'Could not find P32_EXISTING_METER_ASSET_PROVIDER field') assert(@@ie.select_list(:id,'P32_INDICATIVE_TIME').exists?,'Could not find P32_INDICATIVE_TIME select list') assert(@@ie.select_list(:id,'P32_REQUIRED_SVCP_CODE').exists?,'Could not find P32_REQUIRED_SVCP_CODE select list') @@ -487,7 +494,7 @@ class Test_02_enquiry < Test::Unit::TestCase @@ie.select_list(:id,'P32_ENTY_CODE').set @@enquirytypes[3] @@ie.wait assert_equal(@@enquirytypes,@@ie.select_list(:id, 'P32_ENTY_CODE').getAllContents ,'The expected list for job type was not found') - assert(@@ie.text_field(:id,'P32_EXISTING_METER_OWNER').exists?,'Could not find P32_EXISTING_METER_OWNER field') + assert(@@ie.select_list(:id,'P32_EXISTING_METER_OWNER').exists?,'Could not find P32_EXISTING_METER_OWNER field') assert(@@ie.text_field(:id,'P32_EXISTING_METER_ASSET_PROVIDER').exists?,'Could not find P32_EXISTING_METER_ASSET_PROVIDER field') assert(@@ie.select_list(:id,'P32_INDICATIVE_TIME').exists?,'Could not find P32_INDICATIVE_TIME select list') assert(@@ie.select_list(:id,'P32_REQUIRED_SVCP_CODE').exists?,'Could not find P32_REQUIRED_SVCP_CODE select list') @@ -522,7 +529,7 @@ class Test_02_enquiry < Test::Unit::TestCase @@ie.select_list(:id,'P32_ENTY_CODE').set @@enquirytypes[9] @@ie.wait assert_equal(@@enquirytypes,@@ie.select_list(:id, 'P32_ENTY_CODE').getAllContents ,'The expected list for job type was not found') - assert(@@ie.text_field(:id,'P32_EXISTING_METER_OWNER').exists?,'Could not find P32_EXISTING_METER_OWNER field') + assert(@@ie.select_list(:id,'P32_EXISTING_METER_OWNER').exists?,'Could not find P32_EXISTING_METER_OWNER field') assert(@@ie.text_field(:id,'P32_EXISTING_METER_ASSET_PROVIDER').exists?,'Could not find P32_EXISTING_METER_ASSET_PROVIDER field') assert(@@ie.select_list(:id,'P32_INDICATIVE_TIME').exists?,'Could not find P32_INDICATIVE_TIME select list') assert(@@ie.select_list(:id,'P32_REQUIRED_SVCP_CODE').exists?,'Could not find P32_REQUIRED_SVCP_CODE select list') @@ -554,10 +561,10 @@ class Test_02_enquiry < Test::Unit::TestCase assert(@@ie.text_field(:id,'P32_EXISTING_CONVERTOR').exists?,'Could not find P32_EXISTING_CONVERTOR select list') end def test_19_other_selected_check_fields_appear_available - @@ie.select_list(:id,'P32_ENTY_CODE').set @@enquirytypes[9] + @@ie.select_list(:id,'P32_ENTY_CODE').set @@enquirytypes[8] @@ie.wait assert_equal(@@enquirytypes,@@ie.select_list(:id, 'P32_ENTY_CODE').getAllContents ,'The expected list for job type was not found') - assert(@@ie.text_field(:id,'P32_EXISTING_METER_OWNER').exists?,'Could not find P32_EXISTING_METER_OWNER field') + assert(@@ie.select_list(:id,'P32_EXISTING_METER_OWNER').exists?,'Could not find P32_EXISTING_METER_OWNER field') assert(@@ie.text_field(:id,'P32_EXISTING_METER_ASSET_PROVIDER').exists?,'Could not find P32_EXISTING_METER_ASSET_PROVIDER field') assert(@@ie.select_list(:id,'P32_INDICATIVE_TIME').exists?,'Could not find P32_INDICATIVE_TIME select list') assert(@@ie.select_list(:id,'P32_REQUIRED_SVCP_CODE').exists?,'Could not find P32_REQUIRED_SVCP_CODE select list') @@ -566,14 +573,14 @@ class Test_02_enquiry < Test::Unit::TestCase assert(@@ie.select_list(:id,'P32_DOWNSTREAM_BOOSTER_OR_COMPRESS').exists?,'Could not find P32_DOWNSTREAM_BOOSTER_OR_COMPRESS select list') assert(@@ie.text_field(:id,'P32_INDICATIVE_DATE').exists?,'Could not find P32_INDICATIVE_DATE field') assert(@@ie.text_field(:id,'P32_OTHER_PROJECT_REFERENCE').exists?,'Could not find P32_OTHER_PROJECT_REFERENCE field') - assert_equal(false,@@ie.select_list(:id,'P32_HOUSING_REQUIRED').exists?,'Found P32_HOUSING_REQUIRED select list') - assert_equal(false,@@ie.select_list(:id,'P32_BASE_REQUIRED').exists?,'Found P32_BASE_REQUIRED select list') + assert(@@ie.select_list(:id,'P32_HOUSING_REQUIRED').exists?,'Could not find P32_HOUSING_REQUIRED select list') + assert(@@ie.select_list(:id,'P32_BASE_REQUIRED').exists?,'Could not find P32_BASE_REQUIRED select list') assert(@@ie.select_list(:id,'P32_CONVERTOR_REQUIRED').exists?,'Could not find P32_CONVERTOR_REQUIRED select list') assert_equal(false,@@ie.select_list(:id,'P32_AMR_REQUIRED').exists?,'Found P32_AMR_REQUIRED select list') assert(@@ie.select_list(:id,'P32_EMS_REQUIRED').exists?,'Could not find P32_EMS_REQUIRED select list') assert(@@ie.select_list(:id,'P32_BYPASS_REQUIRED').exists?,'Could not find P32_BYPASS_REQUIRED select list') assert(@@ie.select_list(:id,'P32_LOAD_CONTROL_TYPE').exists?,'Could not find P32_LOAD_CONTROL_TYPE select list') - assert_equal(false,@@ie.select_list(:id,'P32_TWIN_STREAM_REQUIRED').exists?,'Found P32_TWIN_STREAM_REQUIRED select list') + assert(@@ie.select_list(:id,'P32_TWIN_STREAM_REQUIRED').exists?,'Could not find P32_TWIN_STREAM_REQUIRED select list') assert(@@ie.text_field(:id,'P32_JOB_DESCRIPTION').exists?,'Could not find P32_JOB_DESCRIPTION field') assert(@@ie.text_field(:id,'P32_QMAX').exists?,'Could not find P32_QMAX field') assert(@@ie.text_field(:id,'P32_QMIN').exists?,'Could not find P32_QMIN field') @@ -617,6 +624,7 @@ class Test_02_enquiry < Test::Unit::TestCase assert(@@ie.text_field(:id,'P32_ID').exists?,'Could not find P32_ID field') assert(@@ie.select_list(:id,'P32_MKTP_REF2').exists?,'Could not find P32_MKTP_REF2 field') assert_equal(false,@@ie.select_list(:id,'P32_MKTP_REF').exists?,'Found P32_MKTP_REF field') + assert(@@ie.select_list(:id,'P32_AGENT_COMT_CODE').exists?,'Could not find P32_AGENT_COMT_CODE select list') assert(@@ie.select_list(:id,'P32_ALTY_CODE').exists?,'Could not find P32_ALTY_CODE select list') assert(@@ie.select_list(:id,'P32_CACA_CODE').exists?,'Could not find P32_CACA_CODE select list') assert(@@ie.select_list(:id,'P32_ASSET_LOCATION_NOTES').exists?,'Could not find P32_ASSET_LOCATION_NOTES select list') @@ -625,16 +633,19 @@ class Test_02_enquiry < Test::Unit::TestCase assert(@@ie.text_field(:id,'P32_MPRN').exists?,'Could not find P32_MPRN field') assert(@@ie.text_field(:id,'P32_MPRN_ALT').exists?,'Could not find P32_MPRN_ALT field') assert(@@ie.text_field(:id,'P32_TRANSACTION_REFERENCE').exists?,'Could not find P32_TRANSACTION_REFERENCE field') + assert(@@ie.text_field(:id,'P32_FIRST_CONTACT_NAME').exists?,'Could not find P32_FIRST_CONTACT_NAME field') + assert(@@ie.text_field(:id,'P32_FIRST_CONTACT_TELEPHONE_1').exists?,'Could not find P32_FIRST_CONTACT_TELEPHONE_1 field') + assert(@@ie.text_field(:id,'P32_FIRST_CONTACT_TELEPHONE_2').exists?,'Could not find P32_FIRST_CONTACT_TELEPHONE_2 field') + assert(@@ie.text_field(:id,'P32_FIRST_CONTACT_FAX').exists?,'Could not find P32_FIRST_CONTACT_FAX field') assert(@@ie.text_field(:id,'P32_INSTALL_SUB_BUILDING').exists?,'Could not find P32_INSTALL_SUB_BUILDING field') assert(@@ie.text_field(:id,'P32_INSTALL_BUILDING').exists?,'Could not find P32_INSTALL_BUILDING field') assert(@@ie.text_field(:id,'P32_INSTALL_STREET').exists?,'Could not find P32_INSTALL_STREET field') assert(@@ie.text_field(:id,'P32_INSTALL_CITY').exists?,'Could not find P32_INSTALL_CITY field') assert(@@ie.text_field(:id,'P32_INSTALL_POSTCODE').exists?,'Could not find P32_INSTALL_POSTCODE field') - assert(@@ie.text_field(:id,'P32_FIRST_CONTACT_NAME').exists?,'Could not find P32_FIRST_CONTACT_NAME field') assert(@@ie.select_list(:id,'P32_INSTALL_ADDRESS').exists?,'Could not find P32_INSTALL_ADDRESS select list') assert(@@ie.select_list(:id,'P32_SECOND_CONTACT').exists?,'Could not find P32_SECOND_CONTACT select list') assert(@@ie.select_list(:id,'P32_ENTY_CODE').exists?,'Could not find P32_ENTY_CODE select list') - assert(@@ie.text_field(:id,'P32_EXISTING_METER_OWNER').exists?,'Could not find P32_EXISTING_METER_OWNER field') + assert(@@ie.select_list(:id,'P32_EXISTING_METER_OWNER').exists?,'Could not find P32_EXISTING_METER_OWNER field') assert(@@ie.text_field(:id,'P32_EXISTING_METER_ASSET_PROVIDER').exists?,'Could not find P32_EXISTING_METER_ASSET_PROVIDER field') assert(@@ie.select_list(:id,'P32_INDICATIVE_TIME').exists?,'Could not find P32_INDICATIVE_TIME select list') assert(@@ie.select_list(:id,'P32_REQUIRED_SVCP_CODE').exists?,'Could not find P32_REQUIRED_SVCP_CODE select list') @@ -688,19 +699,151 @@ class Test_02_enquiry < Test::Unit::TestCase assert(@@ie.button(:value, 'Login').exists?,'The Login button was not available') @@ie.button(:value, 'Login').click @@ie.wait - #check we've got the login page + #check we've got the login page to enter data into assert(@@ie.text_field(:id,'P101_USERNAME').exists?,'Could not find P101_USERNAME field') assert(@@ie.text_field(:id,'P101_PASSWORD').exists?,'Could not find P101_PASSWORD field') assert(@@ie.button(:id, 'login').exists?,'Could not find a Login button') login(SA, SA_PWD) menu('Enquiries') assert_nil(@@ie.contains_text('Create Enquiry'),'Create Enquiry menu option found when should have been hidden') - end + end + # + # Log in as agent and create and save an enquiry + # + def test_23_login_as_agent_and_save_enquiry_then_change_apply_changes_request_for_quote + menu('Logout') + assert(@@ie.button(:value, 'Login').exists?,'The Login button was not available') + @@ie.button(:value, 'Login').click + @@ie.wait + #check we've got the login page + assert(@@ie.text_field(:id,'P101_USERNAME').exists?,'Could not find P101_USERNAME field') + assert(@@ie.text_field(:id,'P101_PASSWORD').exists?,'Could not find P101_PASSWORD field') + assert(@@ie.button(:id, 'login').exists?,'Could not find a Login button') + login(AGENT, AGENT_PWD) + menu('Enquiries') + menu('Create Enquiry') + assert(@@ie.contains_text('Enquiry'),'The Enquiry screen did not appear') + #check the regions appear + assert(@@ie.contains_text('Site Detail'),'Site Detail region not found') + assert(@@ie.contains_text('Site Address'),'The Site Address region not found') + assert(@@ie.contains_text('Contact Details'),'The Contact Details region not found') + assert(@@ie.contains_text('Job Info'),'The Job Info region not found') + #check we've got the save and cancel buttons but not apply changes + assert(@@ie.button(:value, 'Save').exists?,'Could not find a Save button') + assert(@@ie.button(:value, 'Cancel').exists?,'Could not find a Cancel button') + assert_not_equal(@@ie.button(:value, 'Apply Changes').exists?,true,'Found Apply Changes button when it should have been hidden') + #make sure that the ID field is not accessable (a form object) + #assert_not_equal(@@ie.text_field(:name, 'P32_ID').exists?,true,'Found Apply Changes button when it should have been hidden') + @@ie.select_list(:id,'P32_AGENT_COMT_CODE').set 'Fax' + @@ie.wait + @@ie.text_field(:id,'P32_AGENT_CONTACT_VALUE').set '1234567890' + @@ie.select_list(:id,'P32_ALTY_CODE').set 'Office' + @@ie.select_list(:id,'P32_CACA_CODE').set 'Blind' + @@ie.select_list(:id,'P32_ASSET_LOCATION_NOTES').set 'Post' + @@ie.text_field(:id,'P32_ACCESS_PASSWORD').set 'test 23' + @@ie.text_field(:id,'P32_ACCESS_ADDITIONAL').set 'no more info' + @@ie.text_field(:id,'P32_MPRN').set '12345678910' + @@ie.text_field(:id,'P32_TRANSACTION_REFERENCE').set 'this is test 23' + @@ie.text_field(:id,'P32_INSTALL_SUB_BUILDING').set ADDRESSA[0] + @@ie.text_field(:id,'P32_INSTALL_BUILDING').set ADDRESSA[1] + @@ie.text_field(:id,'P32_INSTALL_STREET').set ADDRESSA[2] + @@ie.text_field(:id,'P32_INSTALL_CITY').set ADDRESSA[3] + @@ie.text_field(:id,'P32_INSTALL_POSTCODE').set ADDRESSA[4] + @@ie.text_field(:id,'P32_FIRST_CONTACT_NAME').set 'Ted tester23' + @@ie.text_field(:id,'P32_FIRST_CONTACT_TELEPHONE_1').set '123456789' + @@ie.text_field(:id,'P32_FIRST_CONTACT_TELEPHONE_2').set '123456789' + @@ie.text_field(:id,'P32_FIRST_CONTACT_FAX').set '123456789' + @@ie.button(:value, 'Save').click + @@ie.wait + assert_nil(@@ie.contains_text('Error'),'Error found') + assert_equal(false,@@ie.button(:value, 'Save').exists?,'Found Save button when it should have been hidden') + assert(@@ie.button(:value, 'Apply Changes').exists?,'Could not find an Apply Changes button') + assert(@@ie.button(:value, 'Cancel').exists?,'Could not find a Cancel button') + assert(@@ie.button(:value, 'Upload File').exists?,'Could not find an Upload File button') + assert(@@ie.text_field(:id,'P32_ID').to_s,'No value in the ID field') + # + #We'll save the enquiry id so we can search for it later + # + @@savedenquiryid = @@ie.text_field(:id,'P32_ID').value + #Job details + @@ie.select_list(:id,'P32_ENTY_CODE').set @@enquirytypes[6] + @@ie.wait + @@ie.select_list(:id,'P32_EXISTING_METER_OWNER').set 'Supplier' + @@ie.text_field(:id,'P32_EXISTING_METER_ASSET_PROVIDER').set 'Mam stuff goes here' + #@@ie.select_list(:id,'P32_INDICATIVE_TIME').set '' + @@ie.select_list(:id,'P32_REQUIRED_SVCP_CODE').set 'LP' + @@ie.wait + @@ie.text_field(:id,'P32_ANNUAL_QUANTITY').set '1000' + @@ie.text_field(:id,'P32_REQUIRED_METERING_PRESSURE').set '15' + @@ie.select_list(:id,'P32_DOWNSTREAM_BOOSTER_OR_COMPRESS').set 'No' + @@ie.text_field(:id,'P32_INDICATIVE_DATE').set '17/07/2008' + @@ie.text_field(:id,'P32_OTHER_PROJECT_REFERENCE').set 'Test 23' + @@ie.select_list(:id,'P32_HOUSING_REQUIRED').set 'No' + @@ie.select_list(:id,'P32_BASE_REQUIRED').set 'No' + @@ie.select_list(:id,'P32_CONVERTOR_REQUIRED').set 'No' + #@@ie.select_list(:id,'P32_AMR_REQUIRED').set 'No' + @@ie.select_list(:id,'P32_EMS_REQUIRED').set 'No' + @@ie.select_list(:id,'P32_BYPASS_REQUIRED').set 'Not required' + @@ie.wait + @@ie.select_list(:id,'P32_LOAD_CONTROL_TYPE').set 'Constant' + @@ie.select_list(:id,'P32_TWIN_STREAM_REQUIRED').set 'No' + @@ie.text_field(:id,'P32_JOB_DESCRIPTION').set '' + @@ie.text_field(:id,'P32_QMAX').set '16' + @@ie.text_field(:id,'P32_QMIN').set '' + @@ie.select_list(:id,'P32_METER_SIZE').set 'U16' + #@@ie.select_list(:id,'P32_EXISTING_METY_CODE').set '' + #@@ie.select_list(:id,'P32_EXISTING_MESC_CODE').set '' + #@@ie.text_field(:id,'P32_EXISTING_METER_SERIAL_NO').set '' + #@@ie.text_field(:id,'P32_EXISTING_METER_MODEL').set '' + #@@ie.select_list(:id,'P32_MARKET_SECTOR_CODE').set '' + @@ie.text_field(:id,'P32_OTHER_INFORMATION').set '' + #@@ie.text_field(:id,'P32_EXISTING_LOGGER').set '' + #@@ie.text_field(:id,'P32_EXISTING_CONVERTOR').set '' + #check fileupload via upload control on enquiry form + #we know InstallMIP.cmd is around + @@ie.file_field(:id, 'P32_ENQUIRY_FILES').set(WORKINGDIR+'\\InstallMIP.cmd') + @@ie.button(:value, 'Apply Changes').click + @@ie.wait + assert_nil(@@ie.contains_text('Error'),'Error found') + @@ie.button(:value, 'Request Quotation').click + @@ie.wait + assert_nil(@@ie.contains_text('Error'),'Error found') + assert_nil(@@ie.contains_text('error'),'Error found') + end + + def test_24_find_saved_quote + menu('Enquiries') + menu('Search for Enquiry') + assert(@@ie.text_field(:id,'P30_ENQUIRY_ID').exists?,'Could not find P30_ENQUIRY_ID field') + assert(@@ie.text_field(:id,'P30_MPRN').exists?,'Could not find P30_MPRN field') + assert(@@ie.text_field(:id,'P30_TRANS_REF').exists?,'Could not find P30_TRANS_REF field') + assert(@@ie.text_field(:id,'P30_POSTCODE').exists?,'Could not find P30_POSTCODE field') + + assert(@@ie.contains_text('Search Enquiries'),'Search Enquiries region not found') + assert(@@ie.contains_text('Supplier Enquiries'),'All Enquiries region not found') + + assert(@@ie.button(:value, 'Search').exists?,'Could not find a Search button') + assert(@@ie.button(:value, 'New').exists?,'Could not find a New button') + + @@ie.text_field(:id,'P30_ENQUIRY_ID').set @@savedenquiryid + @@ie.button(:value, 'Search').click + @@ie.wait + assert(@@ie.contains_text(@@savedenquiryid),' Enquiry '+@@savedenquiryid+' not found') + assert(@@ie.link(:name,'View_enquiry_'+@@savedenquiryid).exists?,'Could not find link to Enquiry '+@@savedenquiryid) + @@ie.link(:name,'View_enquiry_'+@@savedenquiryid).click + @@ie.wait + assert(@@ie.contains_text('Enquiry'),'The Enquiry screen did not appear') + #check the regions appear + assert(@@ie.contains_text('Site Detail'),'Site Detail region not found') + assert(@@ie.contains_text('Site Address'),'The Site Address region not found') + assert(@@ie.contains_text('Contact Details'),'The Contact Details region not found') + assert(@@ie.contains_text('Job Info'),'The Job Info region not found') + assert_equal(@@savedenquiryid,@@ie.text_field(:id,'P32_ID').value,' Enquiry screen for'+@@savedenquiryid+' not found') + assert_equal(false,@@ie.text_field(:id,'P32_ACCESS_PASSWORD').assert_not_readonly,'Password field is not read only, it should be!') + end #Check asterisk on correct fields -#Create a new enquiry #Amend an existing enquiry #Is dash doing this?Copy an existing enquiry to a new enquiry -#Enquiry State (for different job types) #Tripartite agreement(need to get data) #Test Manual quote, request for quote and upload file buttons