The e2e tests require the use of SSO to work properly. Until Platform One figures out a way to run cypress with a SSO Non-person Entity (NPE), this process will include a manual step. Before running the tests we first have to obtain a cookie value from the Launchboard FE instance we want to test.
Platform One is still working on a solution to run `npm run test:e2e-ci` against a deployed app instance outside of Keycloak/Authservice.
1. In a browser, open dev tools and go to the Launchboard FE instance you want to test (https://localhost:3333 for dev, https://launchboard.staging.apps.il2.dsop.io for staging, etc). Log in to Platform One SSO if prompted.
2. On the `Network` tab of dev tools, click on one of the Launchboard requests, then find the `Cookie` value under `Response Headers`.
3. The piece of the cookie that handles your SSO session depends on the environment and how Keycloak is configured. Copy the authentication cookie (omit the trailing `;` if present). The following cookie formats have been observed:
- In dev: `connect.sid=s%3A9w7jaTiFm...`
- In staging: `__Host-launchboard-staging-authservice-session-id-cookie=lzs...`
4. Use the copied authentication cookie as the `SSO_COOKIE_VALUE` environment variable and run the tests. Example:
We can run e2e tests on the Launchboard Front End by mocking api requests in Cypress (see `tests/e2e/fixtures/users/`).
```bash
# example in dev (using launchboard-local-dev) which runs against https://localhost:3333 by default
SSO_COOKIE_VALUE=connect.sid=s%3A9w7jaTiFm... npm run test:e2e
# run e2e tests locally with the cypress ui
npm run test:e2e
# pipeline ci example which runs against https://launchboard.staging.apps.il2.dsop.io by default
SSO_COOKIE_VALUE=__Host-launchboard-staging-authservice-session-id-cookie=lzs... npm run test:e2e-ci