https://cypress.io logo
Masking CC Details In Test
# i-need-help
r
How can I mask sensitive information so it does not show in the cypress video recoding? I came across a way to not log cc details in the docs, but unfortunately, the sensitive information can still be seen in the video itself. If this is not possible, is there a way to turn of video recoding for a single spec file or even a single it block?
n
You could pass
{log: false}
option to almost any command or you could turn video recording off using
Cypress.config
inside single file or probably test
r
You can still see it in the video recording with that option. I figured out that chaining .invoke('attr', 'type', 'password') to an element masks the text in the recoding
t
A best-practice approach would rather be to use test-only data, i.e. have a test card used only for testing when connected to a mocked endpoint for your payment service, that doesn't even matter if anyone gets hold of the details for some reason.
All major payment providers have these things, like PayPal has a sandbox that a test environment connects to so the front-end implementation can be tested in a test environment without connecting to real live systems.
g
Search https://cypress.tips/search for "sensitive"
n
I misunderstood post you want to hide it from the actual video an not from cy log inside video. If you use for example some MUI components or anything that is not built by you it could be much harder to control the attributes this way. Also, you would need some custom styles in case for example textArea. I would always leave Videos creation only for local run, not as the part of the CI/CD process. And once more Cypress.config could turn videos off for specific test.
t
Videos are very useful as part of CI for me. If something fails on CI I want to view it as if I had run it locally (so I don't have to load up my local env. and find the test and run it then see the results etc.) It's way quicker to debug what went wrong.