Hi all,
I have followed the tutorial and played around with serenity-js and have found it differs quite greatly from the serenity-bdd Java version.
One thing I haven't figured out how to do yet, is how to create test scenarios with cucumber-js that doesn't automatically instantiate protractor and a browser for each scenario.
As I'd like to use serenity-js for both our integration and acceptance tests, although I don't want it to instantiate protractor and open chrome etc. for the integration tests that only test REST-API.
Could anyone shed some light on this please?
Thanks and regards.
Hi there,
At the moment Serenity/JS is initialised as a Protractor "framework", which puts Protractor in control of browser management. That's a good thing for UI-based tests, but not ideal for the REST-only ones.
I'm in a process of extracting the Serenity/JS core into a stand-alone module, which will support both #6 and #28 as well as your scenario out of the box. If you'd like to hack on it in the meantime though, then you could have a look at how serenity object is:
And plug it into your framework directly.
If you're running your integration tests with Mocha, it should be enough to create a mocha "reporter" that notifies Serenity/JS of test start/stop events and the test results. Probably something along those lines.
Does that help?
Hi Jan,
Thanks for your reply.
I will experiment a bit more, in the mean-time could I just create a second protractor.conf.js which doesn't include the browser type and capabilities etc. so it just won't spin up a new browser instance for my REST-API tests?
And then try to implement my journey design pattern to call a JS http request library as opposed to the BrowseTheWeb capability?
I would also prefer not to hack around with it as of yet I think it just creates additional problems in the future with the framework if you do new releases of Serenity-JS etc.
Thanks!
Hey @GeeChao, I've extracted the @serenity-js/core, which you can plug into any standard Mocha/Chai test. This should hopefully allow you to experiment with writing rest/db-specific abilities!
@jan-molak Awesome, that sounds great! will give it a go along with the cucumber framework to test rest services :)
@Bassie has started working on this feature in #131. I'll close this ticket so we can move this conversation to one place.
I moved this one to #134
Most helpful comment
@jan-molak Awesome, that sounds great! will give it a go along with the cucumber framework to test rest services :)