I am adding a random text to input using lorem-ipsum in cypress. Does anyone know how to handle this in cypress?
I am using following method and going to call addComment() method in the test
import { loremIpsum } from "lorem-ipsum";
addcomment() {
loremIpsum({
count: 1, // Number of "words", "sentences", or "paragraphs"
format: "plain", // "plain" or "html"
paragraphLowerBound: 3, // Min. number of sentences per paragraph.
paragraphUpperBound: 7, // Max. number of sentences per paragarph.
random: Math.random, // A PRNG function
sentenceLowerBound: 5, // Min. number of words per sentence.
sentenceUpperBound: 15, // Max. number of words per sentence.
suffix: "\n", // Line ending, defaults to "\n" or "\r\n" (win32)
units: "sentences", // paragraph(s), "sentence(s)", or "word(s)"
})
cy.get('.input > textarea').loremIpsum()
}
Install the plugin
Then use the above code mentioned by Alapan Das.
My code
}