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

@@ -19,15 +19,16 @@ DAD= 'pls/apex'
#DAD= 'pls/eftnomkingdonj' #DAD= 'pls/eftnomkingdonj'
#PROTOCOL = 'https://' #PROTOCOL = 'https://'
PROTOCOL = 'http://' PROTOCOL = 'http://'
APPLICATIONID = '102'
# #
# Default Screen urls # Default Screen urls
# #
START_URL = PROTOCOL+MACHINE+'/'+DAD+'/f?p=102:1::::::' START_URL = PROTOCOL+MACHINE+'/'+DAD+'/f?p='+APPLICATIONID+':1::::::'
LOGIN = PROTOCOL+MACHINE+'/'+DAD+'/f?p=102:101' LOGIN = PROTOCOL+MACHINE+'/'+DAD+'/f?p='+APPLICATIONID+':101'
EXPORT_DATA = PROTOCOL+MACHINE+'/'+DAD+'/f?p=102:5' EXPORT_DATA = PROTOCOL+MACHINE+'/'+DAD+'/f?p='+APPLICATIONID+':5'
ENQUIRY = PROTOCOL+MACHINE+'/'+DAD+'/f?p=102:32' ENQUIRY = PROTOCOL+MACHINE+'/'+DAD+'/f?p='+APPLICATIONID+':32'
BASE = PROTOCOL+MACHINE+'/'+DAD+'/f?p=102:50' BASE = PROTOCOL+MACHINE+'/'+DAD+'/f?p='+APPLICATIONID+':50'
# #
# Users required for the script # Users required for the script

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 #all the columns required for the report appears with the button to create a new drawings record
# #
def test_01_drawing_screen_appears def test_01_drawing_screen_appears
@@ie.goto(DRAWING) @@ie.goto(LOGIN)
#we'll need to login #now we'll need to login
login(DK, DK_PWD) login(DEFAULT, DEFAULT_PWD)
menu('Administration')
menu('Drawings')
assert(@@ie.contains_text('Drawings'),'The drawing screen 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('Code'),'The drawing code column did not appear')
assert(@@ie.contains_text('Description'),'The drawing description column did not appear') assert(@@ie.contains_text('Description'),'The drawing description column did not appear')
@@ -24,8 +26,8 @@ class Test_02_drawings_screen < Test::Unit::TestCase
@@ie.button(:id, 'create').click @@ie.button(:id, 'create').click
@@ie.wait @@ie.wait
assert(@@ie.contains_text('Create/Edit Drawings'),'The create/edit drawing screen did not appear') 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, 'P53_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_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, '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 end
@@ -34,8 +36,8 @@ class Test_02_drawings_screen < Test::Unit::TestCase
#Check that the new drawing record appears in the report #Check that the new drawing record appears in the report
# #
def test_03_create_drawing def test_03_create_drawing
@@ie.text_field(:id, 'P13_CODE').set("D1") @@ie.text_field(:id, 'P53_CODE').set("D1")
@@ie.text_field(:id, 'P13_DESCRIPTION').set("Drawing for housing") @@ie.text_field(:id, 'P53_DESCRIPTION').set("Drawing for housing")
@@ie.button(:id, 'create').click @@ie.button(:id, 'create').click
@@ie.wait @@ie.wait
assert(@@ie.contains_text('Drawings'),'The drawing screen did not appear') 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.button(:id, 'create').click
@@ie.wait @@ie.wait
assert(@@ie.contains_text('Create/Edit Drawings'),'The create/edit drawing screen did not appear') 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, 'P53_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_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, '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')
@@ie.text_field(:id, 'P13_CODE').set("D2") @@ie.text_field(:id, 'P53_CODE').set("D2")
@@ie.text_field(:id, 'P13_DESCRIPTION').set("Drawing for module") @@ie.text_field(:id, 'P53_DESCRIPTION').set("Drawing for module")
@@ie.button(:id, 'create').click @@ie.button(:id, 'create').click
@@ie.wait @@ie.wait
assert(@@ie.contains_text('Drawings'),'The drawing screen did not appear') 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') assert(@@ie.contains_text('Drawing for module'),'The description for D2, Drawing for module did not appear')
end end
# #
@@ -62,12 +64,29 @@ class Test_02_drawings_screen < Test::Unit::TestCase
# #
def test_04_update_drawing def test_04_update_drawing
@@ie.link(:text, 'D1').click @@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, 'P53_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.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, 'cancel').exists?,'The cancel button was not available')
assert(@@ie.button(:id, 'delete').exists?,'The delete 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, 'apply_changes').exists?,'The Apply Changes button was not available')
@@ie.text_field(:id, 'P13_DESCRIPTION').set('Drawing for base') 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.button(:id, 'apply_changes').click
@@ie.wait @@ie.wait
assert(@@ie.contains_text('Drawings'),'The drawing screen did not appear') assert(@@ie.contains_text('Drawings'),'The drawing screen did not appear')
@@ -79,8 +98,8 @@ class Test_02_drawings_screen < Test::Unit::TestCase
# #
def test_05_delete_drawing def test_05_delete_drawing
@@ie.link(:text, 'D2').click @@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, 'P53_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_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, 'cancel').exists?,'The cancel button was not available')
assert(@@ie.button(:id, 'delete').exists?,'The delete 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, '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') assert(@@ie.button(:id, 'create').exists?,'The create button was not available')
@@ie.button(:id, 'create').click @@ie.button(:id, 'create').click
assert(@@ie.contains_text('Create/Edit Drawings'),'The create/edit drawing screen did not appear') 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, 'P53_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_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, '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')
@@ie.text_field(:id, 'P13_CODE').set("D1") @@ie.text_field(:id, 'P53_CODE').set("D1")
@@ie.text_field(:id, 'P13_DESCRIPTION').set("HOUSING") @@ie.text_field(:id, 'P53_DESCRIPTION').set("HOUSING")
@@ie.button(:id, 'create').click @@ie.button(:id, 'create').click
@@ie.wait @@ie.wait
assert_nil(@@ie.contains_text('Drawings'),'The drawing screen did not appear') assert_nil(@@ie.contains_text('Drawings'),'The drawing screen did not appear')
@@ -140,11 +159,3 @@ class Test_02_drawings_screen < Test::Unit::TestCase
end end
# #
end end

View File

@@ -10,8 +10,7 @@ class Test_01_export_data < Test::Unit::TestCase
# #
def test_01_data_export_screen_appears def test_01_data_export_screen_appears
@@ie.goto(EXPORT_DATA) @@ie.goto(EXPORT_DATA)
#we'll need to login login(DEFAULT, DEFAULT_PWD)
login(JAMIE, JAMIE_PWD)
assert(@@ie.contains_text('Data Export'),'The data export screen did not appear') 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_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.select_list(:id, 'P5_COLUMN_NAMES').exists?,'The column headings field was not available')

View File

@@ -36,7 +36,9 @@ include Watir
# #
#Get our individual integration tests #Get our individual integration tests
# #
require 'exportdatatests' #require 'exportdatatests'
#require 'enquirytests'
#require 'basestests'
require 'drawingtests.rb'
#@@ie.wait #@@ie.wait
#@@ie.close #@@ie.close