meteor-user-status icon indicating copy to clipboard operation
meteor-user-status copied to clipboard

Best way to create some test Users that are always "online"?

Open fuzzybabybunny opened this issue 10 years ago • 8 comments

Since I'm developing on my own, I would like to create several test user accounts (created initially in fixtures) that are always "online." What's the best way to do this? Even if I set status.online: true in the fixtures (via Accounts.onCreateUser()) I bet it would just get changed to false as soon as the package runs.

fuzzybabybunny avatar Dec 10 '14 07:12 fuzzybabybunny

Haha, I guess I could just have like 5 browser tabs open at the same time each with a different user logged in.

fuzzybabybunny avatar Dec 10 '14 07:12 fuzzybabybunny

Yep, multiple browsers are the way to go. You can't actually use the same browser with different tabs because they will share a login token through local storage.

mizzao avatar Dec 10 '14 17:12 mizzao

Hmmm... well, the issue is that I'm building a geo-location app. The online users all should have a different GPS coordinate. So if we have multiple online users via the multiple-browser method, all of the "users" would have the exact same GPS coordinate, haha, which is of limited use.

fuzzybabybunny avatar Dec 11 '14 09:12 fuzzybabybunny

In the tests for this package, we can create and change the status of connected users. However, I'm not sure that Meteor allows accessing test code of other packages yet. You can take a look at how that is done, and maybe do the same for the situation you are trying to create.

mizzao avatar Dec 11 '14 16:12 mizzao

incognito mode doesn't share storage with the regular mode, so that's one extra user you can use per browser. I have tested with quite a few simultaneous logins that way, running on chrome and firefox on the desktop, phone and tablet.

illuminaut avatar Dec 16 '14 06:12 illuminaut

@illuminaut yep, I do that too.

mizzao avatar Dec 18 '14 21:12 mizzao

@fuzzybabybunny you can always have your test fixtures create and delete accounts in the setup and teardown phases of your test, too. UserStatus only clears stuff when it's starting up. I think some of the tests in this package also rely on that to work.

mizzao avatar Feb 18 '15 16:02 mizzao

As a follow-up to this, see https://github.com/mizzao/cooperation-loadtest for a way to use one Meteor app to use DDP to connect to another Meteor app and mimic real connections. This is probably about as good as it gets without actually using real browser tabs.

mizzao avatar Sep 03 '15 17:09 mizzao