Watir tests for login and user management.

git-svn-id: http://locode01.ad.dom/svn/WEBMIP/trunk@3228 248e525c-4dfb-0310-94bc-949c084e9493
This commit is contained in:
mullenm
2008-01-14 14:49:39 +00:00
parent 970f0e6b16
commit fd98a00bc9
2 changed files with 807 additions and 0 deletions

107
tests/login_tests.rb Normal file
View File

@@ -0,0 +1,107 @@
#---
#This unit test checks the bases screen.
#---
class Test_01_login_screen < Test::Unit::TestCase
#
#Test we can logon to the system using the webmip administrator user<65>s login credentials and check that
#all the columns required for the report appears with the button to create a new base record
#
def test_01_login_screen_appears
@@ie.goto(LOGIN)
#we'll need to login
assert(@@ie.text_field(:id,'P101_USERNAME').exists?,'Could not find P101_USERNAME field')
assert(@@ie.text_field(:id,'P101_PASSWORD').exists?,'Could not find P101_PASSWORD file upload field')
assert(@@ie.button(:value,'Login').exists?,'Could not find Login button')
assert(@@ie.button(:value,'New Password').exists?,'Could not find New Password button')
assert(@@ie.button(:value,'Forgotten Password').exists?,'Could not find Forgotten Password button')
end
def test_02_check_login_validation
#Test that a username must be given
@@ie.button(:value,'Login').click
@@ie.wait
assert(@@ie.contains_text('Value must be specified.'),'Expected not null error on username.')
# test that a password must be given
@@ie.text_field(:id,'P101_USERNAME').set 'login_test'
@@ie.button(:value,'Login').click
@@ie.wait
assert(@@ie.contains_text('Value must be specified.'),'Expected not null error on password.')
# test that a valid user must be given
@@ie.text_field(:id,'P101_USERNAME').set 'not_a_user'
@@ie.text_field(:id,'P101_PASSWORD').set 'password'
@@ie.button(:value,'Login').click
@@ie.wait
assert(@@ie.contains_text('User specified does not exist in the system.'),'User specified does not exist in the system.')
# test that a valid password must be given
@@ie.text_field(:id,'P101_USERNAME').set 'login_test'
@@ie.text_field(:id,'P101_PASSWORD').set 'incorrect'
@@ie.button(:value,'Login').click
@@ie.wait
assert(@@ie.contains_text('Invalid Login Credentials'),'Valid password error message incorrect.')
#@@ie.close
end
def test_03_open_user
#tests that a correct username and password for an "OPEN" user is accepted and the user is redirected correctly
@@ie.goto(LOGIN)
@@ie.text_field(:id,'P101_USERNAME').set 'login_test'
@@ie.text_field(:id,'P101_PASSWORD').set 'password'
@@ie.button(:value,'Login').click
@@ie.wait
assert(@@ie.contains_text('Front Screen'),'User specified does not exist in the system.')
#@@ie.close
end
def test_04_expired_password
#tests that a correct username and password for an "EXPIRED" user is accepted and the user is redirected correctly
@@ie.goto(LOGIN)
@@ie.text_field(:id,'P101_USERNAME').set 'expired_user'
@@ie.text_field(:id,'P101_PASSWORD').set 'password'
@@ie.button(:value,'Login').click
@@ie.wait
assert(@@ie.contains_text('Change Password'),'Expired user account not redirected correctly during logon.')
#@@ie.close
end
def test_05_locked_account
#tests that a correct username and password for an "LOCKED" user is accepted and the user is redirected correctly
@@ie.goto(LOGIN)
@@ie.text_field(:id,'P101_USERNAME').set 'locked_user'
@@ie.text_field(:id,'P101_PASSWORD').set 'password'
@@ie.button(:value,'Login').click
@@ie.wait
assert(@@ie.contains_text('The user account specified is locked. Please contact the system administrator.'),'Locked user account not redirected correctly during logon.')
#ie.close
end
def test_06_expired_account_password_change
#tests that a correct username and password for an "EXPIRED" user is accepted and the user is redirected correctly
@@ie.goto(LOGIN)
@@ie.text_field(:id,'P101_USERNAME').set 'expired_user'
@@ie.text_field(:id,'P101_PASSWORD').set 'password'
@@ie.button(:value,'Login').click
@@ie.wait
#confirm we're at the right page
assert(@@ie.contains_text('Change Password'),'Expired user account not redirected correctly during logon.')
#fill in some new password details - make sure that we follow security protocol for passwords...
@@ie.text_field(:id,'P102_NEW_PASSWORD').set 'P4ssw0rd.'
@@ie.text_field(:id,'P102_REPEAT_PASSWORD').set 'P4ssw0rd.'
@@ie.button(:value,'Change Password').click
@@ie.wait
#confirm the password was updated correctly
assert(@@ie.contains_text('Password updated.'),'Password not updated.')
#now log back in with the new password
@@ie.button(:value,'Login').click
@@ie.wait
assert(@@ie.button(:value,'Login').exists?,'Not navigated back to login page.')
@@ie.text_field(:id,'P101_USERNAME').set 'expired_user'
@@ie.text_field(:id,'P101_PASSWORD').set 'P4ssw0rd.'
@@ie.button(:value,'Login').click
@@ie.wait
#confirm we're at the right page
assert(@@ie.contains_text('Front Screen'),'Unsuccessful attempt at login.')
end
##close IE if still open
#@@ie.close
end

700
tests/user_management.rb Normal file
View File

@@ -0,0 +1,700 @@
#---
#This unit test checks the party management screens and processes.
#
# File: user_management.rb
# Created: 18-Dec-2007
# Created by: MM
#
# Test_07_MIPADMIN_party_management
# - test_01_screen_appears
# - test_02_create_mktp
# - test_03_create_user_suppadmin
# - test_04_create_user_agent
# - test_05_create_user_cs
# - test_06_create_user_icu
#
# Test_08_SUPPADMIN_party_management
# - test_01_create_user_agent
#
# Test_09_edit_parties
# - test_01_edit_parties_screen_appears
# - test_02_edit_users
# - test_03_edit_suppliers
#---
class Test_07_MIPADMIN_party_management< Test::Unit::TestCase
#
#Test we can logon to the system using the webmip administrator user<65>s login credentials and check that
#all the fields required for creating parties in the system are correctly displayed.
#
def test_01_screen_appears
@@ie.goto(MANAGE_PARTIES)
#we'll need to login as a MIPADMIN user
login('advantica','password')
#confirm that there are 2 buttons available
assert(@@ie.button(:value,'Create New Party').exists?,'Could not find Create New Party button')
assert(@@ie.button(:value,'Edit Party').exists?,'Could not find Edit Party button')
#let's create a party
@@ie.button(:name,'Create New Party').click
#check the items on the page
assert(@@ie.select_list(:id,'P61_PRTY_TYPE').exists?,'Could not find P61_PRTY_TYPE select list')
#Check the list of dropdowns is as expected
party_types = ["- Select Party Type -", "Market Participant", "User", "Manufacturer"]
assert_equal(party_types,@@ie.select_list(:id, 'P61_PRTY_TYPE').getAllContents ,'List of available party types does not match expected list')
#check the correct fields are displayed when we select party types
#create Market Participant
@@ie.select_list(:id,'P61_PRTY_TYPE').set('Market Participant')
assert(@@ie.button(:value,'Cancel').exists?,'Could not find Cancel button')
assert(@@ie.button(:value,'Next >').exists?,'Could not find Next > button')
assert(@@ie.text_field(:id,'P61_NAME').exists?,'Could not find P61_NAME field')
assert(@@ie.text_field(:id,'P61_SHORTCODE').exists?,'Could not find P61_SHORTCODE field')
assert(@@ie.text_field(:id,'P61_MKTP_REF').exists?,'Could not find P61_MKTP_REF field')
assert(@@ie.text_field(:id,'P61_LT_7B_CONTRACT_REF').exists?,'Could not find P61_LT_7B_CONTRACT_REF field')
assert(@@ie.text_field(:id,'P61_GT_7B_CONTRACT_REF').exists?,'Could not find P61_GT_7B_CONTRACT_REF field')
assert(@@ie.text_field(:id,'P61_ADV_CONTRACT_REF').exists?,'Could not find P61_ADV_CONTRACT_REF field')
assert(@@ie.select_list(:id,'P61_TRIPARTITE').exists?,'Could not find P61_TRIPARTITE select list')
#Manufacturer
@@ie.select_list(:id,'P61_PRTY_TYPE').set('Manufacturer')
assert(@@ie.button(:value,'Cancel').exists?,'Could not find Cancel button')
assert(@@ie.button(:value,'Next >').exists?,'Could not find Next > button')
assert(@@ie.text_field(:id,'P61_NAME').exists?,'Could not find P61_NAME field')
assert(@@ie.text_field(:id,'P61_MANU_REF').exists?,'Could not find P61_MANU_REF field')
assert(@@ie.text_field(:id,'P61_DESCRIPTION').exists?,'Could not find P61_DESCRIPTION field')
#create USER
@@ie.select_list(:id,'P61_PRTY_TYPE').set('User')
assert(@@ie.button(:value,'Cancel').exists?,'Could not find Cancel button')
assert(@@ie.button(:value,'Next >').exists?,'Could not find Next > button')
assert(@@ie.text_field(:id,'P61_USERNAME').exists?,'Could not find P61_USERNAME field')
assert(@@ie.text_field(:id,'P61_TITLE').exists?,'Could not find P61_TITLE field')
assert(@@ie.text_field(:id,'P61_FIRST_NAME').exists?,'Could not find P61_FIRST_NAME field')
assert(@@ie.text_field(:id,'P61_LAST_NAME').exists?,'Could not find P61_LAST_NAME field')
assert(@@ie.text_field(:id,'P61_COMMENTS').exists?,'Could not find P61_COMMENTS field')
assert(@@ie.text_field(:id,'P61_PASSWORD').exists?,'Could not find P61_PASSWORD file upload field')
assert(@@ie.text_field(:id,'P61_REPEAT_PASSWORD').exists?,'Could not find P61_REPEAT_PASSWORD file upload field')
assert(@@ie.checkbox(:id,'P61_EXPIRE_PWORD_0').exists?,'Could not find P61_EXPIRE_PWORD_0 checkbox')
#Test the objects on P62
@@ie.goto(ASSIGN_PARTY_ROLE)
#we'll need to login as a MIPADMIN user
login('advantica','password')
assert(@@ie.button(:value,'Cancel').exists?,'Could not find Cancel button')
assert(@@ie.button(:value,'< Previous').exists?,'Could not find < Previous button')
assert(@@ie.button(:value,'Next >').exists?,'Could not find Next > button')
assert(@@ie.select_list(:id,'P62_PRTY_ROLE').exists?,'Could not find P62_PRTY_ROLE select list')
#assert(@@ie.select_list(:id,'P62_USER_SUPPLIER').exists?,'Could not find P62_USER_SUPPLIER select list')
#assert(@@ie.select_list(:id,'P62_SUPP_ADMIN').exists?,'Could not find P62_SUPP_ADMIN select list')
assert(@@ie.text_field(:id,'P62_PHONE').exists?,'Could not find P62_PHONE field')
assert(@@ie.text_field(:id,'P62_FAX').exists?,'Could not find P62_FAX field')
assert(@@ie.text_field(:id,'P62_MOBILE').exists?,'Could not find P62_MOBILE field')
assert(@@ie.text_field(:id,'P62_EMAIL').exists?,'Could not find P62_EMAIL field')
#Test the objects on P63
@@ie.goto(PARTY_CONTACT_DETAILS)
#we'll need to login as a MIPADMIN user
login('advantica','password')
assert(@@ie.button(:value,'Cancel').exists?,'Could not find Cancel button')
assert(@@ie.button(:value,'< Previous').exists?,'Could not find < Previous button')
assert(@@ie.button(:value,'Next >').exists?,'Could not find Next > button')
assert(@@ie.text_field(:id,'P63_SELECT_ADDRESS').exists?,'Could not find P63_SELECT_ADDRESS field')
assert(@@ie.button(:value,'Copy Address').exists?,'Could not find Copy Address button')
assert(@@ie.text_field(:id,'P63_OFF_CODE').exists?,'Could not find P63_OFF_CODE field')
assert(@@ie.text_field(:id,'P63_OFF_SUB_BUILD').exists?,'Could not find P63_OFF_SUB_BUILD field')
assert(@@ie.text_field(:id,'P63_OFF_BUILDING').exists?,'Could not find P63_OFF_BUILDING field')
assert(@@ie.text_field(:id,'P63_OFF_STREET').exists?,'Could not find P63_OFF_STREET field')
assert(@@ie.text_field(:id,'P63_OFF_CITY').exists?,'Could not find P63_OFF_CITY field')
assert(@@ie.text_field(:id,'P63_OFF_POSTCODE').exists?,'Could not find P63_OFF_POSTCODE field')
#Test the objects on P64
@@ie.goto(PARTY_HOME_ADDR)
#we'll need to login as a MIPADMIN user
login('advantica','password')
assert(@@ie.button(:value,'Cancel').exists?,'Could not find Cancel button')
assert(@@ie.button(:value,'< Previous').exists?,'Could not find < Previous button')
assert(@@ie.button(:value,'Finish').exists?,'Could not find Finish button')
assert(@@ie.select_list(:id,'P64_SELECT_ADDRESS').exists?,'Could not find P64_SELECT_ADDRESS select list')
assert(@@ie.button(:value,'Copy Address').exists?,'Could not find Copy Address button')
assert(@@ie.text_field(:id,'P64_HOME_CODE').exists?,'Could not find P64_HOME_CODE field')
assert(@@ie.text_field(:id,'P64_HOME_SUB_BUILD').exists?,'Could not find P64_HOME_SUB_BUILD field')
assert(@@ie.text_field(:id,'P64_HOME_BUILDING').exists?,'Could not find P64_HOME_BUILDING field')
assert(@@ie.text_field(:id,'P64_HOME_STREET').exists?,'Could not find P64_HOME_STREET field')
assert(@@ie.text_field(:id,'P64_HOME_CITY').exists?,'Could not find P64_HOME_CITY field')
assert(@@ie.text_field(:id,'P64_HOME_POSTCODE').exists?,'Could not find P64_HOME_POSTCODE field')
end
#
#Test we can create a market participant (SUPPLIER) in the system when logged on as MIPADMIN user.
#
def test_02_create_mktp
@@ie.goto(LOGIN)
#we'll need to login as a MIPADMIN user
login('advantica','password')
#Navigate to the page using the menu
menu('Administration')
menu('User Management')
#menu('Create Party')
#create a new party
@@ie.button(:name,'Create New Party').click
#select the type of party to create
@@ie.select_list(:id,'P61_PRTY_TYPE').set('Market Participant')
# set the field values
#@@ie.text_field(:id,'').set('')
@@ie.text_field(:id,'P61_NAME').set('Supplier1')
@@ie.text_field(:id,'P61_SHORTCODE').set('SU1')
@@ie.text_field(:id,'P61_MKTP_REF').set('Test Supplier1')
@@ie.text_field(:id,'P61_LT_7B_CONTRACT_REF').set('1')
@@ie.text_field(:id,'P61_GT_7B_CONTRACT_REF').set('1')
@@ie.text_field(:id,'P61_ADV_CONTRACT_REF').set('1')
@@ie.select_list(:id,'P61_TRIPARTITE').set('Yes')
@@ie.button(:value,'Next >').click
#Select a role for the party
@@ie.select_list(:id,'P62_PRTY_ROLE').set('Service supplier')
#fill in the contact details bits and bobs
@@ie.text_field(:id,'P62_PHONE').set('01234 567890')
@@ie.text_field(:id,'P62_FAX').set('01234 567890')
@@ie.text_field(:id,'P62_MOBILE').set('01234 567890')
@@ie.text_field(:id,'P62_EMAIL').set('supplier@supplier1.org')
@@ie.button(:value,'Next >').click
#create a new address for the supplier
@@ie.text_field(:id,'P63_OFF_CODE').set('SU1_OFFICE')
@@ie.text_field(:id,'P63_OFF_SUB_BUILD').set('62')
@@ie.text_field(:id,'P63_OFF_BUILDING').set('Supplier1')
@@ie.text_field(:id,'P63_OFF_STREET').set('A Street')
@@ie.text_field(:id,'P63_OFF_CITY').set('Supplier City')
@@ie.text_field(:id,'P63_OFF_POSTCODE').set('SU1 1SU')
@@ie.button(:value,'Next >').click
#wont bother setting a home address as we don't need to so we'll create the supplier
@@ie.button(:value,'Finish').click
assert(@@ie.contains_text('created successfully'),'MKTP not created correctly.')
end
#
#Test we can create a user (SUPPADMIN) in the system when logged on as MIPADMIN user.
#
def test_03_create_user_suppadmin
#@@ie.goto(LOGIN)
#we'll need to login as a MIPADMIN user
#login('advantica','password')
#Navigate to the page using the menu
#menu('Administration')
#menu('User Management')
#menu('Create Party')
#create a new party
@@ie.button(:id,'Create Another').click
#select the type of party to create
@@ie.select_list(:id,'P61_PRTY_TYPE').set('User')
# set the field values
#@@ie.text_field(:id,'').set('')
@@ie.text_field(:id,'P61_USERNAME').set('SuppAdmin1')
@@ie.text_field(:id,'P61_TITLE').set('Mr.')
@@ie.text_field(:id,'P61_FIRST_NAME').set('Supplier1')
@@ie.text_field(:id,'P61_LAST_NAME').set('Administrator')
@@ie.text_field(:id,'P61_COMMENTS').set('This is the administrator for Supplier1. Created for testing.')
@@ie.text_field(:id,'P61_PASSWORD').set('Passw0rd.')
@@ie.text_field(:id,'P61_REPEAT_PASSWORD').set('Passw0rd.')
#@@ie.checkbox(:id,'P61_EXPIRE_PWORD_0').set('') #Leave the user OPEN
@@ie.button(:value,'Next >').click
@@ie.wait
#Select a role for the party
@@ie.select_list(:id,'P62_PRTY_ROLE').set('User administrator')
@@ie.wait
@@ie.select_list(:id,'P62_USER_SUPPLIER').set('Supplier1 - SU1')
#fill in the contact details bits and bobs
@@ie.text_field(:id,'P62_PHONE').set('01234 567891')
@@ie.text_field(:id,'P62_FAX').set('01234 567891')
@@ie.text_field(:id,'P62_MOBILE').set('01234 567891')
@@ie.text_field(:id,'P62_EMAIL').set('supplier_admin@supplier1.org')
@@ie.button(:value,'Next >').click
#use the existing address for the supplier
@@ie.text_field(:id,'P63_SELECT_ADDRESS').set('SU1_OFFICE')
@@ie.button(:value,'Copy Address').click
@@ie.button(:value,'Next >').click
#wont bother setting a home address as we don't need to so we'll create the supplier administrator
@@ie.button(:value,'Finish').click
assert(@@ie.contains_text('created successfully'),'SUPPADMIN not created correctly.')
end
#
#Test we can create a user (AGENT) in the system when logged on as MIPADMIN user.
#
def test_04_create_user_agent
#@@ie.goto(LOGIN)
#we'll need to login as a MIPADMIN user
#login('advantica','password')
#Navigate to the page using the menu
#menu('Administration')
#menu('User Management')
#menu('Create Party')
#create a new party
@@ie.button(:name,'CreateAnother').click
#select the type of party to create
@@ie.select_list(:id,'P61_PRTY_TYPE').set('User')
# set the field values
#@@ie.text_field(:id,'').set('')
@@ie.text_field(:id,'P61_USERNAME').set('SuppAgent1')
@@ie.text_field(:id,'P61_TITLE').set('Mr')
@@ie.text_field(:id,'P61_FIRST_NAME').set('Agent1')
@@ie.text_field(:id,'P61_LAST_NAME').set('Test-Agent')
@@ie.text_field(:id,'P61_COMMENTS').set('This is an agent for Supplier1. Created for testing.')
@@ie.text_field(:id,'P61_PASSWORD').set('Passw0rd.')
@@ie.text_field(:id,'P61_REPEAT_PASSWORD').set('Passw0rd.')
#@@ie.checkbox(:id,'P61_EXPIRE_PWORD_0').set('') #Leave the user OPEN
@@ie.button(:value,'Next >').click
#Select a role for the party
@@ie.select_list(:id,'P62_PRTY_ROLE').set('Agent')
@@ie.wait
@@ie.select_list(:id,'P62_USER_SUPPLIER').set('Supplier1 - SU1')
@@ie.wait
@@ie.select_list(:id,'P62_SUPP_ADMIN').set('Supplier1 Administrator')
#fill in the contact details bits and bobs
@@ie.text_field(:id,'P62_PHONE').set('01234 567892')
@@ie.text_field(:id,'P62_FAX').set('01234 567892')
@@ie.text_field(:id,'P62_MOBILE').set('01234 567892')
@@ie.text_field(:id,'P62_EMAIL').set('agent1@supplier1.org')
@@ie.button(:value,'Next >').click
#use the existing address for the supplier
@@ie.text_field(:id,'P63_SELECT_ADDRESS').set('SU1_OFFICE')
@@ie.button(:value,'Copy Address').click
@@ie.button(:value,'Next >').click
#wont bother setting a home address as we don't need to so we'll create the supplier administrator
@@ie.button(:value,'Finish').click
assert(@@ie.contains_text('created successfully'),'AGENT not created correctly.')
end
#
#Test we can create a user (CS) in the system when logged on as MIPADMIN user.
#
def test_05_create_user_cs
#@@ie.goto(LOGIN)
#we'll need to login as a MIPADMIN user
#login('advantica','password')
#Navigate to the page using the menu
#menu('Administration')
#menu('User Management')
#menu('Create Party')
#create a new party
@@ie.button(:name,'CreateAnother').click
#select the type of party to create
@@ie.select_list(:id,'P61_PRTY_TYPE').set('User')
# set the field values
#@@ie.text_field(:id,'').set('')
@@ie.text_field(:id,'P61_USERNAME').set('CS1')
@@ie.text_field(:id,'P61_TITLE').set('Miss')
@@ie.text_field(:id,'P61_FIRST_NAME').set('Customer')
@@ie.text_field(:id,'P61_LAST_NAME').set('Services')
@@ie.text_field(:id,'P61_COMMENTS').set('This is a customer service for Supplier1. Created for testing.')
@@ie.text_field(:id,'P61_PASSWORD').set('Passw0rd.')
@@ie.text_field(:id,'P61_REPEAT_PASSWORD').set('Passw0rd.')
#@@ie.checkbox(:id,'P61_EXPIRE_PWORD_0').set('') #Leave the user OPEN
@@ie.button(:value,'Next >').click
#Select a role for the party
@@ie.select_list(:id,'P62_PRTY_ROLE').set('Customer Service operative')
@@ie.wait
@@ie.select_list(:id,'P62_USER_SUPPLIER').set('Supplier1 - SU1')
#fill in the contact details bits and bobs
@@ie.text_field(:id,'P62_PHONE').set('01234 567893')
@@ie.text_field(:id,'P62_FAX').set('01234 567893')
@@ie.text_field(:id,'P62_MOBILE').set('01234 567893')
@@ie.text_field(:id,'P62_EMAIL').set('cs1@metering.ng.co.uk')
@@ie.button(:value,'Next >').click
#create a customer services address
@@ie.text_field(:id,'P63_OFF_CODE').set('CS_OFFICE')
@@ie.text_field(:id,'P63_OFF_SUB_BUILD').set('1')
@@ie.text_field(:id,'P63_OFF_BUILDING').set('Metering House')
@@ie.text_field(:id,'P63_OFF_STREET').set('Meter Road')
@@ie.text_field(:id,'P63_OFF_CITY').set('Meter City')
@@ie.text_field(:id,'P63_OFF_POSTCODE').set('ME1 1ME')
@@ie.button(:value,'Next >').click
#wont bother setting a home address as we don't need to so we'll create the supplier administrator
@@ie.button(:value,'Finish').click
assert(@@ie.contains_text('created successfully'),'CS user not created correctly.')
end
#
#Test we can create a user (ICU) in the system when logged on as MIPADMIN user.
#
def test_06_create_user_icu
#@@ie.goto(LOGIN)
#we'll need to login as a MIPADMIN user
#login('advantica','password')
#Navigate to the page using the menu
#menu('Administration')
#menu('User Management')
#menu('Create Party')
#create a new party
@@ie.button(:name,'CreateAnother').click
#select the type of party to create
@@ie.select_list(:id,'P61_PRTY_TYPE').set('User')
# set the field values
#@@ie.text_field(:id,'').set('')
@@ie.text_field(:id,'P61_USERNAME').set('ICU1')
@@ie.text_field(:id,'P61_TITLE').set('Mrs')
@@ie.text_field(:id,'P61_FIRST_NAME').set('ICU')
@@ie.text_field(:id,'P61_LAST_NAME').set('User')
@@ie.text_field(:id,'P61_COMMENTS').set('This is an ICU user for Supplier1. Created for testing.')
@@ie.text_field(:id,'P61_PASSWORD').set('Passw0rd.')
@@ie.text_field(:id,'P61_REPEAT_PASSWORD').set('Passw0rd.')
#@@ie.checkbox(:id,'P61_EXPIRE_PWORD_0').set('') #Leave the user OPEN
@@ie.button(:value,'Next >').click
#Select a role for the party
@@ie.select_list(:id,'P62_PRTY_ROLE').set('Quotation operative')
@@ie.wait
@@ie.select_list(:id,'P62_USER_SUPPLIER').set('Supplier1 - SU1')
#fill in the contact details bits and bobs
@@ie.text_field(:id,'P62_PHONE').set('01234 567894')
@@ie.text_field(:id,'P62_FAX').set('01234 567894')
@@ie.text_field(:id,'P62_MOBILE').set('01234 567894')
@@ie.text_field(:id,'P62_EMAIL').set('icu1@metering.ng.co.uk')
@@ie.button(:value,'Next >').click
#create a customer services address
@@ie.text_field(:id,'P63_OFF_CODE').set('ICU_OFFICE')
@@ie.text_field(:id,'P63_OFF_SUB_BUILD').set('2')
@@ie.text_field(:id,'P63_OFF_BUILDING').set('Metering House')
@@ie.text_field(:id,'P63_OFF_STREET').set('Meter Road')
@@ie.text_field(:id,'P63_OFF_CITY').set('Meter City')
@@ie.text_field(:id,'P63_OFF_POSTCODE').set('ME2 2ME')
@@ie.button(:value,'Next >').click
#wont bother setting a home address as we don't need to so we'll create the supplier administrator
@@ie.button(:value,'Finish').click
assert(@@ie.contains_text('created successfully'),'ICU user not created correctly.')
end
#
#Test we can create a market participant (SUPPLIER) in the system when logged on as MIPADMIN user.
#
def test_07_create_manu
@@ie.goto(LOGIN)
#we'll need to login as a MIPADMIN user
login('advantica','password')
#Navigate to the page using the menu
menu('Administration')
menu('User Management')
#menu('Create Party')
#create a new party
@@ie.button(:name,'Create New Party').click
#select the type of party to create
@@ie.select_list(:id,'P61_PRTY_TYPE').set('Manufacturer')
# set the field values
#@@ie.text_field(:id,'').set('')
@@ie.text_field(:id,'P61_NAME').set('Manufacturer1')
@@ie.text_field(:id,'P61_MANU_REF').set('Manu1')
@@ie.text_field(:id,'P61_DESCRIPTION').set('Test manufacturer created for testing.')
@@ie.button(:value,'Next >').click
#Select a role for the party
@@ie.select_list(:id,'P62_PRTY_ROLE').set('External organization')
@@ie.wait
@@ie.select_list(:id,'P62_ORG_SUPPLIER').set('Supplier1 - SU1')
@@ie.wait
#fill in the contact details bits and bobs
@@ie.text_field(:id,'P62_PHONE').set('01234 567890')
@@ie.text_field(:id,'P62_FAX').set('01234 567890')
@@ie.text_field(:id,'P62_MOBILE').set('01234 567890')
@@ie.text_field(:id,'P62_EMAIL').set('manu1@manufacturer1.org')
@@ie.button(:value,'Next >').click
#create a new address for the supplier
@@ie.text_field(:id,'P63_OFF_CODE').set('MANU1_OFFICE')
@@ie.text_field(:id,'P63_OFF_SUB_BUILD').set('1')
@@ie.text_field(:id,'P63_OFF_BUILDING').set('Manufacturer1')
@@ie.text_field(:id,'P63_OFF_STREET').set('A Street')
@@ie.text_field(:id,'P63_OFF_CITY').set('Manufacturer City')
@@ie.text_field(:id,'P63_OFF_POSTCODE').set('MA1 1MA')
@@ie.button(:value,'Next >').click
#wont bother setting a home address as we don't need to so we'll create the supplier
@@ie.button(:value,'Finish').click
assert(@@ie.contains_text('created successfully'),'MANU not created correctly.')
end
end
class Test_08_SUPPADMIN_party_management< Test::Unit::TestCase
#
#Test we can create a user (AGENT) in the system when logged on as SUPPADMIN user.
#
def test_01_create_user_agent
@@ie.goto(LOGIN)
#we'll need to login as a SUPPADMIN user
#use the one created in test 3 above
login('SuppAdmin1','Passw0rd.')
#Navigate to the page using the menu
menu('Administration')
menu('User Management')
menu('Create Party')
#select the type of party to create
@@ie.select_list(:id,'P61_PRTY_TYPE').set('User')
# set the field values
#@@ie.text_field(:id,'').set('')
@@ie.text_field(:id,'P61_USERNAME').set('SuppAgent2')
@@ie.text_field(:id,'P61_TITLE').set('Mr')
@@ie.text_field(:id,'P61_FIRST_NAME').set('Agent2')
@@ie.text_field(:id,'P61_LAST_NAME').set('Test-Agent')
@@ie.text_field(:id,'P61_COMMENTS').set('This is an agent for Supplier1. Created for testing by SUPPADMIN user.')
@@ie.text_field(:id,'P61_PASSWORD').set('Passw0rd.')
@@ie.text_field(:id,'P61_REPEAT_PASSWORD').set('Passw0rd.')
@@ie.checkbox(:id,'P61_EXPIRE_PWORD_0').set('1')
@@ie.button(:value,'Next >').click
#Select a role for the party
@@ie.select_list(:id,'P62_PRTY_ROLE').set('Agent')
@@ie.wait
@@ie.select_list(:id,'P62_USER_SUPPLIER').set('Supplier1 - SU1')
@@ie.wait
@@ie.select_list(:id,'P62_SUPP_ADMIN').set('Supplier1 Administrator')
#fill in the contact details bits and bobs
@@ie.text_field(:id,'P62_PHONE').set('01234 567810')
@@ie.text_field(:id,'P62_FAX').set('01234 567810')
@@ie.text_field(:id,'P62_MOBILE').set('01234 567810')
@@ie.text_field(:id,'P62_EMAIL').set('agent2@supplier1.org')
@@ie.button(:value,'Next >').click
#use the existing address for the supplier
@@ie.text_field(:id,'P63_SELECT_ADDRESS').set('SU1_OFFICE')
@@ie.button(:value,'Copy Address').click
@@ie.button(:value,'Next >').click
#wont bother setting a home address as we don't need to so we'll create the supplier administrator
@@ie.button(:value,'Finish').click
assert(@@ie.contains_text('created successfully'),'AGENT not created correctly.')
end
end
class Test_09_edit_parties< Test::Unit::TestCase
#
#Test we can edit a user (AGENT) in the system when logged on as MIPADMIN user.
#
def test_01_edit_parties_screen_appears
@@ie.goto(LOGIN)
#we'll need to login as a MIPADMIN user
login('advantica','password')
#Navigate to the page using the menu
menu('Administration')
menu('User Management')
menu('Edit Parties')
#simple screen, only 1 object
assert(@@ie.select_list(:id,'P65_PRTY_TYPE').exists?,'Could not find P65_PRTY_TYPE select list')
#check user fields
@@ie.link(:name,'Edit Current User').click
assert(@@ie.button(:value,'Cancel').exists?,'Could not find Cancel button')
assert(@@ie.button(:value,'Delete').exists?,'Could not find Delete button')
assert(@@ie.button(:value,'Apply Changes').exists?,'Could not find Apply Changes button')
assert(@@ie.select_list(:id,'P66_STATUS').exists?,'Could not find P66_STATUS select list')
assert(@@ie.text_field(:id,'P66_FIRST_NAME').exists?,'Could not find P66_FIRST_NAME field')
assert(@@ie.text_field(:id,'P66_LAST_NAME').exists?,'Could not find P66_LAST_NAME field')
assert(@@ie.text_field(:id,'P66_PERSONAL_TITLE').exists?,'Could not find P66_PERSONAL_TITLE field')
assert(@@ie.text_field(:id,'P66_COMMENTS').exists?,'Could not find P66_COMMENTS field')
assert(@@ie.button(:value,'Add Address').exists?,'Could not find Add Address button')
assert(@@ie.text_field(:id,'P66_TELEPHONE').exists?,'Could not find P66_TELEPHONE field')
assert(@@ie.text_field(:id,'P66_MOBILE').exists?,'Could not find P66_MOBILE field')
assert(@@ie.text_field(:id,'P66_FAX').exists?,'Could not find P66_FAX field')
assert(@@ie.text_field(:id,'P66_EMAIL').exists?,'Could not find P66_EMAIL field')
@@ie.button(:value,'Cancel').click
#check market participant fields
@@ie.select_list(:id,'P65_PRTY_TYPE').set('Market Participant')
@@ie.link(:name,'Edit Supplier1 SU1').click
assert(@@ie.button(:value,'Cancel').exists?,'Could not find Cancel button')
assert(@@ie.button(:value,'Delete').exists?,'Could not find Delete button')
assert(@@ie.button(:value,'Apply Changes').exists?,'Could not find Apply Changes button')
assert(@@ie.text_field(:id,'P66_SHORTCODE').exists?,'Could not find P66_SHORTCODE field')
assert(@@ie.text_field(:id,'P66_NAME').exists?,'Could not find P66_NAME field')
assert(@@ie.text_field(:id,'P66_MKTP_REF').exists?,'Could not find P66_MKTP_REF field')
assert(@@ie.text_field(:id,'P66_LT_7B_CONTRACT_REF').exists?,'Could not find P66_LT_7B_CONTRACT_REF field')
assert(@@ie.text_field(:id,'P66_GT_7B_CONTRACT_REF').exists?,'Could not find P66_GT_7B_CONTRACT_REF field')
assert(@@ie.text_field(:id,'P66_ADVERSARIAL_CONTRACT_REF').exists?,'Could not find P66_ADVERSARIAL_CONTRACT_REF field')
assert(@@ie.button(:value,'Add Address').exists?,'Could not find Add Address button')
assert(@@ie.text_field(:id,'P66_TELEPHONE').exists?,'Could not find P66_TELEPHONE field')
assert(@@ie.text_field(:id,'P66_MOBILE').exists?,'Could not find P66_MOBILE field')
assert(@@ie.text_field(:id,'P66_FAX').exists?,'Could not find P66_FAX field')
assert(@@ie.text_field(:id,'P66_EMAIL').exists?,'Could not find P66_EMAIL field')
@@ie.button(:value,'Cancel').click
#check manufacturer fields
@@ie.select_list(:id,'P65_PRTY_TYPE').set('Manufacturer')
@@ie.link(:name,'Edit Manufacturer1 ').click
assert(@@ie.button(:value,'Cancel').exists?,'Could not find Cancel button')
assert(@@ie.button(:value,'Delete').exists?,'Could not find Delete button')
assert(@@ie.button(:value,'Apply Changes').exists?,'Could not find Apply Changes button')
assert(@@ie.text_field(:id,'P66_MANU_REF').exists?,'Could not find P66_MANU_REF field')
assert(@@ie.text_field(:id,'P66_NAME').exists?,'Could not find P66_NAME field')
assert(@@ie.text_field(:id,'P66_DESCRIPTION').exists?,'Could not find P66_DESCRIPTION field')
assert(@@ie.button(:value,'Add Address').exists?,'Could not find Add Address button')
assert(@@ie.text_field(:id,'P66_TELEPHONE').exists?,'Could not find P66_TELEPHONE field')
assert(@@ie.text_field(:id,'P66_MOBILE').exists?,'Could not find P66_MOBILE field')
assert(@@ie.text_field(:id,'P66_FAX').exists?,'Could not find P66_FAX field')
assert(@@ie.text_field(:id,'P66_EMAIL').exists?,'Could not find P66_EMAIL field')
@@ie.button(:value,'Add Address').click
assert(@@ie.select_list(:id,'P69_SELECT_ADDRESS').exists?,'Could not find P69_SELECT_ADDRESS select list')
assert(@@ie.button(:value,'Copy Address').exists?,'Could not find Copy Address button')
assert(@@ie.text_field(:id,'P69_ADDR_CODE').exists?,'Could not find P69_ADDR_CODE field')
assert(@@ie.select_list(:id,'P69_ADDR_TYPE').exists?,'Could not find P69_ADDR_TYPE select list')
assert(@@ie.text_field(:id,'P69_ADDR_SUB_BUILDING').exists?,'Could not find P69_ADDR_SUB_BUILDING field')
assert(@@ie.text_field(:id,'P69_ADDR_BUILDING').exists?,'Could not find P69_ADDR_BUILDING field')
assert(@@ie.text_field(:id,'P69_ADDR_STREET').exists?,'Could not find P69_ADDR_STREET field')
assert(@@ie.text_field(:id,'P69_ADDR_CITY').exists?,'Could not find P69_ADDR_CITY field')
assert(@@ie.text_field(:id,'P69_ADDR_POSTCODE').exists?,'Could not find P69_ADDR_POSTCODE field')
assert(@@ie.button(:value,'Save').exists?,'Could not find Save button')
end
def test_02_edit_users
@@ie.goto(LOGIN)
#we'll need to login as a MIPADMIN user
login('advantica','password')
#Navigate to the page using the menu
menu('Administration')
menu('User Management')
menu('Edit Parties')
@@ie.link(:name,'Edit Current User').click
@@ie.text_field(:id,'P66_FIRST_NAME').set('Updated')
@@ie.text_field(:id,'P66_TELEPHONE').set('01234 567899')
@@ie.button(:value,'Apply Changes').click
assert(@@ie.contains_text('Action Processed.'),'Party not updated correctly')
#edit a different user
@@ie.goto(EDIT_PARTIES)
@@ie.select_list(:id,'P65_PRTY_TYPE').set('User')
@@ie.link(:name,'Edit SuppAgent1').click
@@ie.text_field(:id,'P66_TELEPHONE').set('01234 567899')
@@ie.button(:value,'Apply Changes').click
assert(@@ie.contains_text('Action Processed.'),'Party not updated correctly')
@@ie.goto(LOGIN)
#we'll need to login as a SUPPADMIN user
login('SuppAdmin1','Passw0rd.')
#Navigate to the page using the menu
menu('Administration')
menu('User Management')
menu('Edit Parties')
@@ie.link(:name,'Edit Current User').click
@@ie.text_field(:id,'P66_FIRST_NAME').set('Updated')
@@ie.text_field(:id,'P66_TELEPHONE').set('01234 567899')
@@ie.button(:value,'Apply Changes').click
assert(@@ie.contains_text('Action Processed.'),'Party not updated correctly')
@@ie.goto(LOGIN)
#we'll need to login as a SUPPADMIN user
login('Agent1','Passw0rd.')
#Navigate to the page using the menu
menu('Administration')
menu('User Management')
menu('Edit Parties')
@@ie.link(:name,'Edit Current User').click
@@ie.text_field(:id,'P66_FIRST_NAME').set('Updated')
@@ie.text_field(:id,'P66_TELEPHONE').set('01234 567800')
@@ie.button(:value,'Apply Changes').click
assert(@@ie.contains_text('Action Processed.'),'Party not updated correctly')
@@ie.link(:name,'Edit SuppAgent1').click
@@ie.text_field(:id,'P66_TELEPHONE').set('01234 567809')
@@ie.button(:value,'Apply Changes').click
assert(@@ie.contains_text('Action Processed.'),'Party not updated correctly')
end
def test_03_edit_supplier
@@ie.goto(LOGIN)
#we'll need to login as a MIPADMIN user
login('advantica','password')
#Navigate to the page using the menu
menu('Administration')
menu('User Management')
menu('Edit Parties')
#edit a supplier, the one created above for ease...
@@ie.select_list(:id,'P65_PRTY_TYPE').set('Market Participant')
@@ie.link(:name,'Edit Supplier1 SU1').click
#add an address
@@ie.button(:value,'Add Address').click
@@ie.text_field(:id,'P69_ADDR_CODE').set('SU1_OFFICE2')
@@ie.select_list(:id,'P69_ADDR_TYPE').set('OFFICE')
@@ie.text_field(:id,'P69_ADDR_SUB_BUILDING').set('2')
@@ie.text_field(:id,'P69_ADDR_BUILDING').set('Building 2')
@@ie.text_field(:id,'P69_ADDR_STREET').set('Supplier Street')
@@ie.text_field(:id,'P69_ADDR_CITY').set('Supplierton')
@@ie.text_field(:id,'P69_ADDR_POSTCODE').set('SU1 2SU')
@@ie.button(:value,'Save').click
@@ie.button(:value,'Apply Changes').click
assert(@@ie.contains_text('Action Processed.'),'Party not updated correctly')
end
end