Does anyone know how I can write the variable values on Text or Excel sheet?
I have variable tex
and it stores the string values and i want to write those values on textfiles or Excel sheet( preferable)
beforeEach(() => {
cy.visit('https://docs.cypress.io/api/commands/closest.html#Syntax')
})
it('go to the home page', () => {
cy.get('.sidebar-link').each(($el, index, $list) => {
const tex = $el.text()
cy.writeFile('/Users/Desktop/2.txt', tex) // <= This piece of code is printing only last stored value
})
});
I know there is cy.writeFile
but not sure how i can use it.