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

Cypress.cookies.debug() does not log anything to console. #15032

Closed
jennifer-shehane opened this issue Feb 11, 2021 · 6 comments · Fixed by #15785
Closed

Cypress.cookies.debug() does not log anything to console. #15032

jennifer-shehane opened this issue Feb 11, 2021 · 6 comments · Fixed by #15785
Assignees
Labels
type: regression A bug that didn't appear until a specific Cy version release v6.3.0 🐛 Issue present since 6.3.0

Comments

@jennifer-shehane
Copy link
Member

jennifer-shehane commented Feb 11, 2021

Current behavior

Cypress.cookies.debug() no longer logs to the console in Cypress 6.3.0+

It seems this issue is introduced in this PR? #14182

  • Working (chore: release @cypress/webpack-batteries-included-preprocessor-v2.1.4): 4c9ea6c
  • Broken (build: properly use local npm packages for development and binary build) 3eb3bfa

Before

Screen Shot 2021-02-11 at 10 29 48 AM

After

Screen Shot 2021-02-11 at 10 35 15 AM

Desired behavior

Test code to reproduce

/// <reference types="cypress" />

context('Cookies', () => {
  beforeEach(() => {
    Cypress.Cookies.debug(true)

    cy.visit('https://example.cypress.io/commands/cookies')

    // clear cookies again after visiting to remove
    // any 3rd party cookies picked up such as cloudflare
    cy.clearCookies()
  })

  it('cy.getCookie() - get a browser cookie', () => {
    // https://on.cypress.io/getcookie
    cy.get('#getCookie .set-a-cookie').click()

    // cy.getCookie() yields a cookie object
    cy.getCookie('token').should('have.property', 'value', '123ABC')
  })

  it('cy.getCookies() - get browser cookies', () => {
    // https://on.cypress.io/getcookies
    cy.getCookies().should('be.empty')

    cy.get('#getCookies .set-a-cookie').click()

    // cy.getCookies() yields an array of cookies
    cy.getCookies().should('have.length', 1).should((cookies) => {
      // each cookie has these properties
      expect(cookies[0]).to.have.property('name', 'token')
      expect(cookies[0]).to.have.property('value', '123ABC')
      expect(cookies[0]).to.have.property('httpOnly', false)
      expect(cookies[0]).to.have.property('secure', false)
      expect(cookies[0]).to.have.property('domain')
      expect(cookies[0]).to.have.property('path')
    })
  })

  it('cy.setCookie() - set a browser cookie', () => {
    // https://on.cypress.io/setcookie
    cy.getCookies().should('be.empty')

    cy.setCookie('foo', 'bar')

    // cy.getCookie() yields a cookie object
    cy.getCookie('foo').should('have.property', 'value', 'bar')
  })

  it('cy.clearCookie() - clear a browser cookie', () => {
    // https://on.cypress.io/clearcookie
    cy.getCookie('token').should('be.null')

    cy.get('#clearCookie .set-a-cookie').click()

    cy.getCookie('token').should('have.property', 'value', '123ABC')

    // cy.clearCookies() yields null
    cy.clearCookie('token').should('be.null')

    cy.getCookie('token').should('be.null')
  })

  it('cy.clearCookies() - clear browser cookies', () => {
    // https://on.cypress.io/clearcookies
    cy.getCookies().should('be.empty')

    cy.get('#clearCookies .set-a-cookie').click()

    cy.getCookies().should('have.length', 1)

    // cy.clearCookies() yields null
    cy.clearCookies()

    cy.getCookies().should('be.empty')
  })
})

Versions

6.3.0

@jennifer-shehane jennifer-shehane added type: regression A bug that didn't appear until a specific Cy version release v6.3.0 🐛 Issue present since 6.3.0 stage: ready for work The issue is reproducible and in scope labels Feb 11, 2021
@jennifer-shehane
Copy link
Member Author

jennifer-shehane commented Feb 11, 2021

that commit fixed an issue where dependencies were not being linked properly, for example we were using an old version of webpack-preprocessor that we pulled from npm (not sure the version, maybe 4.5.0) when we had a more up to date version locally

that commit just ensures that we use the most up to date local packages

so my guess would be that some commits between whatever version we were using at the time (can check by going back to that commit you marked as the last working and using yarn why to get the installed versions) and the most updated version caused this issue, but the issue was not recognized until the TR started using the updated version of that package

I believe webpack-preprocessor and webpack-batteries-included-preprocessor were the only packages where we were using a version that was not up to date, so I'd check through the history of those packages

We were using cypress/webpack-preprocessor@5.4.5, but the latest should have been cypress/webpack-preprocessor@5.5.0

We were using @cypress/webpack-batteries-included-preprocessor@2.1.3, but the latest should have been @cypress/webpack-batteries-included-preprocessor@2.1.4

Working (chore: release @cypress/webpack-batteries-included-preprocessor-v2.1.4): 4c9ea6c

yarn why @cypress/webpack-batteries-included-preprocessor

=> Found "@cypress/webpack-batteries-included-preprocessor@0.0.0-development"
info Has been hoisted to "@cypress/webpack-batteries-included-preprocessor"
info Reasons this module exists
   - "workspace-aggregator-2d9cfdcf-9afa-4cf5-b96c-184eaa0d704f" depends on it
   - Specified in "dependencies"
   - Hoisted from "_project_#@cypress#webpack-batteries-included-preprocessor"
info Disk size without dependencies: "97.65MB"
info Disk size with unique dependencies: "172.77MB"
info Disk size with transitive dependencies: "97.65MB"
info Number of shared dependencies: 327
=> Found "@packages/server#@cypress/webpack-batteries-included-preprocessor@2.1.3"
info This module exists because "_project_#@packages#server" depends on it.
info Disk size without dependencies: "60.96MB"
info Disk size with unique dependencies: "136.08MB"
info Disk size with transitive dependencies: "60.96MB"
info Number of shared dependencies: 327
✨  Done in 3.84s.

yarn why @cypress/webpack-preprocessor

=> Found "@cypress/webpack-preprocessor@0.0.0-development"
info Has been hoisted to "@cypress/webpack-preprocessor"
info Reasons this module exists
   - "workspace-aggregator-5a61de95-bf0b-42b4-8637-4486c936bedd" depends on it
   - Specified in "dependencies"
   - Hoisted from "_project_#@cypress#webpack-preprocessor"
info Disk size without dependencies: "97.77MB"
info Disk size with unique dependencies: "103.43MB"
info Disk size with transitive dependencies: "103.45MB"
info Number of shared dependencies: 4
=> Found "@packages/desktop-gui#@cypress/webpack-preprocessor@5.4.5"
info This module exists because "_project_#@packages#desktop-gui" depends on it.
info Disk size without dependencies: "5.65MB"
info Disk size with unique dependencies: "11.32MB"
info Disk size with transitive dependencies: "11.33MB"
info Number of shared dependencies: 4
=> Found "@packages/driver#@cypress/webpack-preprocessor@5.4.5"
info This module exists because "_project_#@packages#driver" depends on it.
info Disk size without dependencies: "8.08MB"
info Disk size with unique dependencies: "13.75MB"
info Disk size with transitive dependencies: "13.76MB"
info Number of shared dependencies: 4
=> Found "@packages/runner#@cypress/webpack-preprocessor@5.4.5"
info This module exists because "_project_#@packages#runner" depends on it.
info Disk size without dependencies: "5.74MB"
info Disk size with unique dependencies: "11.4MB"
info Disk size with transitive dependencies: "11.42MB"
info Number of shared dependencies: 4
=> Found "@packages/server#@cypress/webpack-preprocessor@5.4.5"
info This module exists because "_project_#@packages#server" depends on it.
info Disk size without dependencies: "9.51MB"
info Disk size with unique dependencies: "15.18MB"
info Disk size with transitive dependencies: "15.19MB"
info Number of shared dependencies: 4
=> Found "@packages/ui-components#@cypress/webpack-preprocessor@5.4.5"
info This module exists because "_project_#@packages#ui-components" depends on it.
info Disk size without dependencies: "7.81MB"
info Disk size with unique dependencies: "13.47MB"
info Disk size with transitive dependencies: "13.49MB"
info Number of shared dependencies: 4
=> Found "@cypress/react#@cypress/webpack-preprocessor@5.4.5"
info This module exists because "_project_#@cypress#react" depends on it.
info Disk size without dependencies: "9.36MB"
info Disk size with unique dependencies: "15.02MB"
info Disk size with transitive dependencies: "15.04MB"
info Number of shared dependencies: 4
=> Found "@cypress/vue#@cypress/webpack-preprocessor@5.4.5"
info This module exists because "_project_#@cypress#vue" depends on it.
info Disk size without dependencies: "2.45MB"
info Disk size with unique dependencies: "8.11MB"
info Disk size with transitive dependencies: "8.13MB"
info Number of shared dependencies: 4
=> Found "@cypress/webpack-batteries-included-preprocessor#@cypress/webpack-preprocessor@5.4.5"
info This module exists because "_project_#@cypress#webpack-batteries-included-preprocessor" depends on it.
info Disk size without dependencies: "3.81MB"
info Disk size with unique dependencies: "9.47MB"
info Disk size with transitive dependencies: "9.49MB"
info Number of shared dependencies: 4
=> Found "cypress-react-unit-test#@cypress/webpack-preprocessor@5.4.2"
info This module exists because "_project_#@packages#desktop-gui#cypress-react-unit-test" depends on it.
info Disk size without dependencies: "68KB"
info Disk size with unique dependencies: "5.73MB"
info Disk size with transitive dependencies: "5.75MB"
info Number of shared dependencies: 4
✨  Done in 3.53s.

Broken (build: properly use local npm packages for development and binary build) 3eb3bfa

yarn why @cypress/webpack-batteries-included-preprocessor

=> Found "@cypress/webpack-batteries-included-preprocessor@0.0.0-development"
info Has been hoisted to "@cypress/webpack-batteries-included-preprocessor"
info Reasons this module exists
   - "workspace-aggregator-18a08f59-92ff-425e-8b66-5772026f09be" depends on it
   - Specified in "dependencies"
   - Hoisted from "_project_#@cypress#webpack-batteries-included-preprocessor"
   - Hoisted from "_project_#@packages#server#@cypress#webpack-batteries-included-preprocessor"
info Disk size without dependencies: "93.16MB"
info Disk size with unique dependencies: "115.91MB"
info Disk size with transitive dependencies: "93.16MB"
info Number of shared dependencies: 327
✨  Done in 2.78s.

yarn why @cypress/webpack-preprocessor

=> Found "@cypress/webpack-preprocessor@0.0.0-development"
info Has been hoisted to "@cypress/webpack-preprocessor"
info Reasons this module exists
   - "workspace-aggregator-1a26dd50-fa38-4676-964f-a912ce3478b7" depends on it
   - Specified in "dependencies"
   - Hoisted from "_project_#@cypress#webpack-preprocessor"
   - Hoisted from "_project_#@packages#desktop-gui#@cypress#webpack-preprocessor"
   - Hoisted from "_project_#@packages#driver#@cypress#webpack-preprocessor"
   - Hoisted from "_project_#@packages#runner#@cypress#webpack-preprocessor"
   - Hoisted from "_project_#@packages#server#@cypress#webpack-preprocessor"
   - Hoisted from "_project_#@packages#ui-components#@cypress#webpack-preprocessor"
   - Hoisted from "_project_#@cypress#react#@cypress#webpack-preprocessor"
   - Hoisted from "_project_#@cypress#vue#@cypress#webpack-preprocessor"
   - Hoisted from "_project_#@cypress#webpack-batteries-included-preprocessor#@cypress#webpack-preprocessor"
info Disk size without dependencies: "47.29MB"
info Disk size with unique dependencies: "52.95MB"
info Disk size with transitive dependencies: "52.97MB"
info Number of shared dependencies: 4
=> Found "cypress-react-unit-test#@cypress/webpack-preprocessor@5.4.2"
info This module exists because "_project_#@packages#desktop-gui#cypress-react-unit-test" depends on it.
info Disk size without dependencies: "68KB"
info Disk size with unique dependencies: "5.73MB"
info Disk size with transitive dependencies: "5.75MB"
info Number of shared dependencies: 4
✨  Done in 2.54s.

@pablohassan1
Copy link

Hi,

I can observe the same behavior on 6.5.0, I have Cypress.Cookies.debug(true) in my beforEach hook, but nothing gets logged in the console. Is it supposed to be fixed?

@jennifer-shehane
Copy link
Member Author

@pablohassan1 No, this is still an issue.

@fishgills
Copy link

Ah, that definitely looks like what I'm seeing. Thanks @jennifer-shehane .

@cypress-bot cypress-bot bot added stage: work in progress There is an open PR for this issue [WIP] and removed stage: ready for work The issue is reproducible and in scope labels Apr 5, 2021
@sainthkh sainthkh self-assigned this Apr 5, 2021
@cypress-bot cypress-bot bot added stage: pending release There is a closed PR for this issue and removed stage: work in progress There is an open PR for this issue [WIP] labels Apr 26, 2021
@cypress-bot
Copy link
Contributor

cypress-bot bot commented Apr 26, 2021

The code for this is done in cypress-io/cypress#15785, but has yet to be released.
We'll update this issue and reference the changelog when it's released.

@cypress-bot
Copy link
Contributor

cypress-bot bot commented May 10, 2021

Released in 7.3.0.

This comment thread has been locked. If you are still experiencing this issue after upgrading to
Cypress v7.3.0, please open a new issue.

@cypress-bot cypress-bot bot removed the stage: pending release There is a closed PR for this issue label May 10, 2021
@cypress-bot cypress-bot bot locked as resolved and limited conversation to collaborators May 10, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type: regression A bug that didn't appear until a specific Cy version release v6.3.0 🐛 Issue present since 6.3.0
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants