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

Show how httpOnly cookies are still broken #3

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
6 changes: 0 additions & 6 deletions config/initializers/allow_reading_session_on_js_side.rb

This file was deleted.

40 changes: 6 additions & 34 deletions cypress/e2e/spec.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,46 +4,18 @@ describe('issue https://github.com/cypress-io/cypress/issues/25174 reproduction'
cy.get('#do-xhr-request').click()
cy.contains('A cookie has been set').should('be.visible')

cy.get('#client-cookies-json').invoke('text').should(text => {
const parsedText = JSON.parse(text)
// There should only be one cookie here
expect(parsedText).to.have.length(1)
});

// Debug with cy.getAllCookies if that exists (Cypress v12.1.0+ only)
if (cy.getAllCookies) {
cy.getAllCookies().then(cookies => cy.log("Cookie domains are:", cookies.map(c => c.domain)))
}

cy.get('#client-cookies-json-timeout').invoke('text').should(text => {
const parsedText = JSON.parse(text)
// This is the strange thing!
// There should only be one cookie here, too
expect(parsedText).to.have.length(1)
});
// This is the strange thing! There should only be one cookie set
cy.getAllCookies().then(cookies => cy.log("Cookie domains are:", cookies.map(c => c.domain)))
cy.getAllCookies().should('have.length', 1)
})

it('creates two cookies with a fetch request', () => {
cy.visit('/')
cy.get('#do-fetch-request').click()
cy.contains('A cookie has been set').should('be.visible')

cy.get('#client-cookies-json').invoke('text').should(text => {
const parsedText = JSON.parse(text)
// There should only be one cookie here
expect(parsedText).to.have.length(1)
});

// Debug with cy.getAllCookies if that exists (Cypress v12.1.0+ only)
if (cy.getAllCookies) {
cy.getAllCookies().then(cookies => cy.log("Cookie domains are:", cookies.map(c => c.domain)))
}

cy.get('#client-cookies-json-timeout').invoke('text').should(text => {
const parsedText = JSON.parse(text)
// This is the strange thing!
// There should only be one cookie here, too
expect(parsedText).to.have.length(1)
});
// This is the strange thing! There should only be one cookie set
cy.getAllCookies().then(cookies => cy.log("Cookie domains are:", cookies.map(c => c.domain)))
cy.getAllCookies().should('have.length', 1)
})
})