More tests

I've added tests for docs and demo, updated to latest master and other fixes. Test pass, but it seems to be slightly unstable. Would be nice to have it thoroughly reviewed.
?