cypress-autorecord
cypress-autorecord copied to clipboard
Why do arrow functions not work.
This is not a good enough. "NOTE: Do not use ES6 arrow functions for your describe or it callback. This will cause the recording function to break." Do you have any idea why?
because the code uses this.currentTest
. However, this can be fixed by listening for Cypress's test:before:run
event and setting a global variable in index.js
let currentTest = ''
Cypress.on('test:before:run', ({ title }) => currentTest = title
Then, all references to this.currentTest.title
can simply be replaced with currentTest
I had the same question. It's an odd requirement and error also prone. I hope it gets fixed.