It has felt pretty odd to do automated testing compared to how easy is the GraphQL or Media library integration in Strapi. So I wanted to match the simplisity and efficiency of the official Strapi plugins by creating a community plugin for automated testing.
The goal was to skip the “Do it yourself” approach of the documentation and bundle all of that in a plugin.
But why stop there? How many things can be automated so that after installing the plugin we can jump strait to the business code and not spend time with config or boilerplate?
Well, dad iz deu question (“That is the question” but with french accent).
Currenlty the plugin (a.k.a. Proof-of-Concept) does (link below):
- Bundles all the dependencies in one plugin (no need to install
- Automatically creates the
__tests__folder with a
__config__folder inside of it that contains the
database.js(so all the things related to testing are in that one folder)
- When running the tests it will automatically replace the
__tests__/__config__/database.jsso your testing database is not mixed with the real database config
- Automatically create a folder for each API endpoint (and create new ones later if added) (e.g.
Things it could potentially do:
- Test coveradge command out-of-the-box
- Pre-commit testing out-of-the-box
- Helper functions to create Admins, SuperAdmins and other Strapi related stuff
- Putting all depencencies in
devDependencies(including the plugin itself) so that nothing of the testing environment gets in the way in production
- We have the schema of each endpoint so we could do cool things with it too
So the question: is this usefull? would someone use this? should I botter making it better and maintained it?
If yes, should it be with all the automation stuff or just stick to what the documentation tells you to do?
Here is the Github Repo and the strapi-plugin-testing npm package (hit me up if you want the name back ). I have just tested it on my machine so have low expectations. Its running the tests slowly because is not proprely configured (POC).
Be harsh and honest in you comments please (about the idea, not the code), thank you for reading