This will not work due to the nature of the step / planning for casperjs. See Also Running multiple instances of casperjs .
In the sample code, instance B starts only after completion of A , since execution begins with a call to run .
The easiest way would be to write two separate casperjs scripts (or one script, but it is called with different data for two parties), and each of them is run asynchronously from the command line. On linux, I would use nohup ... & for this.
As for the specific stages of testing. I think itβs easier for you to allow the application to handle the events necessary to synchronize the two casperjs clients. If this is a chat application and you want two hour chats to chat, you should write a dialogue in advance, which includes at what stage the client says what.
Then you can synchronize clients using waitForText :
- A sends fixed / known text, while B expects this fixed text to appear.
- B receives this fixed text, and A is in the next step and is waiting for a response from B (also known text).
- B sends the next fixed text, and A is still waiting
Of course, you will need to play with expectation expectations.
Artjom B.
source share