Cypress

While being on call last week I spent some time trying to speed up e2e tests

I’ll share some ideas on how to improve our existing implementation in order to be faster

Our e2e tests spend lot of time executing the login

  • Not because the login process is slow itself but involves loading the page, executing the login process, and wait for the final redirect to the dashboard
  • We repeat this amount of time for a huge amount of our tests

Introducing cy.session

  • It’s an experimental (but not new) feature
  • This is a game-changer functionality for us: we execute only 1 login per user type and then re-use it across all our test suites 😎

Well...

Our actual test suite structure doesn’t help us in order to use this feature

  • cy.session doesn’t work “globally”
  • calls get isolated in the test or describe that uses it. This leaves us in the same spot as we’re now

But what if we change the test structure to...

Ok, but show me the results!!1!!!!!1!!1!

Thank you Don

Extra comments

  • There is a draft MR in mandarina with the implementation
  • I duplicated the same test in every user type file which doesn’t seem to be a good approach. Should we create a custom command to re-use it? cy.executeAuthenticatedUserFlow()
  • Tests take a lot of time in order to be executed. Let’s take advantage of that to write longer tests suites and avoid unit test like checks

Thinking about the future

  • learn.cypress.io
  • Running e2e tests on other browsers if LXB decides to support them (I think it’ll happen someday)
  • .snapshot() seems to be a handful command
  • We need to check for other states as well (no data, errors, pagination, etc.) which doesn’t mean we need more/better data in the test db. Hola cy.intercep()
  • Is this the perfect time to create a Linear project for Cypress as a cross-team work?

Cypress

By Cristhian Duran

Cypress

  • 89