I am trying to write "unit-test" for components in react with cypress.
Followed the link cypress docs on component testing
when I wrote testcase for a component and tried to run with "npx cypress open-ct"
then getting the above error (question title)...
Note: for login oAuth2 is implemented !!!
My index.spec.js file is
import * as React from 'react';
import { mount } from '@cypress/react';
import User from './index';
describe('User component', ()=>{
before('loginApi', ()=>{
cy.login();
//login() has login-logic and setting localStorage (placed in "commands.js" file)
//even if cy.login() is commented, error is same (so guessing this not reason of error)
})
it('Mount user', () => {
mount(<User />);
});
})
Observation1: on cypress browser under TEST BODY "mount" value is <Unknown.../>
Observation2: [Network tab] User component makes api-call and failing with 401
(#known token issue, even fails with right token)