Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hostOnly cookie changes #4041

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions content/api/commands/getcookie.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ Pass in an options object to change the default behavior of `cy.getCookie()`.
- `domain`
- `expiry` _(if specified)_
- `httpOnly`
- `hostOnly` _(if specified)_
- `name`
- `path`
- `sameSite` _(if specified)_
Expand Down Expand Up @@ -158,6 +159,7 @@ following:

| Version | Changes |
| ------------------------------------------- | -------------------------------------------------------------------------------------------------- |
| [8.2.0](/guides/references/changelog#8-2-0) | Added `hostOnly` property. |
| [5.0.0](/guides/references/changelog#5-0-0) | Removed `experimentalGetCookiesSameSite` and made `sameSite` property always available. |
| [4.3.0](/guides/references/changelog#4-3-0) | Added `sameSite` property when the `experimentalGetCookiesSameSite` configuration value is `true`. |

Expand Down
2 changes: 2 additions & 0 deletions content/api/commands/getcookies.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ following properties:
- `domain`
- `expiry` _(if specified)_
- `httpOnly`
- `hostOnly` _(if specified)_
- `name`
- `path`
- `sameSite` _(if specified)_
Expand Down Expand Up @@ -114,6 +115,7 @@ following:

| Version | Changes |
| ------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------ |
| [8.2.0](/guides/references/changelog#8-2-0) | Added `hostOnly` property. |
| [5.0.0](/guides/references/changelog#5-0-0) | Removed `experimentalGetCookiesSameSite` and made `sameSite` property always available. |
| [4.3.0](/guides/references/changelog#4-3-0) | Added `sameSite` property when the [experimentalGetCookiesSameSite](/guides/references/configuration#Experiments) configuration value is `true`. |

Expand Down
27 changes: 17 additions & 10 deletions content/api/commands/setcookie.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,21 @@ The value of the cookie to set.

Pass in an options object to change the default behavior of `cy.setCookie()`.

| Option | Default | Description |
| ---------- | -------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `log` | `true` | Displays the command in the [Command log](/guides/core-concepts/test-runner#Command-Log) |
| `domain` | `window.location.hostname` | The domain the cookie is visible to |
| `expiry` | 20 years into the future | When the cookie expires, specified in seconds since [Unix Epoch](https://en.wikipedia.org/wiki/Unix_time). |
| `httpOnly` | `false` | Whether the cookie is an HTTP only cookie |
| `path` | `/` | The cookie path |
| `secure` | `false` | Whether the cookie is a secure cookie |
| `timeout` | [`responseTimeout`](/guides/references/configuration#Timeouts) | Time to wait for `cy.setCookie()` to resolve before [timing out](#Timeouts) |
| `sameSite` | `undefined` | Cookie's SameSite value. If set, should be one of `lax`, `strict`, or `no_restriction`. Pass `undefined` to use the browser's default. Note: `no_restriction` can only be used if the `secure` flag is set to `true`. |
| Option | Default | Description |
| ---------- | -------------------------- | ---------------------------------------------------------------------------------------------------------- | --- |
| `log` | `true` | Displays the command in the [Command log](/guides/core-concepts/test-runner#Command-Log) |
| `domain` | `window.location.hostname` | The domain the cookie is visible to |
| `expiry` | 20 years into the future | When the cookie expires, specified in seconds since [Unix Epoch](https://en.wikipedia.org/wiki/Unix_time). |
| `httpOnly` | `false` | Whether the cookie is an HTTP only cookie |
| `hostOnly` | `false` | Whether the cookie should apply only to the supplied domain, not subdomains. | S |

| `path` | `/` | The cookie path | | `secure` | `false` | Whether the cookie is
a secure cookie | | `timeout` |
[`responseTimeout`](/guides/references/configuration#Timeouts) | Time to wait
for `cy.setCookie()` to resolve before [timing out](#Timeouts) | | `sameSite` |
`undefined` | Cookie's SameSite value. If set, should be one of `lax`, `strict`,
or `no_restriction`. Pass `undefined` to use the browser's default. Note:
`no_restriction` can only be used if the `secure` flag is set to `true`. |

### Yields [<Icon name="question-circle"/>](/guides/core-concepts/introduction-to-cypress#Subject-Management)

Expand All @@ -51,6 +56,7 @@ Pass in an options object to change the default behavior of `cy.setCookie()`.
- `domain`
- `expiry` _(if specified)_
- `httpOnly`
- `hostOnly` _(if specified)_
- `name`
- `path`
- `sameSite` _(if specified)_
Expand Down Expand Up @@ -117,6 +123,7 @@ following:

| Version | Changes |
| --------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------ |
| [8.2.0](/guides/references/changelog#8-2-0) | Added `hostOnly` property. |
| [5.0.0](/guides/references/changelog#5-0-0) | Removed `experimentalGetCookiesSameSite` and made `sameSite` property always available. |
| [4.3.0](/guides/references/changelog#4-3-0) | Added `sameSite` property when the [experimentalGetCookiesSameSite](/guides/references/configuration#Experiments) configuration value is `true`. |
| [0.16.0](/guides/references/changelog#0-16-0) | `cy.setCookie()` command added |
Expand Down