Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Record mode still hits network even if all requests have been recorded? #7

Open
exogen opened this issue Nov 6, 2017 · 1 comment

Comments

@exogen
Copy link

exogen commented Nov 6, 2017

I'm having a hard time figuring out if record mode works like Sepia's cache mode or not (reuse existing playbacks, but record any new requests).

If I disable my network connection and run my tests in play mode, they all pass because the playbacks all exist. But if I run in record mode with no network, and my tests don't make any new requests (again, the playbacks all exist), it just stalls. So what is record actually doing in this situation: using the playbacks, or not? The docs make it sound like it should be using them, but then it should pass with no network if the same HTTP requests are being made…

@exogen
Copy link
Author

exogen commented Nov 6, 2017

Here's a simple test I just tried out that makes me think this behavior doesn't make sense:

  • In a test, make an HTTP request and use t.snapshot to snapshot the response body. Run with AVA_PLAYBACK=record ava -u. A snapshot and playback should be saved.
  • Now edit the playback file to have a different response body.
  • Running AVA_PLAYBACK=play ava fails as expected (the response body in the playback is returned, and compared with the snapshot, and they no longer match).
  • Strangely, AVA_PLAYBACK=record ava (note no -u) succeeds. The actual live HTTP response from the network is returned and compared with the snapshot (and they match), the playback isn't used. That's a little weird given what the docs say, but it might make sense to do – BUT the playback also isn't updated – it still has the edited response body. I'd expect either (1) the test fails because the playback is used (no new requests were made in the test) or (2) the test succeeds and the playback is updated (undoing our edited response body).

This is causing me issues currently – I'll write new tests, run AVA_PLAYBACK=record ava -u, and existing snapshots are updated (due to frequently-changing values in the response) but out of sync with the playbacks, which don't get updated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant