Girls and boys,
I am developing Drab, an extension to Phoenix which allows you to manipulate browser UI directly from Elixir. Inside it, I use Channels to communicate with the client, as well as some other Phoenix function, like Token. Drab cannot live without Phoenix, there is no way to run it standalone. There are two parts of the project: server-side Elixir and client-side JS library.
The project is slowly going from sandbox to beta, so now it is a time to consider the way how to do the tests. Most of the Drab functionality is about communicating to the browser and getting replies back from there (or vice-versa). Therefore, unit tests can not cover a lot. I need functional (end-to-end) tests.
I am planning to use phantomjs
for this, as I have a good experience using this browser in the Rails world.
What I need from the community, is to help me to choose the approach for end-to-end tests. For functional testing, I need Phoenix with Drab to be running. For now, I’ve found this options:
-
Include Phoenix app in the Drab:
Create the Phoenix application inside Drab, just for tests, and limit the Hex package to Drab libraries and templates. -
Create standalone Phoenix app and put Drab under umbrella with it
This option I like the most, as Drab and Phoenix app will be separated. And it is simple. But what if someone want to include Drab to his application without using hex, but directly from github?
There is also a third option:
- Go standalone
Remove dependency of Phoenix and add websockets functionality to Drab, so it will not need Channels anymore. The issue is that it is a plenty of work, and I would feel like re-inventing the wheel. Phoenix Channels and Tokens are great, why not to use it?
Please share your opinion, thanks in advance