ouija-io / ouija

Communicating with ghosts
http://ouija.io
BSD 3-Clause "New" or "Revised" License
128 stars 14 forks source link

Introduce functional tests #55

Closed halfdan closed 9 years ago

halfdan commented 10 years ago

We should add functional tests using PhantomJS/CasperJS. This would most likely require a dummy account for GoInstant in order to test loading/posting comments.

An alternative would be to stub all API requests/responses. This would include faking authentication with all supported identity providers.

colinmacdonald commented 10 years ago

100% yes.

Best bet is to just stub/mock the goinstant API for unit tests. We have done this in various other projects:

https://github.com/goinstant/goangular https://github.com/goinstant/user-list https://github.com/goinstant/webrtc

colinmacdonald commented 10 years ago

http://facebook.github.io/jest/

mattcreager commented 10 years ago

I've begun to pull together the 'sunny day' functional tests in PR #65.

I'm experimenting with Dalek; it's too early to say whether we'll be able to carry it into production, but it provides a shiny Phantom abstraction, and allows us to leverage Sauce Labs.

As @halfdan suggested above, I'm using a 'dummy' GI account and I'm hopping over authentication (just generating a JWT manually, though we should probably stub the providers at some point).

I've temporarily dumped the configuration into ouija.json, we'll want a separate configuration for testing, where should we drop it? Also, we're going to have to touch instantiation to add these tests, that should make #65 easy to implement :)

This is my first tango with functional tests. Suggestions welcome.

colinmacdonald commented 10 years ago

The test config should probably be in config/, maybe a standalone tests.json?

mattcreager commented 10 years ago

Should we mirror Ghost by renaming 'app' to 'core' and moving the 'test' directory into it too?