-
I am trying to write a test for my application's login page. I think I have most of it figured out, but I am stuck on checking the actual session data. How can I assert on session data? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Assuming you are using Phoenix or Plug, you're session cookie is most likely encoded and/or encrypted. You could figure out some way using the Plug.Crypto module to decode it, but that wouldn't seem worth it to me. What I would do is log in and assert that something on the page is specific to that user, like a name. Or, if your auth solution keeps track of sessions in your database you could log in and then assert that a session record is stored in the database. |
Beta Was this translation helpful? Give feedback.
Assuming you are using Phoenix or Plug, you're session cookie is most likely encoded and/or encrypted. You could figure out some way using the Plug.Crypto module to decode it, but that wouldn't seem worth it to me.
What I would do is log in and assert that something on the page is specific to that user, like a name.
Or, if your auth solution keeps track of sessions in your database you could log in and then assert that a session record is stored in the database.