Some code in our tested app refers to a cookie set by the client at initialisation time. This means that we need to set a cookie before loading the page. It looks like test hooks run after the page is loaded, at which point the library that checks the cookie has already been initialised; fixture hooks don’t have access to the
TestController and (as far as I can tell) can’t set cookies.
In my attempts, I find a cookie with a mangled name in the Chrome debugger, but maybe this is just a ‘local’ representation rather than the cookie the tests actually run with. (For reference, I try to set
document.cookie="witcrypt.subtle=disabled" and end up with something with a numeric prefix like
"4328943|witcrypt.subtle" and apparently an empty value.)
How can I set a cookie—whether via API,
ClientFunction, or by pre-specifying headers—so that the cookie is set on page load?