Skip to content

Commit e97be81

Browse files
committed
account for unspecified sameSite which is now available in firefox 140
1 parent 17901cd commit e97be81

File tree

6 files changed

+9
-10
lines changed

6 files changed

+9
-10
lines changed

cli/types/cypress.d.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3815,7 +3815,7 @@ declare namespace Cypress {
38153815
validate?: () => Promise<false | void> | void
38163816
}
38173817

3818-
type SameSiteStatus = 'no_restriction' | 'strict' | 'lax'
3818+
type SameSiteStatus = 'no_restriction' | 'strict' | 'lax' | 'unspecified'
38193819

38203820
interface SelectFileOptions extends Loggable, Timeoutable, ActionableOptions {
38213821
/**
@@ -3866,8 +3866,8 @@ declare namespace Cypress {
38663866
*/
38673867
expiry: number
38683868
/**
3869-
* The cookie's SameSite value. If set, should be one of `lax`, `strict`, or `no_restriction`.
3870-
* `no_restriction` is the equivalent of `SameSite=None`. Pass `undefined` to use the browser's default.
3869+
* The cookie's SameSite value. If set, should be one of `lax`, `strict`, `no_restriction`, or `unspecified`.
3870+
* `no_restriction` is the equivalent of `SameSite=None`. Pass `undefined` to use the browser's default ('unspecified' is the default for Firefox 140 and up).
38713871
* Note: `no_restriction` can only be used if the secure flag is set to `true`.
38723872
* @default undefined
38733873
*/

packages/driver/cypress/e2e/commands/cookies.cy.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1377,7 +1377,7 @@ describe('src/cy/commands/cookies', () => {
13771377
// @see https://bugzilla.mozilla.org/show_bug.cgi?id=1624668
13781378
// TODO(webkit): pw webkit has the same issue as firefox (no "unspecified" state), need a patched binary
13791379
if (Cypress.isBrowser('firefox') || Cypress.isBrowser('webkit')) {
1380-
cy.getCookie('five').should('include', { sameSite: 'no_restriction' })
1380+
cy.getCookie('five').should('include', { sameSite: 'unspecified' })
13811381
} else {
13821382
cy.getCookie('five').should('not.have.property', 'sameSite')
13831383
}

packages/driver/cypress/e2e/e2e/e2e_cookies.cy.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ const cleanse = (cookies) => {
88
})
99
}
1010

11-
const firefoxDefaultSameSite = Cypress.isBrowser({ family: 'firefox' }) ? { sameSite: 'no_restriction' } : {}
11+
const firefoxDefaultSameSite = Cypress.isBrowser({ family: 'firefox' }) ? { sameSite: 'unspecified' } : {}
1212

1313
describe('e2e cookies spec', () => {
1414
it('simple cookie', () => {

packages/driver/cypress/e2e/e2e/origin/cookie_login.cy.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -192,8 +192,7 @@ describe('cy.origin - cookie login', { browser: '!webkit' }, () => {
192192
verifyIdpNotLoggedIn({ expectNullCookie: false })
193193
})
194194

195-
// FIXME: Currently in Firefox, the default cookie setting in the extension is no_restriction, which can be set with Secure=false.
196-
it('SameSite=None -> not logged in', { browser: '!firefox' }, () => {
195+
it('SameSite=None -> not logged in', () => {
197196
cy.origin('http://www.foobar.com:3500', { args: { username } }, ({ username }) => {
198197
cy.get('[data-cy="username"]').type(username)
199198
cy.get('[data-cy="cookieProps"]').type('SameSite=None')

packages/driver/src/cy/commands/cookies.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ function pickCookieProps (cookie) {
2121
// different defaults, and Firefox lacks support for `unspecified`, so
2222
// `undefined` is used in lieu of `unspecified`
2323
// @see https://bugzilla.mozilla.org/show_bug.cgi?id=1624668
24-
const VALID_SAMESITE_VALUES = ['no_restriction', 'lax', 'strict']
24+
const VALID_SAMESITE_VALUES = ['no_restriction', 'lax', 'strict', 'unspecified']
2525

2626
function normalizeSameSite (sameSite?: string) {
2727
if (_.isUndefined(sameSite)) {

system-tests/projects/e2e/cypress/e2e/cookies_spec_baseurl.cy.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ const otherHttpsUrl = Cypress.env('otherHttpsUrl')
1111
let defaultSameSite = undefined
1212

1313
if (Cypress.isBrowser('firefox')) {
14-
// firefox will default to "no_restriction"
14+
// firefox will default to "unspecified"
1515
// @see https://bugzilla.mozilla.org/show_bug.cgi?id=1624668
16-
defaultSameSite = 'no_restriction'
16+
defaultSameSite = 'unspecified'
1717
}
1818

1919
describe('cookies', () => {

0 commit comments

Comments
 (0)