#---
#This unit test checks the export data function of webmip
#should check that all the tables are available for export
#may have some issues with the file downloads as I'm not sure how
#we handle these with ie and watir
#---
class Test_07_export_data < Test::Unit::TestCase
  #
  #Test we can logon to the system using the webmip administrator user’s login credentials
  #
  def test_01_data_export_screen_appears
    @@ie.goto(EXPORT_DATA)
    login(DEFAULT, DEFAULT_PWD)
    assert(@@ie.contains_text('Data Export'),'The data export screen did not appear')
    assert(@@ie.select_list(:id, 'P5_TABLES').exists?,'The tables field was not available')
    assert(@@ie.select_list(:id, 'P5_COLUMN_NAMES').exists?,'The column headings field was not available')
    assert(@@ie.button(:id, 'Export Data').exists?,'The export data button was not available')        
  end
  #
  #Check that all the appropriate tables are listed for export
  #
  def test_02_correct_list_of_tables_displayed
    listoftablestoexport= ["ADDITIONAL_ITEMS",
 "ADDRESSES",
 "APEX_AUTHORIZATION",
 "ASSET_LOCATION_TYPES",
 "BASES",
 "BYPASS_REASONS",
 "CARE_CATEGORIES",
 "CAVEAT_TEXTS",
 "CONNECTION_ORIENTATIONS",
 "CONNECTION_TYPES",
 "CONSTRAINT_MESSAGES",
 "CONTACT_MECHANISMS",
 "CONTACT_MECHANISM_TYPES",
 "COSTS",
 "DATA_ITEM_ROLES",
 "DOCUMENTS",
 "DOCUMENT_EVENTS",
 "DOCUMENT_ROLES",
 "DOCUMENT_STATUS_TYPES",
 "DRAWINGS",
 "ENQUIRIES",
 "ENQUIRY_EVENTS",
 "ENQUIRY_ROLES",
 "ENQUIRY_STATUS_TYPES",
 "ENQUIRY_TYPES",
 "ERR$_BASES",
 "ERR$_CAVEAT_TEXTS",
 "ERR$_COSTS",
 "ERR$_HOUSINGS",
 "ERR$_LEAD_TIMES",
 "ERR$_METERS",
 "ERR$_MODULES",
 "ERR$_PARTIES",
 "ERR$_POSTCODES",
 "ERROR_LOGS",
 "EXCEPTION_MESSAGES",
 "EXT_BASES",
 "EXT_CAVEATS",
 "EXT_DATAITEM_ROLES",
 "EXT_HOUSINGS",
 "EXT_LABOUR_COSTS",
 "EXT_LEADTIMES",
 "EXT_MATERIAL_COSTS",
 "EXT_METERS",
 "EXT_MODULES",
 "EXT_POSTCODES",
 "FILTERS",
 "FILTER_TYPES",
 "GTT_DIR_LIST",
 "HOUSINGS",
 "HOUSING_TYPES",
 "LEAD_TIMES",
 "METERS",
 "METER_SIZE_CODES",
 "METER_TYPES",
 "MODULES",
 "PARTIES",
 "PARTY_ADDRESSES",
 "PARTY_ADDRESS_ROLES",
 "PARTY_CONTACT_MECHANISMS",
 "PARTY_CONTACT_MECHANISM_ROLES",
 "PARTY_RELATIONSHIPS",
 "PARTY_RELATIONSHIP_TYPES",
 "PARTY_ROLES",
 "PASSWORDS",
 "POSTCODES",
 "QUOTES",
 "QUOTE_EVENTS",
 "QUOTE_ITEMS",
 "QUOTE_REASONING",
 "QUOTE_ROLES",
 "QUOTE_STATUSES",
 "REGIONS",
 "REGI_ENQU_EXCLUSIONS",
 "REGULATORS",
 "REGULATOR_TYPES",
 "RELIEF_VALVES",
 "RELIEF_VALVE_TYPES",
 "ROLE_TYPES",
 "SERVICE_PRESSURES",
 "SERVICE_PRESSURE_TYPES",
 "SLAMSHUT_TYPES",
 "SLAMSHUT_VALVES",
 "SYSTEM_CONFIGURATION",
 "VALIDATION_RESULTS"]
    assert_equal(listoftablestoexport,@@ie.select_list(:id, 'P5_TABLES').getAllContents ,'The expected table list for export was not found')
  end

 
end  