Here you are
The original content is at my gist: https://gist.github.com/TomFreudenberg/994f107a029d152049eb
Hope you like it.
This is a very simple casperjs example, to show how to simulate a user accessing a meteor application like the todos example.
The casper script will do:
- connect to the
todos example app
- add a new list
- iterate through all existing lists and open/load each once
Between each step there is a small random time, so that the “loads” are not aligned.
You can also enable casper debug to see a lot more debugging output that is very usefull for usability checks.
If you open your browser in parallel you will notice the growing number of the lists.
This was made and tested on MAC OSX with
First create a simple new example to use this demo script.
I expect, that the meteor server will run on default URL (localhost:3000)
# create a new meteor example
meteor create --example todos
Open an additional terminal to run the casper “user”
# install npms on first time
npm -g install casperjs
npm -g install phantomjs
npm -g install sugar
# get the casper script
curl -L -O https://gist.githubusercontent.com/TomFreudenberg/994f107a029d152049eb/raw/48216827c9ab8e4170a404ed348930898ffe3afc/simple-actions-on-todos.casper.js
# run the magic
If you want to start a number of simulation processes in parallel, you can use
bash technic like:
for ((i=1; i<=5; i++)) do casperjs simple-actions-on-todos.casper.js & done
Remark: I have added a number of
requires that are not necessary on this casper script but I advise you to use them, cause those will help on more complex scripts.
- Casperjs module documentation
- Casperjs hompage
- Phantomjs homepage
- Sugarjs Features