Copyright Year
The application code sets the current year in the copyright message. How does the test know the current year to check? Watch the video 📺 Copyright Year Cypress Test to see this recipe in action.
<i id="copyright" />
<script>
const year = new Date().getFullYear()
document.getElementById(
'copyright',
).innerText = `Copyright @ ${year} Gleb`
</script>
The test should not hardcode the year either.
const year = new Date().getFullYear()
cy.contains('#copyright', `${year} Gleb`, { timeout: 0 })