Skip to content
Discussion options

You must be logged in to vote

Looks like you are not wrapping the previous subject passed into your custom command. It seems from your definition, the subject will be a jQuery element. Maybe that is the reason?

Cypress.Commands.add(
    "getSelect2OptionByText",
    { prevSubject: "optional" },
    (subject, text) =>
        subject
            ? cy.wrap(subject).get(".select2-results").contains(text)
            : cy.get(".select2-results").contains(text)
);

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@jeansberg
Comment options

Answer selected by jeansberg
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants