added some tests (that don't yet work) to drawingstests, sorted a few things out and merged the constants file

git-svn-id: http://locode01.ad.dom/svn/WEBMIP/trunk@3309 248e525c-4dfb-0310-94bc-949c084e9493
This commit is contained in:
PriestJ
2008-01-18 17:44:24 +00:00
parent 6eaba775e4
commit 999b0c5728
4 changed files with 62 additions and 49 deletions

View File

@@ -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