Page MenuHomePhabricator

Phester: support for cookie jars
Closed, InvalidPublic

Description

When testing endpoints that make extensive use of cookies to maintain state, we'll want a mechnism to provide standard client behavior for cookies, while still isolating tests from each other. There are two parts to this: fixtures capturing and exposing cookie jars for re-use in tests, and each test having a separate cookie jar optionally pre-populated with cookies from a fixture. In concrete terms:

  • fixtures may enable the use of cookies using a use-cookies flag, meaning that cookies are passed implicitly between the requests of the fixture's interaction sequence (all requests of the fixture use the same cookie jar). The cookie jar used by the fixture will be made available to tests using the import-cookies mechanism described below.
  • tests may also enable cookies, meaning that cookies are passed implicitly between the requests of the test's interaction sequence (all requests of a test use the same cookie jar, different tests use different cookie jars).
  • tests may pre-populate their cookie jar with cookies exposed by a fixture, using the import-cookies key (or some such), giving the name of the fixture they want to import cookies from.
  • TBD: how to handle cookies set by a test suite's setup