2

I am developing chat application, using node.js socket.io module on a server, and javascript on a client. As it become more complex, I become tired to test different usage scenarios by clicking across browsers. At now I use different browsers in order to separate cookies. So in Firefox there is one chat participant, in Opera - second, etc.

Therefore my question is:

Can I automate this somehow?

I've heard about headless testing engines like Phantom JS, Selenium WebDriver, but I don't know how to write tests between different browsers. In fact, I indeed need to separate cookies, different browsers are here only for this task.

May be I cannot explain my problem to Google :) All answers on such question imply cross-browser development, and testing that aspect.

Any help will be appreciated a lot!

  • This would be very nice if it could happen in an environment like this: https://chrome.google.com/webstore/detail/split-screen/eachfleknamlcepmplpdghagngjfjkin – Blubberguy22 Aug 27 '14 at 13:12
  • @Blubberguy22 I don't clearly understand, what do you mean with this extension. Can you explain more further your idea? – Timur Ramazanov Aug 27 '14 at 17:37
  • This is just a chrome extension that allows two tabs to be open right next to each other. I was saying it would be nice if these tabs could be operated with separate cookies. – Blubberguy22 Aug 28 '14 at 13:03

1 Answers1

1

The answers shown at How to test two interacting browsers (e.g. chat app) might be of use if you try to go the Casper/Phantom/SlimerJS route. I'm not marking it as a duplicate as your question is more general, whereas that one is about exactly how to synchronize two CasperJS instances; it is also not specifically about socket.io.

Note: if using Phantom to test Web Sockets you will need to get Phantom 2.x (which is still experimental, and does not have an easily downloadable beta yet), as Phantom 1.x uses an old WebKit. SlimerJs always uses a recent Gecko (i.e. Firefox) engine, so is fine.

Each instance of PhantomJS can have its own cookies. This answer (and the other answer on that question) explains your choices well.

SlimerJS cookies are similar, but persistent cookies are stored in the Mozilla profile, so if you wanted to run multiple instances, you would want to specify an explicit profile for each instance. (Though your chat application may only be using session cookies, in which case this does not matter.)

Anyway, as cookies are used I would definitely run two instances of CasperJS, rather than try to use two tabs, or two frames.

Community
  • 1
  • 1
Darren Cook
  • 27,837
  • 13
  • 117
  • 217