While working with Cypress, Typescript, and es6, I encountered a challenge:
https://i.sstatic.net/khDFD.png
I attempted to define a const within a test:
const folderName = "Test"
My aim was to insert the folderName
into the String inside cy.get()
using String Substitution as per this documentation.
cy.get('[name="folder-name-${folderName}"]').next().click({force: true})
However, it seems like I am making a mistake:
https://i.sstatic.net/OjRbp.png
I found a solution by modifying my approach:
cy.get('[name="folder-name-' + folderName + '"]').next().click({force: true})
But I believe there might be better ways to achieve this. What could I be overlooking?