Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Global hook to maintain our logged in state in our E2E test #1967

Open
gweiying opened this issue Sep 15, 2022 · 0 comments
Open

Global hook to maintain our logged in state in our E2E test #1967

gweiying opened this issue Sep 15, 2022 · 0 comments

Comments

@gweiying
Copy link
Contributor

Context

For our E2E testing, we have to run a login flow before every test that runs in authenticated pages. This is because there's no way to reuse the authentication between tests (unless through a global before hook). (This seems to be a quirk of TestCafe to not allow nested tests, otherwise we could group the tests within a nested test, and run a before hook so that the authentication can be preserved)

This increases the duration of our total E2E testing because the login flow needs to run for every test.

Technical brief

Explore ways to maintain our logged in state between tests, such as:

  • having a global hook to log us in by default (such that we stay logged in), but disable it for the Login suite
  • other simpler ways (I didn't see any from the cursory read of documentation)
  • Moving out of testcafe (?)

More Details

From #1963

LoginProcedure runs on every test, which makes the tests much longer. This seems to be a quirk of TestCafe to not allow nested tests, otherwise we could reuse the same testController across the whole test suite, and not have to log in every time. Something we could also explore is having a global hook to log us in by default (such that we stay logged in), but disable it for the Login suite. What do you think? I'll open this as an issue as I also think this is not blocking for now - it probably doesn't hurt if our E2E tests are 20 seconds longer since they already take 8 minutes to complete.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant