jeudi 31 janvier 2019

How to use Capybara sessions or remember a user login

I want to test a chat app with Minitest and Capybara. The app assigns a logged-in user a unique ID. This ID is embedded in the head of an html-document and calls a javascript script which is used to connect with a visitor to chat with him.

Now, the problem is that every time I log in with capybara the ID changes (as it is for every new user). But I need the ID to configure the test.html file so the chat is assigned to the right user.

How can I make Capybara remember my user that I created in my fixtures.yml? Is there even a way? I tried using sessions but I'm not sure how to do it exactly nor if that is the right approach....

Any help is highly appreciated!

Best,

Aucun commentaire:

Enregistrer un commentaire