```
class ExampleTest extends TestCase
{
    public function setUp()
    {
        parent::setUp();
        $this->base_url = config('app.url');

        $response = $this->post($this->base_url . '/auth/login', [
                'username' => 'root',
                'password' => '123',
            ]);

        // how to get the login session cookie?
    }

    public function testStep1()
    {
        // how to set the login session to this POST request?

        $response = $this->post($this->base_url . '/step1', [
                'attr_1' => 'foo',
                'attr_2' => 'bar',
            ]);
        ...
    }

    public function testStep2()
    {
        // how to set the login session to this POST request?

        $response = $this->post($this->base_url . '/step2', [
                'attr_1' => 'abc',
                'attr_2' => 'xyz',
            ]);
        ...
    }
}

```

From the sample code above, what I want to achieve is `testStep1` & `testStep2` must in order *(wizard to create something)*. Thus, I must maintain the same session.

Is it possible to achieve?

Edit 2018-07-10 14:51 UTC+8
---------------------------

I've tried the output after call the `/auth/login`, the value of `$response->headers->getCookies()` is

```
array:1 [
  0 => Symfony\Component\HttpFoundation\Cookie {#940
    #name: "XSRF-TOKEN"
    #value: "eyJpdiI6IjQwUKxYnZlQ0J3N1B0Vkp4VjBEWVE9PSIsInZhbHVlIj782RKOUh2UFhONFwvaVRPUm56YkJ1ekxxSXlCTmtYSFNyRUF3NTdCTWhBMHhEQis1VVU0OUFcL3pKQUcybTFwQjdad1I1em02V1d4bVhDZWR2NFluUTlxdz09IiwibWFjIjoiZWRjYjk2NWI1MTU3YmJlMGEwMDdiNjNkYmVkMjBjMWU3NTRmZjE5NmMyM2EwOTZlNWJmZmYwMmRmYmExMWE1MSJ9"
    #domain: null
    #expire: 1531218886
    #path: "/"
    #secure: false
    #httpOnly: false
    -raw: false
    -sameSite: null
  }
]

```

and the value of `$response` is

```
Illuminate\Foundation\Testing\TestResponse {#843
  +baseResponse: Illuminate\Http\RedirectResponse {#1040
    #request: Illuminate\Http\Request {#856
      #json: null
      #convertedFiles: null
      #userResolver: Closure {#916
        class: "Illuminate\Auth\AuthServiceProvider"
        this: Illuminate\Auth\AuthServiceProvider {#52 …}
        parameters: {
          $guard: {
            default: null
          }
        }
        use: {
          $app: Illuminate\Foundation\Application {#19 …}
        }
        file: "./vendor/laravel/framework/src/Illuminate/Auth/AuthServiceProvider.php"
        line: "85 to 87"
      }
      #routeResolver: Closure {#860
        class: "Illuminate\Routing\Router"
        this: Illuminate\Routing\Router {#167 …}
        use: {
          $route: Illuminate\Routing\Route {#204 …}
        }
        file: "./vendor/laravel/framework/src/Illuminate/Routing/Router.php"
        line: "527 to 529"
      }
      +attributes: Symfony\Component\HttpFoundation\ParameterBag {#870
        #parameters: []
      }
      +request: Symfony\Component\HttpFoundation\ParameterBag {#867
        #parameters: array:2 [
          "username" => "root"
          "password" => "123"
        ]
      }
      +query: Symfony\Component\HttpFoundation\ParameterBag {#911
        #parameters: []
      }
      +server: Symfony\Component\HttpFoundation\ServerBag {#871
        #parameters: array:17 [
          "SERVER_NAME" => "localhost.com"
          "SERVER_PORT" => 80
          "HTTP_HOST" => "localhost.com"
          "HTTP_USER_AGENT" => "Symfony/3.X"
          "HTTP_ACCEPT" => "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"
          "HTTP_ACCEPT_LANGUAGE" => "en-us,en;q=0.5"
          "HTTP_ACCEPT_CHARSET" => "ISO-8859-1,utf-8;q=0.7,*;q=0.7"
          "REMOTE_ADDR" => "127.0.0.1"
          "SCRIPT_NAME" => ""
          "SCRIPT_FILENAME" => ""
          "SERVER_PROTOCOL" => "HTTP/1.1"
          "REQUEST_TIME" => 1531204718
          "PATH_INFO" => ""
          "REQUEST_METHOD" => "POST"
          "CONTENT_TYPE" => "application/x-www-form-urlencoded"
          "REQUEST_URI" => "/auth/login"
          "QUERY_STRING" => ""
        ]
      }
      +files: Symfony\Component\HttpFoundation\FileBag {#878
        #parameters: []
      }
      +cookies: Symfony\Component\HttpFoundation\ParameterBag {#869
        #parameters: []
      }
      +headers: Symfony\Component\HttpFoundation\HeaderBag {#913
        #headers: array:6 [
          "host" => array:1 [
            0 => "localhost.com"
          ]
          "user-agent" => array:1 [
            0 => "Symfony/3.X"
          ]
          "accept" => array:1 [
            0 => "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"
          ]
          "accept-language" => array:1 [
            0 => "en-us,en;q=0.5"
          ]
          "accept-charset" => array:1 [
            0 => "ISO-8859-1,utf-8;q=0.7,*;q=0.7"
          ]
          "content-type" => array:1 [
            0 => "application/x-www-form-urlencoded"
          ]
        ]
        #cacheControl: []
      }
      #content: null
      #languages: null
      #charsets: null
      #encodings: null
      #acceptableContentTypes: null
      #pathInfo: "/auth/login"
      #requestUri: "/auth/login"
      #baseUrl: ""
      #basePath: null
      #method: "POST"
      #format: null
      #session: Illuminate\Session\EncryptedStore {#924
        #encrypter: Illuminate\Encryption\Encrypter {#919
          #key: b"A╦k>ú8f\x10─ÌÜ8ØýxK\x01²┬Íî·»├\x1A³0▒S┘Ì"
          #cipher: "AES-256-CBC"
        }
        #id: "XPMgecNkwFHbZbujhiuEaBqgMqFTLIqsuIzyvXv"
        #name: "laravel_cookie"
        #attributes: array:11 [
          "_token" => "5lcOcLk9AqvSlWyLdHMKba1lJQ1UqD2rBBVCSav"
          "locale" => "en"
          "_previous" => array:1 [
            "url" => "http://localhost.com/auth/login"
          ]
          "_flash" => array:2 [
            "old" => []
            "new" => []
          ]
          "sess_user_id" => 123
          "sess_user_firstname" => "Foo"
          "sess_user_lastname" => "Bar"
          "sess_role" => "admin"
          "login_web_59ba36add234f940abcf014c987ea4e30989d" => 123
        ]
        #handler: Symfony\Component\HttpFoundation\Session\Storage\Handler\NullSessionHandler {#925
          -sessionName: null
          -prefetchId: null
          -prefetchData: null
          -newSessionId: null
          -igbinaryEmptyData: "\x00\x00\x00\x02\x14\x00"
        }
        #started: false
      }
      #locale: null
      #defaultLocale: "en"
      -isHostValid: true
      -isForwardedValid: true
      basePath: ""
      format: "html"
    }
    #session: Illuminate\Session\EncryptedStore {#924}
    #targetUrl: "http://localhost.com/dashboard"
    +headers: Symfony\Component\HttpFoundation\ResponseHeaderBag {#1039
      #computedCacheControl: array:2 [
        "no-cache" => true
        "private" => true
      ]
      #cookies: array:1 [
        "" => array:1 [
          "/" => array:1 [
            "XSRF-TOKEN" => Symfony\Component\HttpFoundation\Cookie {#940
              #name: "XSRF-TOKEN"
              #value: "eyJpdiI6IjVyVmRNSmlcL1dYK0VOdiwj8RxamZBPT0iLCJ2YWx1ZSI6IjNSQWFzcVllSEIrSYwZnNNbk1vZ1NERVc2UVdJeGs91D6UG5hNGlHUmRnendJOUVtUnA3Rnk0TnVLYmI5UnJXSTlZR3dxS0wxMElmOFlaWDMzdG9RPT0iLCJtYWMiOiI0ZTZlNTAwNjFkZWFkOTEwN2M1Y2EzMGRjOWMzMmU4NzEzNmM5NWU2MzhhODFjOGJkYTU0YmZlMTM3M2ExNmE3In0="
              #domain: null
              #expire: 1531219118
              #path: "/"
              #secure: false
              #httpOnly: false
              -raw: false
              -sameSite: null
            }
          ]
        ]
      ]
      #headerNames: array:5 [
        "cache-control" => "Cache-Control"
        "date" => "Date"
        "location" => "Location"
        "content-type" => "Content-Type"
        "set-cookie" => "Set-Cookie"
      ]
      #headers: array:4 [
        "cache-control" => array:1 [
          0 => "no-cache, private"
        ]
        "date" => array:1 [
          0 => "Tue, 10 Jul 2018 06:38:38 GMT"
        ]
        "location" => array:1 [
          0 => "http://localhost.com/dashboard"
        ]
        "content-type" => array:1 [
          0 => "text/html; charset=UTF-8"
        ]
      ]
      #cacheControl: []
    }
    #content: """
      <!DOCTYPE html>\n
      <html>\n
          <head>\n
              <meta charset="UTF-8" />\n
              <meta http-equiv="refresh" content="0;url=http://localhost.com/dashboard" />\n
      \n
              <title>Redirecting to http://localhost.com/dashboard</title>\n
          </head>\n
          <body>\n
              Redirecting to <a href="http://localhost.com/dashboard">http://localhost.com/dashboard</a>.\n
          </body>\n
      </html>
      """
    #version: "1.1"
    #statusCode: 302
    #statusText: "Found"
    #charset: null
    +original: null
    +exception: null
  }
}

```

So obviously, the session cookie is not in `$response->headers->getCookies()`, and I don't use `actingAs()` is because after user successful login, will set a few session values, i.e. `sess_user_id`, `sess_user_firstname`, `sess_user_lastname`, `sess_role`...