From 45bd2ad4b7804c331a5fc27d55cfc575f7ed471a Mon Sep 17 00:00:00 2001 From: PriestJ Date: Mon, 21 Jan 2008 16:00:24 +0000 Subject: [PATCH] fixed bugs in tests, now tests that a file can be uploaded to the drawing git-svn-id: http://locode01.ad.dom/svn/WEBMIP/trunk@3316 248e525c-4dfb-0310-94bc-949c084e9493 --- tests/drawingtests.rb | 80 +++++++++++++++++++++++-------------------- 1 file changed, 43 insertions(+), 37 deletions(-) diff --git a/tests/drawingtests.rb b/tests/drawingtests.rb index c922275..17050e2 100644 --- a/tests/drawingtests.rb +++ b/tests/drawingtests.rb @@ -12,9 +12,10 @@ class Test_02_drawings_screen < Test::Unit::TestCase 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') + #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.contains_text('no data found'),'Some data must have appeared, expected to find no records') assert(@@ie.button(:id, 'create').exists?,'The create button was not available') end # @@ -77,14 +78,14 @@ class Test_02_drawings_screen < Test::Unit::TestCase # #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) + filetoupload = 'c:\\ruby\\LICENSE.txt' + @@ie.file_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') + assert(@@ie.contains_text('Create/Edit Drawings'),'The edit/create drawing screen 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 @@ -93,36 +94,43 @@ class Test_02_drawings_screen < Test::Unit::TestCase 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 + #The following is commented out because the javascript dialog box cannot be clicked on some machines + #and on those that it does work it will only work if run from the dos prompt, there for the integrated + #test will not be able to complete the test automatically # #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, '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') - @@ie.button(:id, 'delete').click - @@ie.wait - assert_nil(@@ie.contains_text('D2'),'The drawing code D2 did appear') - end +# def test_05_delete_drawing +# @@ie.link(:text, 'D2').click +# 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') +# @@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 + #Check that the existing 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 + def test_06_update_drawing_code + @@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 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, 'P53_CODE').set("D2") + @@ie.button(:id, 'apply_changes').click + @@ie.wait + assert(@@ie.contains_text('ORA-20001'),'We did not get that nasty ORA-20001 error we were expecting') + assert(@@ie.contains_text('DRAWINGS'),'Did not reference the DRAWINGS table in the error message') + @@ie.link(:text, 'OK').click + @@ie.wait + @@ie.button(:id, 'cancel').click + @@ie.wait + end # #Check that a drawing record with child records cannot be deleted #~ @@ -152,10 +160,8 @@ class Test_02_drawings_screen < Test::Unit::TestCase @@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') - 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') + assert(@@ie.contains_text('Error'),'An error was not generated') + assert(@@ie.contains_text('ORA-00001: unique constraint (MIP_TEST.DRWG_PK) violated'),'Expected a nasty oracle error message(ORA-00001) but did not get it') end # end \ No newline at end of file