Our code used to do exactly what the documentation states:
cy.setCookie('foo', 'bar')
cy.clearCookie('foo')
cy.getCookie('foo').should('be.null')
This works with 3.4.1 and started failing with 3.5.0.
Since there are tickets about clearCookies not working this was the only way we actually could delete a specific cookie. Now even that doesn't work any longer.
Hey @jweingarten, the example you provided works in 3.5.0 in Chrome and Electron when run during cypress open in my MacOS Mohave OS.

Please provide an entirely reproducible example - also, there is an open cookies issue involving 3.5.0 here - https://github.com/cypress-io/cypress/issues/5432 ensure your issue is not related to this one also.
Ok I found what you need to reproduce .... and that is basically setting a baseUrl in cypress.json.
Here the exact steps:
mkdir foocd foonpm install cypressmkdir cypress/integrationvi cypress/integration/sample_spec.jssample_spec.jsdescribe('Load Main Dashoard after Login', function() {
context('Login', function() {
it('The Main Dashboard should be able to load now', function() {
cy.setCookie('foo', 'bar')
cy.clearCookie('foo')
cy.getCookie('foo').should('be.null')
});
});
});
vi cypress.jsoncypress.json{
"baseUrl":"https://www.google.com"
}
node_modules/cypress/bin/cypress opensample_spec.jsResult: AssertionError: expected { Object (name, value, ...) } to be null
@jweingarten Thanks! I can reproduce this after setting a baseUrl in the cypress.json
I also confirmed this was introduced in 3.5.0


Not only clearCookie, but apparently lots of things related to cookies and baseUrl.
Our tests have a fast login and logout implementation, like the docs show, that doesn't work anymore after updating to 3.5.0.
cy.request({
method: 'POST',
url: '/api/auth',
body: {
email,
password,
}
})
cy.getCookie('session').should('exist')
Related: #3221 (might be fixable together)
I am having the same.
@ianldgs This is the issue you're having, there is already a fix in develop to be released soon: #5432
cy.setCookie('foo', 'bar') cy.clearCookie('foo') cy.getCookie('foo').should('be.null')
This works in some cases and fails in others (I've only tested in Electron, but results should be the same in Chrome). Here are the baseUrls I've tested:
baseUrlSo the issue seems related to setting cookies on a FQDN.
I have written some automated tests for this here: #5478
I'll continue working on fixing this in that PR.
Not sure if it's related, but I couldn't get cypress to clear a cookie on a .-leading domain.
Thanks for the additional info!
There were some huge changes in how cookies are handled in Cypress 3.5.0. We went from a split approach (using Electron cookies APIs to control Electron and Chrome Extension API to control Chrome) to a different, unified approach (Chrome DevTools Protocol to control both Electron and Chrome). Once we get the initial bugs ironed out, this will hopefully be a much more reliable and maintainable approach.
Additional: we use DELETE requests to reset test data. The GET requests still work, but the DELETE's don't work any more since 3.5.0. The requests now return a 403 status
The code for this is done in cypress-io/cypress#5478, but has yet to be released.
We'll update this issue and reference the changelog when it's released.
Released in 3.6.1.
Most helpful comment
Thanks for the additional info!
There were some huge changes in how cookies are handled in Cypress 3.5.0. We went from a split approach (using Electron
cookiesAPIs to control Electron and Chrome Extension API to control Chrome) to a different, unified approach (Chrome DevTools Protocol to control both Electron and Chrome). Once we get the initial bugs ironed out, this will hopefully be a much more reliable and maintainable approach.