Hey guys, does anyone have any idea on how to add ...
# support-questions
s
Hey guys, does anyone have any idea on how to add an e2e test using puppeteer/playwright/cypress? What I tried was somehow copying the cookie and setting it in the test, it worked but not for long, probably because the refresh tokens are also updated after a fixed time interval. I am using react and passwordless recipe. Any ideas/suggestions/pointers?
r
Hey @showtim3 in your tests, you want to do the login operation as well and use the tokens generated by them. This way, the access token won’t expire during that test’s lifetime.
Alternatively, you could set the access token’s and refresh token’s lifetime to be very very long and then use that for all the tests
s
hey @rp thanks a lot for replying first of all. I am using passwordless so it sends out an email otp, are you suggesting i grab that otp using the tests as well?
r
Yea. You can grab that OTP during testing. The way you can do that is to provide the email sending callback and (which takes the OTP as an input) and use that
s
Sorry didn't understood the last part. "The way you can do that is to provide the email sending callback and (which takes the OTP as an input) and use that"
do you mean logging in to gmail for ex?
And provide the
sendEmail
function in which you get the OTP
and save that somewhere in memory. And then from the test, you can grab that OTP (via some custom API) and that way, you can login
s
Yeah I am using this itself(custom email logic). So let me know if I am right, there are two ways with which i can proceed(without the cookie stuff) 1. Actually login to the provided email, and grab the otp using the tests. 2. Save the otp somewhere in the sendEmail function, create a custom api to access it from the tests.
r
yes. Correct
s
ok thanks a lot. 😄 Thanks for reaching out so early.
Much appreciated.
r
👍