1 Commits
Author SHA1 Message Date
Lauri Ojansivu 4c68a8a49a Browser tests: a login must not log the test's other tabs out.
The last test run failed one test in all three browsers, having passed for a
month:

  02-cards-open-view.e2e.js:66 copy-link ... opens the card in full-screen view
  Error: Token login failed: You've been logged out by the server.

Driven over DDP against the running server, with a token seeded the way the
fixtures seed one:

  session A: ok           tokens: [CfgBWImyytla]
  session B: ok           tokens: [CfgBWImyytla]  <- two sessions, one token
  after B logged out      tokens: []              <- logout removed it
  session C (same token): ERROR You've been logged out by the server.

A seeded user has ONE resume token and Meteor.logout() deletes it on the
server, for every session sharing it. loginWithToken called it when the page
was logged in as somebody else, so switching users in one page stranded the
test's other pages. The copy-link test is the only one that logs a second page
in, which is why it was the one that failed.

loginWithToken now ends the previous session in the client - drop the three
Accounts keys, reload - which it already does for its own first load. The
token is untouched and the page still arrives with no user. logout() stays as
its own helper: 05-admin-users logs out and back in with a password, which is
what a user really does.

Two pages are two browsers, so they get two tokens: db.addResumeToken() adds
one to an existing user and the second tab uses it. That tab also stopped
waiting for networkidle before looking for the card - a card renders when its
subscriptions land, not when the network goes quiet.

tests/e2eSessionTokens.test.cjs pins both rules and scans every spec for two
logins sharing one token. Verified against the running server: the copy-link
test passed four times in a row, and 05-admin-users, 32-org-team-feature-
toggles, 33-board-domains and 38-impersonation - the specs that switch users -
all pass.

Thanks to xet7 !
2026-08-12 21:16:40 +03:00