I am testing a d3 application with Cypress. As of the tests, I'd like to make sure a specific function is called when a circle within an SVG element is clicked. The function is called when I'm clicking manually but the test that I wrote fails, so I assume I made a mistake somewhere in the test. Here's the test code I have right now:
import * as app from "../../app";
describe("Scatter plot", () => {
before(() => {
cy.visit("http://localhost:1234");
});
it("Triggers the displayMovieInfo on click", () => {
const displayMovieInfo = cy.spy(app, "displayMovieInfo");
cy.get("#scatterPlot")
.get("circle")
.eq(0)
.click({ force: true });
expect(displayMovieInfo).to.be.called;
});
});
The output I get from Cypress:
expected displayMovieInfo to have been called at least once, but it was never called
Any help will be appreciated!
Aucun commentaire:
Enregistrer un commentaire