Files
mip/Data/BulkLoad/EFT/Nominations/testing/fat006.rb

311 lines
14 KiB
Ruby
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#
# 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 users login credentials
#
def test_01_check_logon
login(PUW_ADMIN, PUW_ADMIN_PWD, 'y')
end
#
#OBJ117 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 users 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 “Period end date”
#
def test_06_user_cannot_login_after_their_period_end_date
#Logon to the Nominations system using the OMT EFT administrator users 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