I moved away from this as I found the tests too brittle. Most used xpath which is great for quickly making selectors, but any changes to the webpage and the tests break. CSS selector generation is a bit better, but not much.
My flow for writing tests is basically:
1) use the element explorer script to create/test selectors on the page
2) Use those selectors to create "page objects”
3) Put those page objects into their own files, then use require() to load them into tests that need them (since it’s NodeJS under the hood)
4) Write tests against page objects
Bit slower to write tests, but break way less. We’ve already done a major change to the UI, and only had to change a handful of page objects and the tests were back up and running.
Perhaps there are better ways, but that’s working ok for us.
Cheers,
~Owen