javascriptcypress

How to use cypress for end2end testing interaction between 2 users at the same time


Can cypress test interaction between 2 users logged in at the same time?


Solution

  • Not really. Cypress can operate only on a single browser tab, and even if it could work with two tabs (it won't), they'd share the same domain environment (cookies, localStorage...), and even if not, I don't ever see Cypress to be able to operate two independent browsers at the same time at the speed that would allow you to predictably simulate concurrency.

    Best you can do is to stub your requests via cy.route and respond with what you need to emulate concurrent usage (e.g. resources being locked...). I don't know what particular scenarios you want to test, so can't suggest more.

    In fact, this is what Cypress team suggests.