https://cypress.io logo
Hey guys, I'm trying to create Cypress Custom meth...
# general-chat
c
Hey guys, I'm trying to create Cypress Custom methods at runtime, So something like Const addClick: (ofObject) => Cypress.Commands.add("Click" + ofObject, {prevSubject:true}, (subject) => { cy.wrap(subject).click() }) export default{ addClick } ...... //Inside e2e.js Import gen from "../gen.js" gen.addClick("Button") //Inside spec Cy.get("#element").ClickButton() ... Note: not the exact code but the principal, I got stuck, if didn't work, any Idea how I can work around adding custom commands at runtime?