I’m trying to bypass the api that required authenication completely with fixture data to test this component, but received this error ” -click (uncaught exception) Error: No active account! Verify a user has been signed in and setActiveAccount has been called.”
import React from "react";
import UpgradeGuidance from "../components/UpgradeGuidance";
import upgradeInfo from "../../cypress/fixtures/upgradeGuidanceData.json";
describe("UpgradeGuidance component", () => {
beforeEach(() => {
cy.viewport(1024, 768);
cy.mount(<UpgradeGuidance upgradeHref={upgradeInfo} />);
});
it("Check if ShortTerm Name Rendered", () => {
cy.intercept("https://abc/foss-upgrade-guidance/", {
fixture: "upgradeGuidanceData.json",
}).as("upgradeInfo");
cy.get("Button").contains("Get upgrade advice").should("exist").click();
cy.wait("@upgradeInfo").then((interception) => {
const upgradeInfo = interception.response?.body;
cy.get("[data-testid='upgrade-short']").contains(
upgradeInfo.shortTermAdvice
);
});
});
});