use https://github.com/dmtrKovalenko/cypress-real-...
# component-testing
m
a
@magnificent-finland-58048 I tried with cypress-real-events. But tab is not working. Pls see the below code: test.spec.tsx:
Copy code
import { mount } from "@cypress/react";
import React from "react";
import "./test.css";

export const Test = () => {
  const x = "Text";
  return <button>{x}</button>;
};

describe("Test", () => {
  it("Test", () => {
    mount(<Test />);
    cy.get("button").should("have.css", "background-color", "rgb(0, 128, 0)");
    cy.get("button").realPress("Tab");
    // cy.get("body").realPress("Tab");
   // cy.realPress("Tab");
    cy.get("button").should("have.css", "background-color", "rgb(0, 0, 255)");
  });
});
test.css:
Copy code
button {
    background-color: rgb(0, 128, 0);
    color: white;
    &:focus {
        background-color: rgb(0, 0, 255)
    }
}
If i do log inside realPress implementation, i can see the logs. So its is installed properly.
3 Views