git-svn-id: http://locode01.ad.dom/svn/WEBMIP/trunk@50874 248e525c-4dfb-0310-94bc-949c084e9493

This commit is contained in:
andrew.gilmore
2012-03-19 11:57:19 +00:00
parent 2a0f4900c3
commit 0e9ca75d77
1587 changed files with 500863 additions and 0 deletions

View File

@@ -0,0 +1,180 @@
create or replace procedure cleanup_testdata IS
--
-- Removes all test data, do not run unles certain you are connected to the right database.
-- Note this will not COMMIT automatically.
--
BEGIN
--
DELETE message_recipient;
--
DELETE bulletin_board_messages;
--
DELETE contract_rules
WHERE cont_id IN (SELECT cont_id
FROM contracts
WHERE contract_number IN ('PUW_EDEN1','PUW_EDEN2',
'OMT_EDEN1','OMT_EDEN2'));
--
DELETE contract_template_rules
WHERE cote_id IN (SELECT cote_id
FROM contract_templates
WHERE NAME = 'EDEN GRC_contracts');
--
DELETE rules
WHERE rule_name IN ('E_rl_R_m3max','E_rl_R_m3min','E_rl_Dmu_m3max','E_rl_Dmu_m3min',
'E_rl_Qmu_m3max','E_rl_Qmu_m3min','E_rl_Ymu_m3max','E_rl_Ymu_m3min');
--
DELETE contract_template_params
WHERE pars_id IN (SELECT pars_id
FROM PARAMETERS
WHERE cate_id IN (SELECT cate_id
FROM categories
WHERE code IN ('EDEN_Request_m3day','EDEN_D_makeup_m3day',
'EDEN_Q_makeup_m3day','EDEN_Y_makeup_m3day'))
);
--
DELETE cont_net_point_param_vals
WHERE conp_id IN (SELECT conp_id
FROM cont_network_points
WHERE nepo_id IN (SELECT nepo_id
FROM network_points
WHERE NAME IN ('EDEN HAG','EDEN TSTV')));
--
DELETE contract_parameters
WHERE cont_id IN (SELECT cont_id
FROM contracts
WHERE contract_number IN ('PUW_EDEN1','PUW_EDEN2','OMT_EDEN1','OMT_EDEN2'));
--
DELETE nom_net_point_cat_vals
WHERE conp_id IN (SELECT conp_id
FROM cont_network_points
WHERE nepo_id IN (SELECT nepo_id
FROM network_points
WHERE NAME IN ('EDEN HAG','EDEN TSTV')));
--
DELETE cont_network_points
WHERE conp_id IN (SELECT conp_id
FROM cont_network_points
WHERE nepo_id IN (SELECT nepo_id
FROM network_points
WHERE NAME IN ('EDEN HAG','EDEN TSTV')));
--
DELETE network_points
WHERE NAME IN ('EDEN HAG','EDEN TSTV');
--
DELETE contract_categories
WHERE cont_id IN (SELECT cont_id
FROM contracts
WHERE contract_number IN ('PUW_EDEN1','PUW_EDEN2',
'OMT_EDEN1','OMT_EDEN2'));
--
DELETE contract_template_categories
WHERE cote_id IN (SELECT cote_id
FROM contract_templates
WHERE NAME = 'EDEN GRC_contracts');
--
DELETE conf_net_point_cat_vals
WHERE nomi_id IN (SELECT nomi_id
FROM nominations
WHERE cont_id IN (SELECT cont_id
FROM contracts
WHERE contract_number IN ('PUW_EDEN1','PUW_EDEN2',
'OMT_EDEN1','OMT_EDEN2')));
--
DELETE confirmations
WHERE nomi_id IN (SELECT nomi_id
FROM nominations
WHERE cont_id IN (SELECT cont_id
FROM contracts
WHERE contract_number IN ('PUW_EDEN1','PUW_EDEN2',
'OMT_EDEN1','OMT_EDEN2')));
--
DELETE nominations
WHERE nomi_id IN (SELECT nomi_id
FROM nominations
WHERE cont_id IN (SELECT cont_id
FROM contracts
WHERE contract_number IN ('PUW_EDEN1','PUW_EDEN2',
'OMT_EDEN1','OMT_EDEN2')));
--
DELETE contracts
WHERE cont_id IN (SELECT cont_id
FROM contracts
WHERE contract_number IN ('PUW_EDEN1','PUW_EDEN2',
'OMT_EDEN1','OMT_EDEN2'));
--
DELETE contract_templates
WHERE NAME = 'EDEN GRC_contracts';
--
DELETE PARAMETERS
WHERE cate_id IN (SELECT cate_id
FROM categories
WHERE code IN ('EDEN_Request_m3day','EDEN_D_makeup_m3day',
'EDEN_Q_makeup_m3day','EDEN_Y_makeup_m3day')
);
--
DELETE categories
WHERE cate_id IN (SELECT cate_id
FROM categories
WHERE code IN ('EDEN_Request_m3day','EDEN_D_makeup_m3day',
'EDEN_Q_makeup_m3day','EDEN_Y_makeup_m3day'));
--
--DELETE nom_window_customers;
--
--DELETE nomination_windows;
--
--DELETE document_timestamps;
--
/*DELETE user_profiles
WHERE syus_id NOT IN (48,97,106,107);
--
DELETE subscription_contacts
WHERE uscd_id NOT IN (SELECT uscd_id
FROM user_contact_details
WHERE syus_id IN (48,97,106,107));
--
DELETE user_contact_details
WHERE syus_id NOT IN (48,97,106,107);
--
DELETE user_homepage
WHERE syus_id NOT IN (48,97,106,107);
--
DELETE user_options
WHERE syus_id NOT IN (48,97,106,107);
--
DELETE intermediary_users
WHERE syus_id NOT IN (48,97,106,107)
AND inte_id NOT IN (SELECT inte_id
FROM customer_intermediaries
WHERE cust_id IN (9,700,701));
--
DELETE system_users
WHERE syus_id NOT IN (48,97,106,107)
AND inte_id NOT IN (SELECT inte_id
FROM customer_intermediaries
WHERE cust_id IN (9,700,701));
--
DELETE intermediaries
WHERE inte_id NOT IN (SELECT inte_id
FROM customer_intermediaries
WHERE cust_id IN (9,700,701));
--
DELETE customer_intermediaries
WHERE cust_id NOT IN (9,700,701)
AND cust_id NOT IN (SELECT cust_id
FROM system_users
WHERE syus_id IN (48,97,106,107));
--
DELETE customers
WHERE cust_id NOT IN (9,700,701)
AND cust_id NOT IN (SELECT cust_id
FROM system_users
WHERE syus_id IN (48,97,106,107));
--*/
DELETE debug_options;
--
DELETE DEBUG;
--
end cleanup_testdata;
/

View File

@@ -0,0 +1,67 @@
#
#This file contains all the constants required for all tests
#require this file if you are writing a standalone test.
#
#Database Constants
#DBUSERNAME='eft_nom_kingdonj'
#DBPASSWORD='eft_nom_kingdonj'
DBUSERNAME='eft_nom_priestj'
DBPASSWORD='eft_nom_priestj'
DATABASE='dev10g'
# Screen Constants
#MACHINE='wxp0113'
#MACHINE = 'loordv01'
MACHINE = '195.228.69.35'
#DAD='eftnomfat'
#DAD= 'pls/eftnompriestj'
DAD= 'eftnom'
#DAD= 'pls/eftnomkingdonj'
PROTOCOL = 'https://'
#PROTOCOL = 'http://'
ENTER_NOMS = PROTOCOL+MACHINE+'/'+DAD+'/efnow098$.startup'
VIEW_NOMS = PROTOCOL+MACHINE+'/'+DAD+'/efnow101$.startup'
CREATE_CONF = PROTOCOL+MACHINE+'/'+DAD+'/efnow095$.startup'
APPROVE_CONF= PROTOCOL+MACHINE+'/'+DAD+'/efnow095$.approve_confirmations'
VIEW_CONF= PROTOCOL+MACHINE+'/'+DAD+'/efnow120$.startup'
LOGOUT= PROTOCOL+MACHINE+'/'+DAD+'/caco_security.logout'
LOGIN= PROTOCOL+MACHINE+'/'+DAD+'/home?p_login_requested=Y'
RENOM_WDW= PROTOCOL+MACHINE+'/'+DAD+'/efnow131$.startup'
CREATE_NETW_POINTS=PROTOCOL+MACHINE+'/'+DAD+'/efnow030$.startup'
CREATE_CATEGORY=PROTOCOL+MACHINE+'/'+DAD+'/efnow010$.startup'
VIEW_PARAMETERS=PROTOCOL+MACHINE+'/'+DAD+'/efnow020$.startup'
CREATE_TEMPLATE=PROTOCOL+MACHINE+'/'+DAD+'/efnow060$.startup'
CREATE_CONTRACT=PROTOCOL+MACHINE+'/'+DAD+'/efnow050$.startup'
MAINTAIN_CONTRACTS = PROTOCOL+MACHINE+'/'+DAD+'/efnow050$.startup'
MAINTAIN_CUSTOMER = PROTOCOL+MACHINE+'/'+DAD+'/efnow110$.startup'
MAINTAIN_USER = PROTOCOL+MACHINE+'/'+DAD+'/efnow100$.startup'
CHANGE_CUSTOMER = PROTOCOL+MACHINE+'/'+DAD+'/caco_security.change_cust_inte'
CREATE_CONFIRMATION = PROTOCOL+MACHINE+'/'+DAD+'/efnow095$.startup'
VIEW_CONFIRMATION = PROTOCOL+MACHINE+'/'+DAD+'/efnow120$.startup'
#
# Users required for the script, these should be created and assigned to the appropriate Intemediary for their customer type
#
OMT_ADMIN='omtadmin'
OMT_ADMIN_PWD='omtadmin01'
PUW_ADMIN='puwadmin'
PUW_ADMIN_PWD='puwadmin01'
PUW_CUST1='PUW_EDEN1'
PUW_CUST1_PWD='PUW_EDEN1'
OMT_CUST1='OMT_EDEN1'
OMT_CUST1_PWD='OMT_EDEN1'
PUW_CUST2='PUW_EDEN2'
PUW_CUST2_PWD='PUW_EDEN2'
OMT_CUST2='OMT_EDEN2'
OMT_CUST2_PWD='OMT_EDEN2'
#
# System customers used by the script, these should be created and assigned to the appropriate Intemediary for their customer type
#
PUW_SGL_CUST='PUW_EDEN1'
PUW_MLT_CUST='PUW_EDEN2'
OMT_SGL_CUST='OMT_EDEN1'
OMT_MLT_CUST='OMT_EDEN2'
#
# Network points
#
NETW_POINT_HAG='EDEN HAG'
NETW_POINT_TSTV='EDEN TSTV'

View File

@@ -0,0 +1,351 @@
# Oracle stuff
#
require 'oci8'
#used to handle javascript popups
require 'watir/contrib/enabled_popup'
require 'watir/WindowHelper'
#
# Method to handle javascript popups.
#
require 'thread'
#
require 'win32ole'
#
def startClicker( button , waitTime = 3)
w = WinClicker.new
longName = @@ie.dir.gsub("/" , "\\" )
shortName = w.getShortFileName(longName)
c = "start ruby #{shortName}\\watir\\clickJSDialog.rb #{button} #{waitTime} "
puts "Starting #{c}"
w.winsystem(c)
w=nil
end
#
#
# DOSQL
#
def dosql(p_sql)
conn = OCI8.new(DBUSERNAME,DBPASSWORD,DATABASE)
#conn.exec('begin DELETE_TEST_DATA; end;')
puts p_sql
conn.exec(p_sql)
#conn.exec('commit;')
end
#
#LOGIN
#
def login(p_username, p_password,p_logoff_first='n')
if p_logoff_first == 'y'
@@ie.goto(LOGOUT)
@@ie.wait
end
# Logon page
@@ie.goto(LOGIN)
@@ie.wait
#
# Enter logon details
#
@@ie.text_field( :name, 'p_username' ).set( p_username )
@@ie.text_field( :name, 'p_password' ).set( p_password )
#
@@ie.button(:value, "Log on").click
@@ie.wait
#
# TRUE if doesn't find
#
assert_nil(@@ie.contains_text('Invalid Logon'),'Unable to login')
end
#
# SETCONTRACTVALUE
#
def set_contract_value(p_index_start,p_values)
#
i = p_index_start
@@ie.text_field( :index, i).set(p_values[0] )
@@ie.text_field(:index, i+1).set(p_values[1])
@@ie.text_field(:index, i+2).set(p_values[2])
@@ie.text_field(:index, i+3).set(p_values[3])
@@ie.text_field(:index, i+4).set(p_values[4])
@@ie.text_field(:index, i+5).set(p_values[5])
@@ie.text_field(:index, i+6).set(p_values[6])
@@ie.text_field(:index, i+7).set(p_values[7])
@@ie.text_field(:index, i+8).set(p_values[8])
@@ie.text_field(:index, i+9).set(p_values[9])
@@ie.text_field(:index, i+10).set(p_values[10])
@@ie.text_field(:index, i+11).set(p_values[11])
#@@ie.text_field(:index, i+12).set(p_values[12])
#
end
#
# SETCONTRACT
#
def set_contract(p_name,p_customer,p_template,p_format,p_verify_data_entry,p_date_from=futuredate(0),p_date_to=futuredate(100),p_expect_success='y')
@@ie.button(:value, 'Find').click
@@ie.wait
@@ie.button(:value, 'New Contract').click
@@ie.wait
#
@@ie.text_field(:name,'p_contract_number').set(p_name)
@@ie.select_list(:name, 'p_customer_id').select(p_customer)
#
#
#get javascript popup, start thread before as popup locks ruby so can't click the button!
#
startClicker("OK" , 1)
#sleep 1
@@ie.select_list(:name,'p_template_id').select(p_template)
#
# Will need to click the cutton manually if can't find a way to interact with the Javascript box
#
@@ie.select_list(:name,'p_spte_id').select(p_format)
@@ie.text_field(:name,'p_date_from').set(p_date_from)
@@ie.text_field(:name,'p_date_to').set(p_date_to)
@@ie.text_field(:name,'p_ops_contact').set('John')
@@ie.text_field(:name,'p_bus_contact').set('Paul')
@@ie.text_field(:name,'p_val_window').set('0')
@@ie.text_field(:name,'p_days_before').set('14')
@@ie.select_list(:name,'p_val_action').select('Look Back')
@@ie.select_list(:name,'p_status').select('Open')
@@ie.select_list(:name,'p_val_exception').select('Contracted Amount')
#
@@ie.select_list(:name,'add_nepo_id').select('EDEN HAG')
@@ie.select_list(:name,'add_nepo_id').select('EDEN TSTV')
@@ie.button(:value,'Add Network Points').click
@@ie.wait
@@ie.button('Insert').click
#
if p_expect_success=='y'
assert(@@ie.contains_text('Success!'),'Create Contract '+p_name+' did not succeed: ' +geterrormess(@@ie))
else
assert(@@ie.contains_text('Insert failed'),'Create Contract '+p_name+' succeeded, should have given us an overlap error')
assert(@@ie.contains_text('Open contracts exist for this date period'),'Expected error message: [Open contracts exist for this date period] but did not find it')
#if we are testing it to fail there is no need to continue through rest of the test below
return
end
#
# Create the contract rule values
#
@@ie.button('Set Values').click
#
#
if p_verify_data_entry == 'Y'
#
# Format of the numbers must be 99999.99
#
set_contract_value(3,['17,123.30','35,616.46','34,246.60','0.00','17123.3','0.00','0.00','17123.3','0.00','0.00','17123.3','0.00'])
set_contract_value(15,['68493.20','142,465.86','136,986.40','0.00','68,493.20','0.00','0.00','68,493.20','0.00','0.00','68,493.20','0.00'])
@@ie.button('Update').click
@@ie.wait
#
assert(@@ie.contains_text('Data supplied with invalid number formats'),'Create Contract Values did not fail as expected'+geterrormess(@@ie))
#
# Contracted value is > maximum
#
set_contract_value(3,['17123.30','34246.60','35616.46','0.00','17123.3','0.00','0.00','17123.3','0.00','0.00','17123.3','0.00'])
set_contract_value(15,['68493.20','136986.40','142465.86','0.00','68493.20','0.00','0.00','68493.20','0.00','0.00','68493.20','0.00'])
@@ie.button('Update').click
@@ie.wait
#
assert(@@ie.contains_text('Contracted greater than Maximum'),'Create Contract Values did not fail as expected'+geterrormess(@@ie))
#
#
# Contracted value is < minimum
#
set_contract_value(3,['17123.30','35616.46','246.60','0.00','17123.3','0.00','0.00','17123.3','0.00','0.00','17123.3','0.00'])
set_contract_value(15,['68493.20','142465.86','6986.40','0.00','68493.20','0.00','0.00','68493.20','0.00','0.00','68493.20','0.00'])
@@ie.button('Update').click
@@ie.wait
#
assert(@@ie.contains_text('Contracted less than Minimum'),'Create Contract Values did not fail as expected'+geterrormess(@@ie))
#
end
#
set_contract_value(3,['17123.30','35616.46','34246.60','0.00','17123.3','0.00','0.00','17123.3','0.00','0.00','17123.3','0.00'])
set_contract_value(15,['68493.20','142465.86','136986.40','0.00','68493.20','0.00','0.00','68493.20','0.00','0.00','68493.20','0.00'])
@@ie.button('Update').click
@@ie.wait
#
assert(@@ie.contains_text('Success!'),'Create Contract Values for '+p_name+' did not succeed: ' +geterrormess(@@ie))
#
end
#
# SETRULE
#
def set_rule(p_name,p_errmsg,p_LHS,p_RHS,p_operator)
#
@@ie.button(:value, 'New Rule').click
@@ie.wait
#
@@ie.text_field(:name,'p_rule_name').set(p_name)
@@ie.text_field(:name,'p_err_message_hu').set(p_errmsg)
@@ie.text_field(:name,'p_err_message_en').set(p_errmsg)
#
@@ie.text_field(:name,'p_left_side').set('$<'+p_LHS+'>')
@@ie.text_field(:name,'p_right_side').set('$<'+p_RHS+'>')
#
@@ie.select_list(:name, 'p_rule_relation').select(p_operator)
#
@@ie.button( :value, 'Insert' ).click
@@ie.wait
#
assert(@@ie.contains_text('Success!'),'Create Rule '+p_name+' did not succeed: ' +geterrormess(@@ie))
#
@@ie.button( :value, 'Cancel' ).click
@@ie.wait
#
end
#
# SETCATEGORIES
#
def set_categories(p_name,p_display_seq)
#
@@ie.button(:value,'New').click
@@ie.wait
#
@@ie.text_field(:name,'P_CODE').set(p_name)
@@ie.text_field(:name,'P_NAME').set(p_name)
@@ie.text_field(:name,'P_UNITS').set('m3/day')
@@ie.text_field(:name,'P_NUMBER_FORMAT').set('999999.99')
@@ie.text_field(:name,'P_DISPLAY_SEQUENCE').set(p_display_seq)
#
@@ie.button( :value, 'Insert' ).click
@@ie.wait
#c
end
#
# SETNETWORKPOINT
#
def set_network_point(p_name)
#
@@ie.button(:value,'New').click
@@ie.wait
#
@@ie.text_field( :name, 'P_CODE').set( p_name )
@@ie.text_field( :name, 'P_NAME').set( p_name )
@@ie.select_list( :name , "P_STATUS").select("Active")
@@ie.select_list( :name , "P_SITE_TYPE").select("Entry")
#
@@ie.button( :value, 'Insert' ).click
@@ie.wait
#
end ;
#
# SETNOMINATION
#
#This method simply takes the date/time of the nomination , the nominated value and
#number of subsequent days and submits it into the current web form. It assumes you have
#already loaded the web form in the @@ie class object variable
#Method designed for use iwth the EDEN1 contract (2 NP plus 4 categories)
#
def setnomination(p_contract, p_quantity)
#
@@ie.select_list( :name , "p_contract").select(p_contract)
@@ie.wait
#
#@@ie.text_field( :name, 'nomid' ).set( 'PUW_EDEN1_'+(Time.now).strftime("%d%m%y%H%M%S") )
#
i = 4
#
# Passing in an array of arrays the loop though, use the index i to deermine the text field for data entry.
#
p_quantity.each do |nomination|
#
@@ie.text_field( :index, i).set( nomination[0] )
@@ie.text_field(:index, i+1).set(nomination[1])
@@ie.text_field(:index, i+2).set(nomination[2])
@@ie.text_field(:index, i+3).set(nomination[3])
@@ie.text_field(:index, i+4).set(nomination[4])
@@ie.text_field(:index, i+5).set(nomination[5])
@@ie.text_field(:index, i+6).set(nomination[6])
@@ie.text_field(:index, i+7).set(nomination[7])
@@ie.text_field(:index, i+8).set(nomination[8])
#
i = i + 8
#
end
#
@@ie.button( :value, 'Insert' ).click
@@ie.wait
#
end
#
# SETMULTINOM
#
#This method simply takes the date/time of the nimination , the nominated value and
#number of subsequent days and submits it into the current web form. It assumes you have
#already loaded the web form in the @@ie class object variable
#Method designed for use iwth the EDEN1 contract (2 NP plus 4 categories)
#
def setmultinom(p_contract, p_quantity)
#
@@ie.select_list( :name , "p_contract").select(p_contract)
@@ie.wait
#
#@@ie.text_field( :name, 'nomid' ).set( 'PUW_EDEN2_'+(Time.now).strftime("%d%m%y%H%M%S") )
#
i = 5
#
# Passing in an array of arrays the loop though, use the index i to deermine the text field for data entry.
#
p_quantity.each do |nomination|
#
@@ie.text_field( :index, i).set( nomination[0] )
@@ie.text_field(:index, i+1).set(nomination[1])
@@ie.text_field(:index, i+2).set(nomination[2])
@@ie.text_field(:index, i+3).set(nomination[3])
@@ie.text_field(:index, i+4).set(nomination[4])
i = i + 5
#
end
#
@@ie.button( :value, 'Insert' ).click
@@ie.wait
#
end
#
# GETERRORMESS
#
#The geterrormess method extracts the error message from
#a designer built screen
def geterrormess (ie)
#get the html for the current page
html = ie.html
#Find the start of the error
i= html.index('Error!')
if i == nil
return ''
end
#get the html code from the error onwards
htmlex = html.slice(i,html.length)
#get the end of the error message
x= htmlex.index('</B>')
#extract just the error message (skip 'Error!</I></font><br>')
return errcode = htmlex.slice(21,x-21)
end
#
# STARTDATE
#
#set up the startdate method (you could call it a function if you're not into Ruby)
#create time (year, month, day, hour, minutes, seconds)
#Hello testers be sure to set the start date for the test here
#Note that I've now set this in the controlling program so it's no longer
#required here
#STARTDATE = Time.gm(2007,'feb',13)
def futuredate (days=0)
#The startdate method takes a number of days + or - and then takes or
#adds them to the startdate specified in the local variable startdate and returns
#the date in the format dd-mmm-yyyy
#add a number of days to the time and return it in the format dd/mm/yyyy eg. 10/02/2007
return ((Time.now)+(86400*days)).strftime("%d/%m/%Y").upcase
end
#
#
#
def purge_EDEN2_noms
dosql('begin DELETE nom_net_point_cat_vals WHERE nomi_id IN (SELECT nomi_id FROM nominations WHERE cont_id = (SELECT cont_id FROM contracts WHERE contract_number = \'EDEN2\')); commit; end;')
dosql('begin DELETE nominations WHERE cont_id = (SELECT cont_id FROM contracts WHERE contract_number = \'EDEN2\'); commit; end;')
end

View File

@@ -0,0 +1,306 @@
#
# FAT005
#
class Test_05_FAT005 < Test::Unit::TestCase
def test_01_check_logon
# Logon as puw eden 1
login(PUW_CUST1, PUW_CUST1_PWD, 'y')
end
#
def test_02_check_cannot_nom_after_cont_wdw
@@ie.goto(ENTER_NOMS)
@@ie.wait
#
# Use the method to create a nomination 600 days in the future, contract has been created to allow 4 days in the future only.
#
setnomination('PUW_EDEN1', [[futuredate(600),'34246.60','0','0','0','136986.4','0','0','0']])
#
# TRUE if does find
#
assert(@@ie.contains_text('20512: Gas day does not fall within the contract dates'),'Nomination did not fail in expected manner: ' +geterrormess(@@ie))
end
#
def test_03_check_can_nom_within_cont_wdw
@@ie.goto(ENTER_NOMS)
@@ie.wait
#
# Use the method to create a nomination 6 days in the future, contract has been created to allow 4 days in the future only.
#
setnomination('PUW_EDEN1', [[futuredate(3),'34246.60','0','0','0','136986.40','0','0','0']])
#
# TRUE if does find
#
assert(@@ie.contains_text('Success!'),'Nomination did not succeed: ' +geterrormess(@@ie))
end
#
def test_04_check_can_multi_nom
# Logon link
login(PUW_CUST2, PUW_CUST2_PWD, 'y')
@@ie.goto(ENTER_NOMS)
@@ie.wait
#
# Use the method to create a nomination 6 days in the future, contract has been created to allow 4 days in the future only.
#
setmultinom('PUW_EDEN2', [[futuredate(1),'34246.60','0','0','0'],
[futuredate(2),'34246.60','0','0','0'],
[futuredate(3),'34246.60','0','0','0'],
[futuredate(4),'34246.60','0','0','0'],
[futuredate(5),'34246.60','0','0','0'],
[futuredate(6),'34246.60','0','0','0'],
[futuredate(7),'34246.60','0','0','0'],
[futuredate(1),'136986.40','0','0','0'],
[futuredate(2),'136986.40','0','0','0'],
[futuredate(3),'136986.40','0','0','0'],
[futuredate(4),'136986.40','0','0','0'],
[futuredate(5),'136986.40','0','0','0'],
[futuredate(6),'136986.40','0','0','0'],
[futuredate(7),'136986.40','0','0','0'],
])
#
# TRUE if does find
#
assert(@@ie.contains_text('Success!'),'Nomination did not succeed: ' +geterrormess(@@ie))
end
#
def test_05_can_view_nominations
#
@@ie.goto(VIEW_NOMS)
@@ie.wait
@@ie.button( :value, 'Query' ).click
@@ie.wait
assert(@@ie.contains_text('Enter query criteria for View Nominations'),'Could not access View nominations Query page ' +geterrormess(@@ie))
@@ie.text_field(:id, 'P_L_CONT_CONTRACT_NUMBER').set('PUW_EDEN2')
@@ie.button( :value, 'Find' ).click
@@ie.wait
#
assert(@@ie.contains_text('PUW_EDEN2'),'Could not find nomination identifier ' +geterrormess(@@ie))
#
assert(@@ie.contains_text(futuredate(1)),'Could not expected Start date ' +geterrormess(@@ie))
#
assert(@@ie.contains_text(futuredate(7)),'Could not expected End date ' +geterrormess(@@ie))
#
assert(@@ie.contains_text('Active'),'Nomination status is not active! ' +geterrormess(@@ie))
end
#
def test_06_check_can_enter_overlapping_multi_nom
@@ie.goto(ENTER_NOMS)
@@ie.wait
#
# Use the method to create a nomination 6 days in the future, contract has been created to allow 4 days in the future only.
#
setmultinom('PUW_EDEN2', [[futuredate(4),'34246.60','0','0','0'],
[futuredate(5),'34246.60','0','0','0'],
[futuredate(6),'34246.60','0','0','0'],
[futuredate(7),'34246.60','0','0','0'],
[futuredate(8),'34246.60','0','0','0'],
[futuredate(9),'34246.60','0','0','0'],
[futuredate(10),'34246.60','0','0','0'],
[futuredate(4),'136986.40','0','0','0'],
[futuredate(5),'136986.40','0','0','0'],
[futuredate(6),'136986.40','0','0','0'],
[futuredate(7),'136986.40','0','0','0'],
[futuredate(8),'136986.40','0','0','0'],
[futuredate(9),'136986.40','0','0','0'],
[futuredate(10),'136986.40','0','0','0'],
])
#
# TRUE if does find
#
assert(@@ie.contains_text('Success!'),'Overlapping nomination did not succeed: ' +geterrormess(@@ie))
end
#
def test_07_can_view_overlapping_nominations
#
@@ie.goto(VIEW_NOMS)
@@ie.wait
@@ie.button( :value, 'Query' ).click
@@ie.wait
assert(@@ie.contains_text('Enter query criteria for View Nominations'),'Could not access View nominations Query page ' +geterrormess(@@ie))
@@ie.text_field(:id, 'P_L_CONT_CONTRACT_NUMBER').set('PUW_EDEN2')
@@ie.button( :value, 'Find' ).click
@@ie.wait
#
assert(@@ie.contains_text('PUW_EDEN2'),'Could not find nomination identifier ' +geterrormess(@@ie))
#
assert(@@ie.contains_text(futuredate(4)),'Could not find expected Start date ' +geterrormess(@@ie))
#
assert(@@ie.contains_text(futuredate(10)),'Could not find expected End date ' +geterrormess(@@ie))
#
assert(@@ie.contains_text('Active'),'Nomination status is not active! ' +geterrormess(@@ie))
#
#
end
#
# Assumes that the system default is set to 20:00 and test is run prior to 20:00 hours
#
def test_08_can_submit_nom_before_system_submission_deadline
#
login(PUW_CUST1, PUW_CUST1_PWD, 'y')
@@ie.goto(ENTER_NOMS)
@@ie.wait
#
# Use the method to create a nomination 6 days in the future, contract has been created to allow 4 days in the future only.
#
setnomination('PUW_EDEN1', [[futuredate(1),'34246.60','0','0','0','136986.40','0','0','0']])
#
# TRUE if does find
#
assert(@@ie.contains_text('Success!'),'Nomination did not succeed: ' +geterrormess(@@ie))
puts "set the time to 07:00 nooow"
end
#
# Assumes tester is not in at 07:00
#
def test_09_cannot_submit_nom_after_system_submission_deadline
#
#dosql('begin UPDATE system_configuration SET value = \'07:00\'
# WHERE parameter = \'G_SUBMISSION_DEADLINE\'; commit; end; ')
#
sleep 120
puts "too late if you haven't set it!"
@@ie.goto(ENTER_NOMS)
@@ie.wait
#
# enter nom after 07:00 hrs ,should fail
#
setnomination('PUW_EDEN1', [[futuredate(1),'34246.60','0','0','0','136986.40','0','0','0']])
#
# TRUE if does not find
#
assert(@@ie.contains_text("20513: Cannot nominate for #{futuredate(1)} after #{futuredate(0)} 07:00."),'Nomination did not fail in expected manner: ' +geterrormess(@@ie))
#
#
end
#
def test_10_reset_sub_deadline
#
puts "set time back to 20:00, noooow!"
sleep 60
# assert(dosql('begin UPDATE system_configuration SET value = \'20:00\'
# WHERE parameter = \'G_SUBMISSION_DEADLINE\'; commit; end; '),'UPDATE submission deadline failed')
end
#
def test_11_can_send_confirmation
#
#Log in as puw admin
#
login(PUW_ADMIN, PUW_ADMIN_PWD, 'y')
#
@@ie.goto(CREATE_CONF)
@@ie.wait
#
@@ie.text_field(:id, 'p_gas_day').set(futuredate(1))
@@ie.button( :value, 'Find Nominations' ).click
@@ie.wait
#
assert_nil(@@ie.contains_text('<i>There are no nominations for the chosen gas day</i>'),'Expected nomination list, got (There are no nominations for the chosen gas day) ')
#
@@ie.checkbox(:index, 5).set
@@ie.checkbox(:index, 6).set
#
@@ie.button(:value,'Submit Selected').click
@@ie.wait
#
assert(@@ie.contains_text('Success!'),'Confirmation creation did not succeed: ' +geterrormess(@@ie))
#
@@ie.goto(APPROVE_CONF)
@@ie.wait
#
assert(@@ie.contains_text('PUW_EDEN1_'+(Time.now).strftime("%d%m%y")),'EDEN1 Confirmation creation not found: ')
assert(@@ie.contains_text('PUW_EDEN2_'+(Time.now).strftime("%d%m%y")),'EDEN2 Confirmation creation not found: ')
#
@@ie.checkbox(:index, 1).set
@@ie.checkbox(:index, 3).set
#
@@ie.button(:value,'Submit').click
@@ie.wait
#
#assert(@@ie.contains_text('Success!'),'Confirmation approval did not succeed: ' +geterrormess(@@ie))
assert_nil(@@ie.contains_text('PUW_EDEN1_'+(Time.now).strftime("%d%m%y")),'EDEN1 Confirmation approval did not succeed: ' +geterrormess(@@ie))
assert_nil(@@ie.contains_text('PUW_EDEN2_'+(Time.now).strftime("%d%m%y")),'EDEN2 Confirmation approval did not succeed: ' +geterrormess(@@ie))
#
end
#
#
#
def test_12_can_view_approved_Confirmations
#
@@ie.goto(VIEW_CONF)
@@ie.wait
#
assert_nil(@@ie.contains_text('No Records returned'),'Expected confirmation list, got "No Records returned" ')
assert(@@ie.contains_text('PUW_EDEN1_'+(Time.now).strftime("%d%m%y")),'EDEN1 Approved Confirmation not found: ')
assert(@@ie.contains_text('PUW_EDEN2_'+(Time.now).strftime("%d%m%y")),'EDEN2 Approved Confirmation not found: ')
#
end
#
#
#
def test_13_check_cannot_renom_for_current_day
#
#login as puw eden 1
login(PUW_CUST1, PUW_CUST1_PWD,'y')
@@ie.goto(ENTER_NOMS)
@@ie.wait
#
# Use the method to create a renomination today
#
setnomination('PUW_EDEN1', [[futuredate(0),'34246.60','0','0','0','136986.40','0','0','0']])
#
# TRUE if does find
#
assert(@@ie.contains_text('20514: Renomination window is not open, renominations cannot currently be accepted for today.'),'Renomination did not fail in expectd manner: ' +geterrormess(@@ie))
end
#
#
#
def test_14_can_enter_renom_wdw
#
#Log in as puw admin
#
login(PUW_ADMIN, PUW_ADMIN_PWD, 'y')
@@ie.goto(RENOM_WDW)
@@ie.wait
#
@@ie.text_field(:id, 'p_gas_day').set(futuredate(0))
# @@ie.select_list( :name , "p_wdw_open_hr").select((Time.now).strftime("%H"))
# @@ie.select_list( :name , "p_wdw_open_min").select("00")
@@ie.select_list( :name , "p_wdw_close_hr").select("23")
@@ie.select_list( :name , "p_wdw_close_min").select("00")
@@ie.text_field(:name, "p_message").set("Watir World")
#
@@ie.button(:value,'Select All').click
@@ie.wait
@@ie.button(:value,'Submit').click
@@ie.wait
#
assert(@@ie.contains_text('Success!'),'Renomination Window creation did not succeed: ' +geterrormess(@@ie))
#
end
#
#
#
def test_15_check_can_renom_for_current_day_with_wdw_open
#
#Log in as puw eden 1
#
login(PUW_CUST1, PUW_CUST1_PWD,'y')
@@ie.goto(ENTER_NOMS)
@@ie.wait
#
# Use the method to create a nomination 6 days in the future, contract has been created to allow 4 days in the future only.
#
setnomination('PUW_EDEN1', [[futuredate(0),'34246.60','0','0','0','136986.40','0','0','0']])
#
# TRUE if does find
#
assert(@@ie.contains_text('Success!'), 'Renomination was not created as expected: ' +geterrormess(@@ie))
end
end # Test_01_FAT005

View File

@@ -0,0 +1,311 @@
#
# FAT006 - This test covers additional test requirements identified during the FAT test cycle.
#
class Test_06_FAT006 < Test::Unit::TestCase
#
#Test we can logon to the system using the PUW EFT administrator user<65>s login credentials
#
def test_01_check_logon
login(PUW_ADMIN, PUW_ADMIN_PWD, 'y')
end
#
#OBJ117 <20> Cannot enter an overlapping contract for a customer:-
#Attempt to create a contract for the PUW_EDEN1 customer that overlaps the PUW_EDEN1 contract
#We assert that this should fail and give us the correct error message
#
def test_02_overlapping_contracts_should_fail
@@ie.goto(MAINTAIN_CONTRACTS)
@@ie.wait
set_contract('EDEN overlap_contract',PUW_MLT_CUST,'EDEN GRC_contracts','Multiple Day','N',futuredate(99),futuredate(140),'n')
@@ie.goto(MAINTAIN_CONTRACTS)
@@ie.wait
set_contract('EDEN overlap_contract2',PUW_MLT_CUST,'EDEN GRC_contracts','Multiple Day','N',futuredate(100),futuredate(140),'n')
end
#
#OBJ118 Cannot enter a nomination for a closed contract:-
#Attempt to enter a nomination for the PUW_EDEN1 contract is not possible because the contract should
#not be available when you try to nominate
#
def test_03_cannot_nominate_for_a_closed_contract
@@ie.goto(MAINTAIN_CONTRACTS)
@@ie.wait
#click the link for the PUW_EDEN1 contract. This may not be the same if the initial data upload changes or the
#menu changes it's currently selected as the 20th in the list.
#
@@ie.text_field(:name, 'P_CONTRACT_NUMBER').set('PUW_EDEN1')
@@ie.button(:value, "Find").click
@@ie.wait
@@ie.link(:index, 20).click
@@ie.wait
@@ie.select_list(:name, 'p_status').select('Closed')
@@ie.button(:value, "Update").click
@@ie.wait
assert(@@ie.contains_text('Success!'),'The contract was not updated correctly : '+geterrormess(@@ie))
#
#Log back into the system as the PUW_EDEN1 user.
#
login(PUW_CUST1,PUW_CUST1_PWD,'y')
@@ie.goto(ENTER_NOMS)
@@ie.wait
#
#Ensure that the contract is no longer selectable on the nominations screen
#
assert_nil(@@ie.contains_text( '<option value="PUW_EDEN1"'),'The contract PUW_EDEN1 is selectable, when it should not be available.')
end
#
#OBJ119 Cannot enter a multi day nomination beyond the contract expiry date :-
#Note this test does not actually do anything at present!
#
def test_04_cannot_enter_a_multiday_nomination_beyond_the_contract_expiry_date
login(PUW_ADMIN, PUW_ADMIN_PWD, 'y')
@@ie.goto(MAINTAIN_CONTRACTS)
@@ie.wait
@@ie.text_field(:name, 'P_CONTRACT_NUMBER').set('PUW_EDEN2')
@@ie.button(:value, "Find").click
@@ie.wait
#click the link for the PUW_EDEN2 contract. This may not be the same if the initial data upload changes or the
#menu changes it's currently selected as the 20th in the list.
@@ie.link(:index, 20).click
@@ie.wait
@@ie.text_field(:name, 'p_date_to').set(futuredate(4))
@@ie.button(:value, "Update").click
@@ie.wait
#Log back into the system as the PUW_EDEN2 user.
login(PUW_CUST2, PUW_CUST2_PWD, 'y')
@@ie.goto(ENTER_NOMS)
@@ie.wait
# assert(@@ie.text_field(:value, futuredate(4)),'Could not find the last day the contract was valid : '+futuredate(4))
# assert(@@ie.text_field(:value, futuredate(9)),'Found a date ('+futuredate(9)+') after the last available date '+futuredate(4))
# assert(@@ie.text_field(:value, futuredate(8)),'Found a date ('+futuredate(8)+') after the last available date '+futuredate(4))
# assert(@@ie.text_field(:value, futuredate(7)),'Found a date ('+futuredate(7)+') after the last available date '+futuredate(4))
# assert(@@ie.text_field(:value, futuredate(6)),'Found a date ('+futuredate(6)+') after the last available date '+futuredate(4))
# assert(@@ie.text_field(:value, futuredate(5)),'Found a date ('+futuredate(5)+') after the last available date '+futuredate(4))
# assert(@@ie.text_field(:value, futuredate(4)),'Found a date ('+futuredate(4)+') after the last available date '+futuredate(4))
#
#FINISH ME!!!!
end
#
#OBJ120 User cannot login for a customer after the customer period end date.
#Now: cannot nominate for a customer after the customer period end date.
#
#
def test_05_can_login_as_customer_after_the_customer_period_end_date
#Logon to the Nominations system using the OMT EFT administrator user<65>s login credentials.
login(OMT_ADMIN, OMT_ADMIN_PWD, 'y')
@@ie.goto(MAINTAIN_CUSTOMER)
@@ie.wait
#Search for the OMT_EDEN1 customer
@@ie.text_field(:name, 'P_CODE').set('OMT_EDEN1')
@@ie.button(:value, "Find").click
@@ie.wait
#Change the period end to today
@@ie.text_field(:name, 'P_PERIOD_END').set(futuredate(0))
@@ie.button(:value, "Update").click
@@ie.wait
#Log back into the system (after 06:00) as the OMT_EDEN1 user (who acts for the OMT_EDEN1 customer).
@@ie.goto(LOGOUT)
@@ie.wait
@@ie.goto(LOGIN)
@@ie.wait
@@ie.text_field( :name, 'p_username' ).set( OMT_CUST1 )
@@ie.text_field( :name, 'p_password' ).set( OMT_CUST1_PWD )
#
@@ie.button(:value, "Log on").click
@@ie.wait
assert_nil(@@ie.contains_text('Invalid Logon'),'Could not login with '+OMT_CUST1+' when we should have been able to')
#
#TRY AND NOMINATE
#
#@@ie.goto(ENTER_NOMS)
#@@ie.wait
end
#
#OBJ121 User may not login after their <20>Period end date<74>
#
def test_06_user_cannot_login_after_their_period_end_date
#Logon to the Nominations system using the OMT EFT administrator user<65>s login credentials.
login(OMT_ADMIN, OMT_ADMIN_PWD, 'y')
@@ie.goto(MAINTAIN_USER)
@@ie.wait
#Search for the OMT_EDEN2 user
@@ie.text_field(:name, 'P_DB_USERNAME').set('OMT_EDEN2')
@@ie.button(:value, "Find").click
@@ie.wait
#Change the period end to today
@@ie.text_field(:name, 'P_PERIOD_END').set(futuredate(0))
@@ie.button(:value, "Update").click
@@ie.wait
#Log back into the system (after 06:00) as the OMT_EDEN2 user.
@@ie.goto(LOGOUT)
@@ie.wait
@@ie.goto(LOGIN)
@@ie.wait
@@ie.text_field( :name, 'p_username' ).set( OMT_CUST2 )
@@ie.text_field( :name, 'p_password' ).set( OMT_CUST2_PWD )
#
@@ie.button(:value, "Log on").click
@@ie.wait
#
assert(@@ie.contains_text('Invalid Logon'),'Logged in with '+OMT_CUST2+' when we should have been denied access')
end
#
#OBJ122 Single day nominations are superseded by nominations for the same gas day for the same contract.
#and OBJ 124 Only active nominations can be seen on view nominations.
def test_07_superceded_singlenoms_work_and_only_active_noms_shown
login(PUW_ADMIN, PUW_ADMIN_PWD, 'y')
@@ie.goto(MAINTAIN_CONTRACTS)
@@ie.wait
@@ie.text_field(:name, 'P_CONTRACT_NUMBER').set('PUW_EDEN1')
@@ie.button(:value, "Find").click
@@ie.wait
#click the link for the PUW_EDEN1 contract. This may not be the same if the initial data upload changes or the
#menu changes it's currently selected as the 20th in the list.
@@ie.link(:index, 20).click
@@ie.wait
#set contract back to open
@@ie.select_list(:name, 'p_status').select('Open')
@@ie.button(:value, "Update").click
@@ie.wait
assert(@@ie.contains_text('Success!'),'The contract was not updated correctly : '+geterrormess(@@ie))
#Log back into the system as the PUW_EDEN1 user.
login(PUW_CUST1, PUW_CUST1_PWD, 'y')
@@ie.goto(ENTER_NOMS)
@@ie.wait
setnomination(PUW_CUST1, [[futuredate(1),'35000','0','10000','0','70000','0','20000','0']])
assert(@@ie.contains_text('Success!'),'Nomination did not succeed: ' +geterrormess(@@ie))
@@ie.goto(VIEW_NOMS)
@@ie.wait
assert(@@ie.contains_text('PUW_EDEN1'),'The nomination entry was not found')
assert(@@ie.contains_text('Active'),'The nomination entry was not found')
assert(@@ie.contains_text('EDEN1'),'The nomination entry was not found')
assert_nil(@@ie.contains_text('Inactive'),'Found an inactive nomination when we should not have')
@@ie.goto(ENTER_NOMS)
@@ie.wait
setnomination(PUW_CUST1, [[futuredate(1),'35001','0','10001','0','70001','0','20001','0']])
assert(@@ie.contains_text('Success!'),'Nomination did not succeed: ' +geterrormess(@@ie))
@@ie.goto(VIEW_NOMS)
@@ie.wait
assert(@@ie.contains_text('PUW_EDEN1'),'The nomination entry was not found')
assert(@@ie.contains_text('Active'),'The nomination entry was not found')
assert(@@ie.contains_text('EDEN1'),'The nomination entry was not found')
assert(@@ie.contains_text('Inactive'),'The nomination entry was not found')
end
#
#OBJ123 Multi day nominations are superseded by re-nominations for the same gas week
#and OBJ124 Only active nominations can be seen on view nominations.
#
def test_08_superceded_multinoms_work_and_only_active_noms_shown
login(PUW_ADMIN, PUW_ADMIN_PWD, 'y')
@@ie.goto(MAINTAIN_CONTRACTS)
@@ie.wait
@@ie.text_field(:name, 'P_CONTRACT_NUMBER').set('PUW_EDEN2')
@@ie.button(:value, "Find").click
@@ie.wait
#click the link for the PUW_EDEN2 contract. This may not be the same if the initial data upload changes or the
#menu changes it's currently selected as the 20th in the list.
@@ie.link(:index, 20).click
@@ie.wait
#set contract back to open
@@ie.select_list(:name, 'p_status').select('Open')
@@ie.text_field(:name, 'p_date_to').set(futuredate(120))
@@ie.button(:value, "Update").click
@@ie.wait
#Log back into the system as the PUW_EDEN2 user.
login(PUW_CUST2, PUW_CUST2_PWD, 'y')
@@ie.goto(ENTER_NOMS)
@@ie.wait
setmultinom('PUW_EDEN2', [[futuredate(1),'33900','0','10000','0'],
[futuredate(2),'33900','0','10000','0'],
[futuredate(3),'33900','0','10000','0'],
[futuredate(4),'33900','0','10000','0'],
[futuredate(5),'33900','0','10000','0'],
[futuredate(6),'33900','0','10000','0'],
[futuredate(7),'33900','0','10000','0'],
[futuredate(1),'100000','0','30000','0'],
[futuredate(2),'100000','0','30000','0'],
[futuredate(3),'100000','0','30000','0'],
[futuredate(4),'100000','0','30000','0'],
[futuredate(5),'100000','0','30000','0'],
[futuredate(6),'100000','0','30000','0'],
[futuredate(7),'100000','0','30000','0'],
])
assert(@@ie.contains_text('Success!'),'Nomination did not succeed: ' +geterrormess(@@ie))
@@ie.goto(VIEW_NOMS)
@@ie.wait
assert(@@ie.contains_text('PUW_EDEN2'),'The nomination entry was not found')
assert(@@ie.contains_text('Active'),'The nomination entry was not found')
assert(@@ie.contains_text('EDEN2'),'The nomination entry was not found')
@@ie.goto(ENTER_NOMS)
@@ie.wait
setmultinom('PUW_EDEN2', [[futuredate(1),'33900','0','10000','0'],
[futuredate(2),'33900','0','10000','0'],
[futuredate(3),'33900','0','10000','0'],
[futuredate(4),'33900','0','10000','0'],
[futuredate(5),'33900','0','10000','0'],
[futuredate(6),'33900','0','10000','0'],
[futuredate(7),'33900','0','10000','0'],
[futuredate(1),'100000','0','30000','0'],
[futuredate(2),'100000','0','30000','0'],
[futuredate(3),'100000','0','30000','0'],
[futuredate(4),'100000','0','30000','0'],
[futuredate(5),'100000','0','30000','0'],
[futuredate(6),'100000','0','30000','0'],
[futuredate(7),'100000','0','30000','0'],
])
assert(@@ie.contains_text('Success!'),'Nomination did not succeed: ' +geterrormess(@@ie))
@@ie.goto(VIEW_NOMS)
@@ie.wait
assert(@@ie.contains_text('PUW_EDEN2'),'The nomination entry was not found')
assert(@@ie.contains_text('Active'),'The nomination entry was not found')
assert(@@ie.contains_text('EDEN2'),'The nomination entry was not found')
assert(@@ie.contains_text('Inactive'),'The nomination entry was not found')
end
#
#OBJ125 Only active nominations can be confirmed.
#
def test_09_only_active_nominations_can_be_confirmed
login(PUW_ADMIN, PUW_ADMIN_PWD, 'y')
@@ie.goto(CREATE_CONFIRMATION)
@@ie.wait
@@ie.text_field(:name, 'p_gas_day').set(futuredate(1))
@@ie.button(:value, "Find Nominations").click
@@ie.wait
assert_nil(@@ie.contains_text('Inactive'),'Found an inactive nomination, we should only have active ones.')
assert(@@ie.contains_text('PUW_EDEN1'),'Did not find PUW_EDEN1 nomination')
# Set PUW_EDEN1 to be confirmed
@@ie.checkbox(:index, 5).set
@@ie.button(:value, "Submit Selected").click
@@ie.wait
assert(@@ie.contains_text('Successfully created confirmations'),'Did not create confirmation')
assert(@@ie.contains_text('PUW_EDEN1'),'Did not find PUW_EDEN1 confirmation')
assert(@@ie.contains_text('EDEN1'),'Did not find nomination id')
sleep 3
#Approve the PUW_EDEN confirmation
@@ie.checkbox(:index, 1).set
@@ie.button(:value, "Submit").click
@@ie.wait
assert(@@ie.contains_text('No unapproved confirmations exist'),'Exepected no confirmations to be approved but found some')
assert_nil(@@ie.contains_text('PUW_EDEN1'),'Found PUW_EDEN1 confirmation, when we should not have')
assert_nil(@@ie.contains_text('EDEN1'),'Found EDEN1 when we should not have')
@@ie.goto(VIEW_CONFIRMATION)
@@ie.wait
assert(@@ie.contains_text('PUW_EDEN1'),'Did not find PUW_EDEN1 confirmation')
assert(@@ie.contains_text('EDEN1'),'Did not find nomination id')
end
end

View File

@@ -0,0 +1,53 @@
##//////////////////////////////////////////////////////////////////////////////
##
## Watir script recorded by WatirMaker.
##
##//////////////////////////////////////////////////////////////////////////////
#requires
require 'watir'
#require the test unit library
require 'test/unit'
#require our constants
require 'constants'
#require our useful helper methods
require 'default_methods.rb'
#includes
include Watir
@@ie = IE.new
@@ie.maximize
#set the speed of watir, we'd also set the speed of light but that's supposed to be a constant
@@ie.speed = :fast
# Run the remove test data via the browser
@@ie.goto( PROTOCOL+MACHINE+'/'+DAD+'/cleanup_testdata' )
@@ie.wait
#This should probably be a constant, but we're going to the home page
@@ie.goto( PROTOCOL+MACHINE+'/'+DAD+'/home' )
#
# Setup default config
#
# Remove the test data
#
#dosql('begin cleanup_testdata; commit; end;')
#
# Set the system submission deadline
#
#dosql('begin UPDATE system_configuration SET value = \'20:00\'
# WHERE parameter = \'G_SUBMISSION_DEADLINE\'; commit; end; ')
#
#Set up our contracts before we start serious testing
#
require 'setup_contracts'
#
#Get our fat tests
#
#require 'fat005'
require 'fat006'
#@@ie.goto(LOGOUT)
#@@ie.wait
#@@ie.close

View File

@@ -0,0 +1,176 @@
class Test_01_Setup_Contracts < Test::Unit::TestCase
#
def test_01_check_logon
# Logon link
@@ie.document.all[ '19' ].click
@@ie.wait
#
# Enter logon details
#
@@ie.text_field( :name, 'p_username' ).set( PUW_ADMIN )
@@ie.text_field( :name, 'p_password' ).set( PUW_ADMIN_PWD )
#
@@ie.button(:value, "Log on").click
@@ie.wait
#
# TRUE if doesn't find
#
assert_nil(@@ie.contains_text('Invalid Logon'),'Unable to login')
end
#
def test_02_create_network_points
#
@@ie.goto(CREATE_NETW_POINTS)
@@ie.wait
#
set_network_point( NETW_POINT_HAG )
#
# TRUE if does find
#
assert(@@ie.contains_text('Success!'),'Create Network point EDEN HAG did not succeed: ' +geterrormess(@@ie))
#
set_network_point( NETW_POINT_TSTV )
#
# TRUE if does find
#
assert(@@ie.contains_text('Success!'),'Create Network point EDEN TSTV did not succeed: ' +geterrormess(@@ie))
#
set_network_point( NETW_POINT_TSTV )
#
# TRUE if does find
#
assert(@@ie.contains_text('The Network Point ID must be unique'),'Create Network point EDEN TSTV did not fail as expected: ' +geterrormess(@@ie))
#
#
end
#
def test_03_create_cateogry
#
@@ie.goto(CREATE_CATEGORY)
@@ie.wait
#
set_categories('EDEN_Request_m3day','55555')
#
assert(@@ie.contains_text('Success!'),'Create Network point EDEN_Request_m3day did not succeed: ' +geterrormess(@@ie))
#
set_categories('EDEN_D_makeup_m3day','55556')
#
assert(@@ie.contains_text('Success!'),'Create Network point EDEN_D_makeup_m3day did not succeed: ' +geterrormess(@@ie))
#
set_categories('EDEN_Q_makeup_m3day','55557')
#
assert(@@ie.contains_text('Success!'),'Create Network point EDEN_Q_makeup_m3day did not succeed: ' +geterrormess(@@ie))
#
set_categories('EDEN_Y_makeup_m3day','55558')
#
assert(@@ie.contains_text('Success!'),'Create Network point EDEN_Y_makeup_m3day did not succeed: ' +geterrormess(@@ie))
#
end
#
def test_04_can_view_defaulted_parameters
#
@@ie.goto(VIEW_PARAMETERS)
@@ie.wait
#
@@ie.button(:value, 'Query').click
@@ie.wait
#
@@ie.text_field( :name, 'P_CODE' ).set( 'EDEN%' )
#
@@ie.button(:value, 'Find').click
@@ie.wait
#
assert(@@ie.contains_text('EDEN_Request_m3day'),'Could not find parameter EDEN_Request_m3day ' +geterrormess(@@ie))
assert(@@ie.contains_text('EDEN_D_makeup_m3day'),'Could not find parameter EDEN_D_makeup_m3day ' +geterrormess(@@ie))
assert(@@ie.contains_text('EDEN_Q_makeup_m3day'),'Could not find parameter EDEN_Q_makeup_m3day ' +geterrormess(@@ie))
assert(@@ie.contains_text('EDEN_Y_makeup_m3day'),'Could not find parameter EDEN_Y_makeup_m3day ' +geterrormess(@@ie))
#
end
#
def test_05_can_create_a_template
#
@@ie.goto(CREATE_TEMPLATE)
@@ie.wait
#
@@ie.button(:value, 'Create Template').click
@@ie.wait
#
@@ie.text_field( :name, 'p_template_name').set('EDEN GRC_contracts')
@@ie.text_field( :name, 'p_template_desc').set('EDEN GRC_contracts')
#
@@ie.select_list(:name, 'add_cate_id').select('EDEN_D_makeup_m3day (m3/day)')
@@ie.select_list(:name, 'add_cate_id').select('EDEN_Y_makeup_m3day (m3/day)')
@@ie.select_list(:name, 'add_cate_id').select('EDEN_Q_makeup_m3day (m3/day)')
@@ie.select_list(:name, 'add_cate_id').select('EDEN_Request_m3day (m3/day)')
#
@@ie.button(:value, 'Add Categories').click
@@ie.wait
#
@@ie.button(:value, 'Insert').click
@@ie.wait
#
assert(@@ie.contains_text('Success!'),'Create template did not succeed: ' +geterrormess(@@ie))
#
@@ie.button(:value, 'Rules').click
@@ie.wait
#
set_rule('E_rl_R_m3max','cat_Request_m3day <= cat_Request_m3day.MAX','EDEN_Request_m3day','EDEN_Request_m3day.MAX','<=')
set_rule('E_rl_R_m3min','cat_Request_m3day >= cat_Request_m3day.MIN','EDEN_Request_m3day','EDEN_Request_m3day.MIN','>=')
set_rule('E_rl_Dmu_m3max','cat_D_makeup_m3day <= cat_D_makeup_m3day.MAX','EDEN_D_makeup_m3day','EDEN_D_makeup_m3day.MAX','<=')
set_rule('E_rl_Dmu_m3min','cat_Request_m3day >= cat_Request_m3day.MIN','EDEN_D_makeup_m3day','EDEN_D_makeup_m3day.MIN','>=')
set_rule('E_rl_Qmu_m3max','cat_Q_makeup_m3day <= cat_Q_makeup_m3day.MAX','EDEN_Q_makeup_m3day','EDEN_Q_makeup_m3day.MAX','<=')
set_rule('E_rl_Qmu_m3min','cat_Q_makeup_m3day >= cat_Q_makeup_m3day.MIN','EDEN_Q_makeup_m3day','EDEN_Q_makeup_m3day.MIN','>=')
set_rule('E_rl_Ymu_m3max','cat_Y_makeup_m3day <= cat_Y_makeup_m3day.MAX','EDEN_Y_makeup_m3day','EDEN_Y_makeup_m3day.MAX','<=')
set_rule('E_rl_Ymu_m3min','cat_Y_makeup_m3day >= cat_Y_makeup_m3day.MIN','EDEN_Y_makeup_m3day','EDEN_Y_makeup_m3day.MIN','>=')
#
end
#
#
#
def test_06_can_create_PUW_contracts
#
@@ie.goto(CREATE_CONTRACT)
@@ie.wait
#p_name,p_customer,p_template,p_format
set_contract(PUW_SGL_CUST,PUW_SGL_CUST,'EDEN GRC_contracts','Single Day','Y')
#
@@ie.goto(CREATE_CONTRACT)
@@ie.wait
#
set_contract(PUW_MLT_CUST,PUW_MLT_CUST,'EDEN GRC_contracts','Multiple Day','N')
#
end
#
def test_07_can_create_OMT_Contracts
#
# Login as omtadmin
@@ie.goto(LOGOUT)
@@ie.wait
@@ie.goto(LOGIN)
@@ie.wait
#
# Enter logon details
#
@@ie.text_field( :name, 'p_username' ).set( OMT_ADMIN )
@@ie.text_field( :name, 'p_password' ).set( OMT_ADMIN_PWD )
#
@@ie.button(:value, "Log on").click
@@ie.wait
#
# TRUE if doesn't find
#
assert_nil(@@ie.contains_text('Invalid Logon'),'Unable to login')
#
@@ie.goto(CREATE_CONTRACT)
@@ie.wait
#
set_contract(OMT_SGL_CUST,OMT_SGL_CUST,'EDEN GRC_contracts','Single Day','N')
#
@@ie.goto(CREATE_CONTRACT)
@@ie.wait
#
set_contract(OMT_MLT_CUST,OMT_MLT_CUST,'EDEN GRC_contracts','Multiple Day','N')
#
end
#
end # Test 1