News for hackers. Stuff that matters.
Re:Polly.js – Record, replay, and stub HTTP interactions by ikeboy on Wednesday June 13, 2018 @09:26PM (#17308531)
So is this basically selenium in javascript with some neat features?
Re:Polly.js – Record, replay, and stub HTTP interactions by passive on Wednesday June 13, 2018 @10:49PM (#17308881)
I think this is more of a complement to Selenium, where you can use Selenium to drive the browser to test the UI, with Polly providing recorded back-end responses. I need to look into it more, but this might address a need we have to make it easy (and quick) for our front-end developers to run our test suite locally during development, without having to spin up anything in the backend or rely on flaky non-Production environments.

EDIT: I am aware there are many other tools that can address this, we just haven't had the time yet to implement them. :)

Re:Polly.js – Record, replay, and stub HTTP interactions by gleenn on Wednesday June 13, 2018 @09:29PM (#17308544)
Sounds more like the VCR gem from Ruby land.
Re:Polly.js – Record, replay, and stub HTTP interactions by zwentz on Wednesday June 13, 2018 @09:35PM (#17308574)
Yes exactly, that's the idea anyway. Has a few nice features on top such as controlling the network latency and expiring recordings (useful when working on a project supported by a big team).
Re:Polly.js – Record, replay, and stub HTTP interactions by tootie on Wednesday June 13, 2018 @10:02PM (#17308674)
This isn't selenium. More like wiremock.
Re:Polly.js – Record, replay, and stub HTTP interactions by ikeboy on Wednesday June 13, 2018 @10:11PM (#17308711)
What's the core distinction between this/wiremock vs selenium?
Re:Polly.js – Record, replay, and stub HTTP interactions by tootie on Wednesday June 13, 2018 @10:38PM (#17308834)
Selenium is for behavior testing. Simulating clicks and form filling. This is for mocking http endpoints.
Re:Polly.js – Record, replay, and stub HTTP interactions by cottsak on Wednesday June 13, 2018 @10:53PM (#17308890)
I still don't get why we do this [mocking http endpoints].

Sure this makes the problem of mocking the server less painful. Well done. But I'd take completely integrated tests over these any day. Sure they're slower but that's more or less irrelevant with feature toggling, staged roll-out and continuous production monitoring.

It's totally possible to completely avoid mocking http endpoints thus making these tools completely obsolete.

Re:Polly.js – Record, replay, and stub HTTP interactions by jasonmit on Thursday June 14, 2018 @12:40AM (#17309337)
See my comment above. This is not a replacement for E2E testing.
Re:Polly.js – Record, replay, and stub HTTP interactions by tootie on Wednesday June 13, 2018 @11:05PM (#17308941)
It's not always easy. Especially not if your API is stateful.
Re:Polly.js – Record, replay, and stub HTTP interactions by strken on Thursday June 14, 2018 @12:12AM (#17309227)
Or if it's not your API. I've been looking for something like this to make mocking OAuth flow a lot easier.
Re:Polly.js – Record, replay, and stub HTTP interactions by ikeboy on Wednesday June 13, 2018 @10:51PM (#17308882)
The example is form filling though:

    await fillIn('email', '[email protected]');
    await fillIn('password', '@pollyjs');
This is exactly like selenium code I've written to login. I struggle to see the difference in purpose.
Re:Polly.js – Record, replay, and stub HTTP interactions by stephen on Wednesday June 13, 2018 @11:43PM (#17309113)
In your selenium code, the browser was talking to a database.

But sometimes that database is down, or really slow.

Polly says "browser, don't talk to the database anymore, instead here's what the database said last time".

So, yes, both Selenium and Polly poke DOM elements, but Selenium stops there, where as Polly does that + as well as tricks the browser into going through the whole test without making a real call to the database (assuming it has a previous recording of "what the database said" for that test).

Re:Polly.js – Record, replay, and stub HTTP interactions by tootie on Wednesday June 13, 2018 @11:05PM (#17308939)
That's part of mocha or whatever. Polly is the server part.
Re:Polly.js – Record, replay, and stub HTTP interactions by dekz on Wednesday June 13, 2018 @10:59PM (#17308911)
> /* start: pseudo test code */