vendredi 1 mars 2019

Does TestCafe require useRole call in every test/beforeEach

I've been evaluating TestCafe for an app that requires user authentication. The documentation isn't very clear and I've had trouble getting a straight answer on how we should be using useRole.

Our application requires user authentication, right now we only test a single user so we have no need to switch user sessions.

I've defined a Role and it authenticates correctly. But I've noticed the following:

  1. I need to call useRole first in every test in order to use the authenticated session
  2. Every time useRole is called (first in every test) TestCafe navigates the browser back to the original login URL (or whatever preserveUrl saves post-login)

Are either of these statements wrong? I can't imagine how this works in a real environment, that's an insane amount of redirects.

Item 2 seems correct, a devexpress github contributor replied "Currently, TestCafe can't use a Role without reloading or triggering page navigation" so if I have to call useRole in every test that's literally doubling the HTTP navigation load.

Aucun commentaire:

Enregistrer un commentaire