Prerequisites for Tests:
-----------------------
Create test wikipages dir, and copy all existing wikipages into it.
Configure jspwiki.properties to use this pages directory.
For container-managed auth:
Set up tomcat-users with these users:
Configure container for SSL.
Teardown for Tests:
------------------
In test pages directory:
- Copy fresh Main.txt.
- Delete Main.properties
- Delete Main-att
- Delete page GroupTest.txt
- Delete pages NewBlog*.*
Remove all users from userdatabase.xml.
Flush cookies from browser.
Custom Auth Tests:
-----------------
Start JSPWiki with custom auth.
As anonymous user:
1) Anonymous page view test
a. Go to home page (/ or Wiki.jsp). Should show Main
b. Click on More info... then 'Page info' tab. Should not see the rename page field.
c. View Page Index (Wiki.jsp?page=PageIndex)
d. Click 'Find Pages' (Search.jsp): find 'security': 6 results
2) Anonymous page modification tests
a. Click on Main. Edit; add "Anonymous test" to top and save. Click on More Info. See saved time.
b. Try renaming page: Rename.jsp?page=Main. Should be redirected to login page.
Go to Main again. Page should still be available.
c. Add a comment to Main (http://localhost:8080/content/Comment.jsp?page=Main)
This is an anonymous comment.
Save. See the comment, with IP address.
d. Upload file to Main. Should be allowed. See it on the page.
e. Try deleting page: Delete.jsp?page=Main. Should be redirected to login page.
Go to Main again. Page should still be available.
3) Registration test
a. Click on 'My Prefs'
Create new user:
loginname: arj
password: password
wiki name: AndyJ
full name: Andrew Jaquith
email: arj@example.com
Save. Go to Main
Should see "G'day, Andrew Jaquith (authenticated)"
b. Click on 'My Prefs'.
Should see login name, wiki name, full name read-only; password
and email editable
4) Authenticated page modification tests
a. Click on Main. Edit; add "Authenticated test" to top and save.
Click on More Info. See saved time.
b. Navigate to Main. Click Management tab. See the rename page field.
Rename page to Main2 and save. Should see Main2 at top.
Rename page back to Main. Should see Main at top.
c. Add a comment to Main (http://localhost:8080/content/Comment.jsp?page=Main)
This is an authenticated comment.
Save. See the comment, with the wikiName Andrew Jaquith automatically populated (obtained from login)
d. Upload file to Main. Should be allowed. See it on the page.
5) Authenticated group creation
a. In action bar, click NewGroup.jsp. Create new group with name Test,
with members Andrew Jaquith. Save.
Fetch GroupTest. Should see "This is a wiki group. Edit this page
to see its members."
b. Edit GroupTest. Append ''Group description goes here...''. Save.
Verify new text appears.
6) Access control test
a. Log out & clear cookies. Try accessing GroupTest. Should redirect to Login page.
b. Login as arj. Should redirect to GroupTest and allow editing.
7) Blog tests
a. As arj, Create new page NewBlog. Add this text:
[{ALLOW view All}]
[{ALLOW edit AndyJ}]
This is my blog:
[{WeblogPlugin days=14}]
Click here to create a new blog: [{WeblogEntryPlugin}]
Save. Should succeeed.
b. Add a new blog entry:
>>>>>Note: the URL Constructor seems to be b0rked at the moment<<<<<<
!Test blog entry
This is my new blog.
Save. Should succeed. Go back to page NewBlog. See
TestBlogEntry
c. Log out & clear cookies. Navigate back to page NewBlog. See TestBlogEntry
Container-Managed Auth Tests:
----------------------------
As anonymous user:
1) Anonymous page view test
a. Go to home page (/ or Wiki.jsp). Should show Main
b. Click on Page Info. Should not see the rename page field.
c. View Page Index (Wiki.jsp?page=PageIndex)
d. Click 'Find Pages' (Search.jsp): find 'security': 6 results
2) Anonymous page modification tests
a. Try Editing page Main. Should be redirected to login page.
Go to Main again. Page should still be available.
b. Try renaming page: Rename.jsp?page=Main. Should be redirected to login page.
Go to Main again. Page should still be available.
c. Add a comment to Main (http://localhost:8080/content/Comment.jsp?page=Main)
Should redirect to login page.
d. Upload file to Main. Should redirect to login page.
e. Try deleting page: Delete.jsp?page=Main. Should be redirected to login page.
Go to Main again. Page should still be available.
3) Registration test
a. Click on UserPreferences.jsp page. Should be redirected to login page.
Log in as user arj, password tomcat.
Create new user:
wiki name: AndyJ
full name: Andrew Jaquith
email: arj@example.com
Save. Go to Main
Should see "G'day, AndyJ"
b. Click on My Prefs, then the Profile tab.
Should see login name, wiki name, full name read-only; password and email editable
4) Authenticated page modification tests
a. Click on Main. Edit; add "Authenticated test" to top and save.
Click on More Info. See saved time.
b. Navigate to Main. Click Management tab. See the rename page field.
Rename page to Main2 and save. Should see Main2 at top.
Rename page back to Main. Should see Main at top.
c. Add a comment to Main (http://localhost:8080/content/Comment.jsp?page=Main)
This is an authenticated comment.
Save. See the comment, with the wikiName AndyJ (obtained from login)
d. Upload file to Main. Should be allowed. See it on the page.
5) Authenticated group creation
a. Click NewGroup.jsp. Create new group with name Test,
with members Andrew Jaquith. Save.
Fetch GroupTest. Should see "This is a wiki group. Edit this page
to see its members."
b. Edit GroupTest. Append ''Group description goes here...''. Save.
Verify new text appears.
6) Access control test
a. Log out & clear cookies. Try accessing GroupTest. Should redirect to Login page.
b. Login as arj. Should redirect to GroupTest and allow editing.
7) Blog tests
a. As arj, create new page NewBlog. Add this text:
[{ALLOW view All}]
[{ALLOW edit AndyJ}]
This is my blog:
[{WeblogPlugin days=14}]
Click here to create a new blog: [{WeblogEntryPlugin}]
Save. Should succeeed.
b. Add a new blog entry:
!Test blog entry
This is my new blog.
Save. Should succeed. Go back to page NewBlog. See TestBlogEntry
c. Log out. Navigate back to page NewBlog. See TestBlogEntry