JSPWiki Test Rename Profile
store /@selenium.context@ baseUrl
store javascript{'Test Rename Profile Page '+new Date().getTime()} page
store javascript{'TestRenameProfileUser'+new Date().getTime()} user
store janne TestUsername
store myP@5sw0rd TestPassword
store ${baseUrl}/Wiki.jsp?page=${page} viewurl
store ${baseUrl}/Edit.jsp?page=${page} editurl
store ${baseUrl}/Group.jsp? viewgroupurl
store ${baseUrl}/NewGroup.jsp? newgroupurl
store ${baseUrl}/UserPreferences.jsp?redirect=Main&tab=profile prefsurl
store ${baseUrl}/Login.jsp loginurl
store ${baseUrl}/Logout.jsp logouturl
store This page was created with an ACL by ${user} PageContent
Create a new user and group (and log in) -- at the moment, this ALWAYS fails for container-managed tests.
open ${loginurl}?tab=profile  
type loginname ${user}
type password password
type password2 password
type fullname ${user}
clickAndWait ok
clickAndWait link=Log out  
open ${loginurl}  
type j_username ${TestUsername}
type j_password ${TestPassword}
clickAndWait submitlogin  
Create a page with a view ACL restricted to the new user
open ${editurl}  
verifyTitle JSPWiki: Edit: ${page}  
verifyElementPresent ok
verifyElementPresent id=editorarea
type id=editorarea [{ALLOW edit ${user} }]
${PageContent}
clickAndWait ok  
Anonymous editing should fail
open ${logouturl}  
open ${editurl}  
verifyTextPresent Please sign in
Now log in as the test user and view/edit it successfully
open ${loginurl}  
type j_username ${user}
type j_password password
clickAndWait submitlogin  
open ${viewurl}  
verifyTitle JSPWiki: ${page}  
verifyTextPresent ${PageContent}  
open ${editurl}  
verifyTitle JSPWiki: Edit: ${page}  
Verify that our ACL test is present (note the extra linebreak at the end of the text
verifyElementPresent ok
verifyElementPresent id=editorarea
verifyValue id=editorarea [{ALLOW edit ${user} }]
${PageContent}
OK -- now that we've got a user, a protected page and a group successfully set up, let's change the profile name
open ${prefsurl}  
verifyElementPresent css=form#editProfile input[name="ok"]
type fullname Renamed${user}
type loginname Renamed${user}
clickAndWait css=form#editProfile input[name="ok"]
Now, the main page should show the new authenticated user name
verifyTitle JSPWiki: Main  
verifyTextPresent G’day  
verifyElementPresent link=Renamed${user}  
verifyTextPresent (authenticated)  
When we navigate to the protected page, the ACL should have the NEW name in it
open ${editurl}  
verifyTitle JSPWiki: Edit: ${page}  
assertValue id=editorarea [{ALLOW edit Renamed${user}}]

${PageContent}
clickAndWait link=Log out