puppetry
puppetry copied to clipboard
Suggestion: Template expressions escape hatch
Puppetry is an impressive app and it lets our test automating person do things she doesn't know enough programming to do. But sometimes we need to reach outside of the tools into using JS for things. I think template expressions could offer more here to avoid having to go deep into the JS methods and dynamic template variables.
There would be some benefit to having eval
and evalAwait
or something like that to allow going beyond the built-in utilities without necessarily needing to go very deep. For example, I needed to generate an iso8601 timestamp, strip a few characters. That's doable in a line of JS.
Please check the last commit at https://github.com/dsheiko/puppetry/tree/dev
The syntax like
resolves into
await bs.page.goto( `${ os.version() }`, {"timeout":30000,"waitUntil":"load"} );
if you need quotation marks in it just escape them.
I believe something like ( await apiFunc() ) will serve.
Within the test body now exposed:
fs = require( "fs" ),
path = require( "path" ),
os = require( "os" )
Does it satisfy the https://github.com/dsheiko/puppetry/issues/95 ?
Looks great and should take care of noth, yeah!