diff --git a/tests/constants.rb b/tests/constants.rb index c30aff1..b9cfc43 100644 --- a/tests/constants.rb +++ b/tests/constants.rb @@ -19,15 +19,16 @@ DAD= 'pls/apex' #DAD= 'pls/eftnomkingdonj' #PROTOCOL = 'https://' PROTOCOL = 'http://' +APPLICATIONID = '102' # # Default Screen urls # -START_URL = PROTOCOL+MACHINE+'/'+DAD+'/f?p=102:1::::::' -LOGIN = PROTOCOL+MACHINE+'/'+DAD+'/f?p=102:101' -EXPORT_DATA = PROTOCOL+MACHINE+'/'+DAD+'/f?p=102:5' -ENQUIRY = PROTOCOL+MACHINE+'/'+DAD+'/f?p=102:32' -BASE = PROTOCOL+MACHINE+'/'+DAD+'/f?p=102:50' +START_URL = PROTOCOL+MACHINE+'/'+DAD+'/f?p='+APPLICATIONID+':1::::::' +LOGIN = PROTOCOL+MACHINE+'/'+DAD+'/f?p='+APPLICATIONID+':101' +EXPORT_DATA = PROTOCOL+MACHINE+'/'+DAD+'/f?p='+APPLICATIONID+':5' +ENQUIRY = PROTOCOL+MACHINE+'/'+DAD+'/f?p='+APPLICATIONID+':32' +BASE = PROTOCOL+MACHINE+'/'+DAD+'/f?p='+APPLICATIONID+':50' # # Users required for the script diff --git a/tests/drawingtests.rb b/tests/drawingtests.rb index db4ebd5..c922275 100644 --- a/tests/drawingtests.rb +++ b/tests/drawingtests.rb @@ -7,9 +7,11 @@ class Test_02_drawings_screen < Test::Unit::TestCase #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) + @@ie.goto(LOGIN) + #now we'll need to login + login(DEFAULT, DEFAULT_PWD) + menu('Administration') + menu('Drawings') 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') @@ -24,18 +26,18 @@ class Test_02_drawings_screen < Test::Unit::TestCase @@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.text_field(:id, 'P53_CODE').exists?,'The drawings code field is not available') + assert(@@ie.text_field(:id, 'P53_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') + 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.text_field(:id, 'P53_CODE').set("D1") + @@ie.text_field(:id, 'P53_DESCRIPTION').set("Drawing for housing") @@ie.button(:id, 'create').click @@ie.wait assert(@@ie.contains_text('Drawings'),'The drawing screen did not appear') @@ -44,16 +46,16 @@ class Test_02_drawings_screen < Test::Unit::TestCase @@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.text_field(:id, 'P53_CODE').exists?,'The drawings code field is not available') + assert(@@ie.text_field(:id, 'P53_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.text_field(:id, 'P53_CODE').set("D2") + @@ie.text_field(:id, 'P53_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('D2'),'The new record with drawing code D2 did not appear') assert(@@ie.contains_text('Drawing for module'),'The description for D2, Drawing for module did not appear') end # @@ -61,26 +63,43 @@ class Test_02_drawings_screen < Test::Unit::TestCase #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') + @@ie.link(:text, 'D1').click + assert(@@ie.text_field(:id, 'P53_CODE').verify_contains('D1'),'The drawing code field did not contain value D1') + assert(@@ie.text_field(:id, 'P53_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') + assert(@@ie.button(:id, 'upload').exists?,'The file upload/replace button was not available') + @@ie.button(:id, 'upload').click + @@ie.wait + assert(@@ie.contains_text('Upload File'),'The file upload screen did not appear') + assert(@@ie.button(:id, 'P41_FILE_UPLOAD').exists?,'The file upload field was not available') + # + #Upload a file to the drawing and check that we get a success message + # + filetoupload = 'c:\ruby\LICENSE.txt' + @@ie.text_field(:id, 'P41_FILE_UPLOAD').set(filetoupload) + @@ie.button(:id, 'upload').click + @@ie.wait + assert(@@ie.button(:id, 'upload').exists?,'The file upload/replace button was not available') + 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 uploaded'),'The success message Drawing uploaded did not appear') + #set description and save + @@ie.text_field(:id, 'P53_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.text_field(:id, 'P53_CODE').verify_contains('D2'),'The drawing code is not D2') + assert(@@ie.text_field(:id, 'P53_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') @@ -125,12 +144,12 @@ class Test_02_drawings_screen < Test::Unit::TestCase 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.text_field(:id, 'P53_CODE').exists?,'The drawings code field is not available') + assert(@@ie.text_field(:id, 'P53_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.text_field(:id, 'P53_CODE').set("D1") + @@ie.text_field(:id, 'P53_DESCRIPTION').set("HOUSING") @@ie.button(:id, 'create').click @@ie.wait assert_nil(@@ie.contains_text('Drawings'),'The drawing screen did not appear') @@ -139,12 +158,4 @@ class Test_02_drawings_screen < Test::Unit::TestCase assertl(@@ie.contains_text('Error'),'An error was not generated') end # -end - - - - - - - - +end \ No newline at end of file diff --git a/tests/exportdatatests.rb b/tests/exportdatatests.rb index e89de18..32e43bd 100644 --- a/tests/exportdatatests.rb +++ b/tests/exportdatatests.rb @@ -10,8 +10,7 @@ class Test_01_export_data < Test::Unit::TestCase # def test_01_data_export_screen_appears @@ie.goto(EXPORT_DATA) - #we'll need to login - login(JAMIE, JAMIE_PWD) + 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') diff --git a/tests/start.rb b/tests/start.rb index 1903c56..8b8a356 100644 --- a/tests/start.rb +++ b/tests/start.rb @@ -36,7 +36,9 @@ include Watir # #Get our individual integration tests # -require 'exportdatatests' - +#require 'exportdatatests' +#require 'enquirytests' +#require 'basestests' +require 'drawingtests.rb' #@@ie.wait #@@ie.close \ No newline at end of file