Code refactor in client spec

Split api spec file into two:
* websocket api spec
* post api spec
* add common processing such as instantiating the generator and so on into the file client/spec/common.coffee
* move generator class into the separate file because it's used by drawer too
Fix problem when some websocket tests failed in sync mode