Test Cookie

WARNING! You can only run this test off of a "real" webserver (i.e. over http); you can't run this test directly off of the file system.

Also note that the paths used in this test don't have to actually exist; we can get 404 errors on every one of these pages but still successfully test the cookie functionality.

Test Cookie
storeEval | parseUrl(canonicalize(absolutify("html", selenium.browserbot.baseUrl))).pathname; | base
echo | ${base} |
open | ${base}/path1/cookie1.html |
deleteCookie | testCookieWithSameName | /
deleteCookie | addedCookieForPath1 | ${base}/path1/
assertCookie |  |
open | ${base}/path2/cookie2.html |
deleteCookie | testCookieWithSameName | ${base}/path2/
deleteCookie | addedCookieForPath2 | ${base}/path2/
assertCookie |  |

open | ${base}/path1/cookie1.html |
createCookie | addedCookieForPath1=new value1 |
createCookie | addedCookieForPath2=new value2 | path=${base}/path2/, max_age=60
open | ${base}/path1/cookie1.html |
verifyCookie | regex:addedCookieForPath1=new value1 |
verifyNotCookie | regex:testCookie |
verifyNotCookie | regex:addedCookieForPath2 |
deleteCookie | addedCookieForPath1 | ${base}/path1/
verifyCookie |  |
open | ${base}/path2/cookie2.html |
verifyCookie | addedCookieForPath2=new value2 |
verifyNotCookie | regex:addedCookieForPath1 |
deleteCookie | addedCookieForPath2 | ${base}/path2/
verifyCookie |  |

Testing creating cookies with same name but diffrent paths

createCookie | testCookieWithSameName=new value1 | path=/
createCookie | testCookieWithSameName=new value2 | path=${base}/path2/
open | ${base}/path1/cookie1.html |
verifyCookie | testCookieWithSameName=new value1 |
open | ${base}/path2/cookie2.html |
verifyCookie | regex:testCookieWithSameName=new value1 |
verifyCookie | regex:testCookieWithSameName=new value2 |
deleteCookie | testCookieWithSameName | ${base}/path2/
open | ${base}/path2/cookie2.html |
verifyCookie | testCookieWithSameName=new value1 |
verifyNotCookie | regex:testCookieWithSameName=new value2 |