I am currently working on a button function that copies the token stored in localStorage to the clipboard. I am trying to write code that will compare the token in localStorage with the one in the clipboard in order to verify if the copy was successful.
Here is my current approach:
cy.get('.copy-to-clipboard').click();
cy.window().its('navigator.clipboard').invoke('readText')
.should('equal', localStorage.getItem(accessTokenKey));
This method is not providing accurate results and is causing issues for me. Any assistance or alternative solutions would be greatly appreciated.