cypress-io / cypress

Fast, easy and reliable testing for anything that runs in a browser.

Home Page:https://cypress.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Not able to uninstall Cypress 13.8.1

pujantrivedicisco opened this issue · comments

Current behavior

I want to completely uninstall Cypress 13.8.1, then reinstall it. i tried commands npm uninstall cypress --force
, then npm uninstall cypress --legacy-peer-deps
etc.
but still able to launch cypress using npx or pnpx cypress open

i want to completely uninstall so that i can install it again.

Reason i want to install it again is, in myscript i want to capture / intercept the API call, so as to get the jwt token after login, currently, m not able to extract it using below code
cy.intercept('GET', uri).as('whoamiRequest');
cy.visit('/'); //This will reload page, which will load the API get call, which has token in its header
cy.wait('@whoamiRequest').then((interception) => {
let authorizationHeaderValue = interception.request.headers['Authorization:'];

  return cy.wrap(authorizationHeaderValue).as('authToken');
});

but this gives blank value for token, though there is a token stored in Authorization header, so to troubleshoot i want to completely uninstall and install cypress latest version, then try again.

Desired behavior

No response

Test code to reproduce

cy.intercept('GET', uri).as('whoamiRequest');
cy.visit('/'); //This will reload page, which will load the API get call, which has token in its header
cy.wait('@whoamiRequest').then((interception) => {
let authorizationHeaderValue = interception.request.headers['Authorization:'];

  return cy.wrap(authorizationHeaderValue).as('authToken');
});

Cypress Version

13.8.1

Node version

v20.5.1

Operating System

macOS

Debug Logs

No response

Other

No response

@pujantrivedicisco Do you remember how you first installed Cypress? There’s a few different ways you could have. https://docs.cypress.io/guides/getting-started/installing-cypress#Installing

@jennifer-shehane , i first installed version 12.17.4, then after few weeks, installed 13.8.1 using npm install cypress --save-dev, then pnpm install to install dependencies

I tried direct app installed too, downloaded it, put it in applications folder, then configured my project with it.

I am facing total two issues

  1. The API call is not getting intercepted, the variable is not getting the jwt token in response in below code.

    cy.intercept('GET', uri).as('requestalias');
    cy.wait(2000)
    cy.visit('/');
    cy.wait('@requestalias').then((interception) => {
    let authorizationHeaderValue = interception.request.headers['Authorization:'];

    if (!authorizationHeaderValue) {
    authorizationHeaderValue = interception.response.headers['Authorization'];
    }

    cy.log("The value of the Authorization header is:", authorizationHeaderValue);
    return cy.wrap(authorizationHeaderValue).as('authToken'); //this authtoken is blank for me

to troubleshoot above, i thought to clean install cypress all over again and try, but now cypress is not at all completely uninstalling.

@pujantrivedicisco

You may like to connect to the Cypress technical community on Discord

Discord chat (click on button)

where other users help each other and provide support.