Mink icon indicating copy to clipboard operation
Mink copied to clipboard

Add support for retrieving all cookies, not just one cookie by name

Open bkosborne opened this issue 6 years ago • 0 comments

The DriverInterface currently has method getCookie($name) {}, but it lacks getCookies(). This would be helpful in cases where the name of the cookie needed is not known.

I understand this would be a BC break, so I think it would have to be in version 2.0.0. I believe most drivers support such a method of cookie retrieval. Goutte/Chrome certainly do.

My use case:

I'm trying to write a behat test for a Drupal 8 site and in one of my step definitions, I need to make a separate request via Guzzle to the Drupal site using the same session that exists within the driver. Specifically, I'm writing a test that downloads a file from the site to verify that it could do that successfully. It doesn't seem possible to do that properly by using the driver directly, so I'm trying to use Guzzle to download the file. I need to copy the session cookies from the driver to the Guzzle request. The problem is that Drupal uses a special hash as the name of the cookie. I can reproduce the calculation to create the hash, but it makes my tests a bit brittle.

bkosborne avatar Nov 05 '18 00:11 bkosborne