Search code examples
cookiesautomated-testssession-cookiese2e-testingtestcafe

testcafe cookies session-cookies


I'm using testcafe to test our site that needs authentication. Things work fine but I noticed the cookies are not set correctly when I inspect the page during the test. all the cookie name seems to be in the format of:

w|ErNwuuhVT|KEYCLOAK_SESSION|xxx.abc.def|%2Fauth%2Frealms%2Fdomain%2F|jxd35gq0|jxchpvfp

which is not the correct format that our site uses when you just browse to the site itself. why is it pipe delimited? is there a reason why testcafe saves the cookies in that format? also, the names of the cookies don't match what's expected. although we can log in its causing some other resources to not load correctly.
another issue that the cookie is supposed to be saved under the domain of ".abc.def" however testcafe saves the cookie in the full domain which would be something like "xxx.abc.def" which also causes problems. why does testcafe do this? Is it b/c of the hammerhead proxy?


Solution

  • TestCafe uses a URL-rewritten proxy internally. This proxy is forced to handle cookies manually because the URL of the tested website is changed during test execution. If there are problems related to the process of applying cookies, please report an issue to the TestCafe repository.