Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

87
Views
Argument type string is not assignable to parameter type keyof Chainable... in Cypress

After update 9.0.0 in Cypress I have the following error

Argument type string is not assignable to parameter type keyof Chainable... Type string is not assignable to type "and" | "as" | "blur" | "check" | "children" | "clear" | "clearCookie" | "clearCookies" | "clearLocalStorage" | "click" | "clock" | ... Type string is not assignable to type "intercept" which affect all my custom commands

Could someone help me? My custom command

over 4 years ago · Santiago Trujillo
2 answers
Answer question

0

Beginning with version 9.0.0, You are now forced to declare your custom commands. See the changelog for 9.0.0 (6th bullet point under breaking changes) and see the specific information about custom commands now being typed based on the declared custom chainable here.

Also, see this recipe on how to add custom commands and declare them properly.

For your custom command, add this file cypress/support/index.d.ts with the following code:

/// <reference types="cypress" />

declare namespace Cypress {
    interface Chainable<Subject = any> {
        /**
         * Custom command to ... add your description here
         * @example cy.clickOnMyJourneyInCandidateCabinet()
         */
        clickOnMyJourneyInCandidateCabinet(): Chainable<null>;
    }
}
over 4 years ago · Santiago Trujillo Report

0

in support/index.d.ts

declare namespace Cypress {
  interface Chainable<Subject = string> {
    preventSubmit(form: string): Chainable<Element>;
  }
}

in support/commnad.js

Cypress.Commands.add("preventSubmit", (form) => {
  cy.get(form).then((form$) => {
    form$.on("submit", (e) => {
      e.preventDefault();
    });
  });
  cy.log(`prevent default submit to '${form}'`);
});

in specs/test.js

describe("MyTest", () => {
  ...
  it("Test 1", () => {
    ...
    cy.preventSubmit("form");
    cy.get("form").submit();
  }
}
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!