Skip to content

Commit

Permalink
Fix cypress not typing "cy" in input box
Browse files Browse the repository at this point in the history
  • Loading branch information
Splines committed Nov 9, 2024
1 parent 43ac12f commit f1366b0
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions spec/cypress/e2e/lectures_people_select_specs.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,13 @@ function typeCyInInput(selector, waitForUserFill = true) {
cy.intercept("GET", "/users/fill_user_select*").as("userFill");
}

cy.getBySelector(selector).find("input:not([type='hidden'])").as("input");
cy.getBySelector(selector).find("input:not([type='hidden'])")
.should("have.length", 1).first().as("input");
cy.get("@input").clear(); // without clearing first, tests are flaky (!)
cy.get("@input").click();
cy.get("@input").type("cy");

// eslint-disable-next-line cypress/unsafe-to-chain-command
cy.get("@input").type("cy", { timeout: 5000 }).should("have.value", "cy");

if (waitForUserFill) {
cy.wait("@userFill");
Expand Down

0 comments on commit f1366b0

Please sign in to comment.